Does There exist a continuous bijection $\mathbb{Q}\to \mathbb{Q}\times \mathbb{Q}$?

Does there exist a continuous bijection $\mathbb{Q}\to \mathbb{Q}\times \mathbb{Q}$?

I am not able to find out how to proceed.

Solutions Collecting From Web of "Does There exist a continuous bijection $\mathbb{Q}\to \mathbb{Q}\times \mathbb{Q}$?"

Every countable metric space without isolated points is homeomorphic to the rational numbers. In particular $\Bbb{Q\times Q}$.

This is a theorem of Sierpinski, and you can find the details here:

Not only do such a maps exist, it is possible to construct explicit
instances. Here is a sketch of how this can be done.

Let $\pi$ be an irrational real. For every $n \in \mathbb{Z}$ the set
$\mathbb{Q} \cap (n+ \pi, n+\pi+1)$ is both open in $\mathbb{Q}$ and
homeomorphic to $\mathbb{Q}$. A homeomorphism can be constructed by
taking two rational sequences, one increasing and one decreasing to $\pi$ and constructing
a piecewise linear, increasing function.
Thus we obtain a homeomorpism $f: \mathbb{Q} \to \mathbb{Z} \times \mathbb{Q}$.

It is also possible to obtain an explicit bijection $g: \mathbb{Z} \to \mathbb{Q}$, which is always continuous, since $\mathbb{Z}$ is discrete.
If we then put $h_1(x) = g(f_1(x))$ and $h_2(x) = f_2(x)$ then $h: \mathbb{Q} \to \mathbb{Q} \times \mathbb{Q}$ is the desired continous bijection.