Connectedness of points with both rational or irrational coordinates in the plane?

Is the set of points in the plane whose coordinates are either both irrational, or both rational connected?

Solutions Collecting From Web of "Connectedness of points with both rational or irrational coordinates in the plane?"

Let $S$ be your set, and suppose $S = U \cup V$ where $U$ and $V$ are disjoint, and are both closed and open in $S$. Note that if $x$ and $y$ are both rational, then the diagonal lines $\{(x+t, y+t): t \in {\mathbb R}\}$ and $\{(x+t,y-t): t \in {\mathbb R}\}$ are subsets of $S$. Using a path of diagonal line segments, it is possible to get from any point of ${\mathbb Q} \times {\mathbb Q}$ to any other while staying in $S$. Therefore one of $U$ and $V$, let’s say $U$, contains all of ${\mathbb Q} \times {\mathbb Q}$. But ${\mathbb Q} \times {\mathbb Q}$ is dense in $S$, and $U$ is closed in $S$ so $U = S$.

For extra credit, show that $S$ is path-connected. In fact, if $a &lt b$ and $c &lt d$ with $(a,c)$ and $(c,d)$ in $S$, there is a continuous increasing function $f: [a,b] \to [c,d]$
such that $f(x)$ is rational if and only if $x$ is rational.