Show that $X = \{ (x,y) \in\mathbb{R}^2\mid x \in \mathbb{Q}\text{ or }y \in \mathbb{Q}\}$ is path connected. [duplicate]

Solution 1:

HINT: You can get from any point of $X$ to any other point of $X$ by a path consisting of at most three line segments, all of which are either horizontal or vertical.

Solution 2:

Let $A=\left(\mathbb{R}\times\mathbb{Q}\right)\cup\left(\left\{0\right\}\times\mathbb{R}\right)$ and $B=\left(\mathbb{Q}\times\mathbb{R}\right)\cup\left(\mathbb{R}\times\left\{0\right\}\right)$. Show that $A$ and $B$ are path-connected (given 2 points in $A$, you can connect them with a path consisting of 3 smaller paths, something like horizontal-vertical-horizontal, and similarly for $B$). Now, $X=A\cup B$ and $A\cap B$ is not empty (for example $(0,0)\in A\cap B$)). From an easy theorem you probably know, these imply that $X$ is path-connected.