TITLE: Does using continued fractions work to give a homeomorphism $\mathbb{Q}^+ \rightarrow (\mathbb{Q}^+)^2$?
QUESTION [5 upvotes]: Let $\mathbb{Q}$ be the topological space of rational numbers (with topology induced by inclusion in the real line) and let $\mathbb{Q}^+$ be the set of positive ($x>0$) rationals.
I'm looking for a simple construction of a homeomorphism $\phi: \mathbb{Q} \rightarrow \mathbb{Q}^2$ (not using an abstract result). In an early post, it was suggested to use continued fractions, but this has problems with negative numbers. My idea is we can first make a homeomorphism $f: \mathbb{Q}^+ \rightarrow \mathbb{Q}$ via $f(x) = (x-1)^3/x$ and then we can just worry about $\mathbb{Q}^+$.
Then the homeomorphism
$\phi: \mathbb{Q}^+ \rightarrow (\mathbb{Q}^+)^2$ would just go like
$[a_0, a_1, ..., a_n] \rightarrow ([a_0, a_2, ...], [a_1, a_3, ...])$
this seems to be obviously bijective, and I believe it is bicontinous just based on the idea that two continued fractions are close if and only if enough of their initial terms agree (which sounds plausible).
Does this make sense? Or am I missing something? Thanks for your help.

REPLY [2 votes]: Here is one way to form a (not very) explicit homeomorphism.
As has been mentioned, the function $\phi=(\phi_0,\phi_1)$ from the question applied to the set $I^{>1}$ of irrationals greater than $1$ gives you a homeomorphism $I^{>1}\to I^{>1}\times I^{>1}$. So we will be done if we find a homeomorphism from $\mathbb{Q}$ to a countable subset $A\subseteq I^{>1}$ such that $x\in A$ iff $(\phi_0,\phi_1)(x)\in A\times A$ (equivalently, $A=\phi_0(A)=\phi_1(A)$).
We can achieve that if our set $A$ is dense in $I^{>1}$ and we have an enumeration of $A$: then we can follow the proof of Cantor's isomorphism theorem to get an explicit order isomorphism between $A$ and $\mathbb{Q}$ (and thus a homeomorphism, as both sets have their order topologies).
For example we can take $A=\mathbb{I}^{>1}\cap (\mathbb{Q}+\mathbb{Q}\sqrt{2})$, the set of irrationals $>1$ with periodic continued fraction.
P.S. I know almost nothing about continuous fractions, but this could be made more explicit if there was a set $A$ as above and such that we know a homeomorphism from $\mathbb{Q}$ to $A$ without using Cantor's isomorphism theorem. We don't even need the condition $A=\phi_0(A)=\phi_1(A)$ if we know enumerations of $A,\phi_0(A)$ and $\phi_1(A)$ and explicit homeomorphisms of them with $\mathbb{Q}$.