Continuous self-maps on $\mathbb{Q}$

There exists a monotonic bijection $\Bbb Q\to\Bbb Q\setminus\{0\}$. This is then automatically a homeomorphism.

To see this, let $\{q_n\mid n\in\Bbb N\}$ be an enumeration of $\Bbb Q$ and define $f(q_n)$ recursively: Find the smallest $m$ such that $q_m\ne 0$ and for all $k<n$ we have $q_m {<\atop>} f(q_k)\iff q_n{<\atop>} q_k$. Then define $f(q_n)=q_m$. The crucial point is that $\Bbb Q\setminus\{0\}$ is still linearly ordered such that there is no largest and no no smallest element and there is another element between any two given elements, thus always allowing us to find such a $q_m$.


The same method helps find a continuous surjection $\Bbb Q\to S$. Just if there is no matching element in $S$, relax the $<\atop>$ condition to allow equality.


The answer to both questions is yes.

It's a standard result that the rationals are the unique countable metrizable space without isolated points, so $\Bbb Q\setminus\{0\}$ is homeomorphic to $\Bbb Q$.

Let $S$ be a non-empty subset of $\Bbb Q$. Then $S\times\Bbb Q$ is homeomorphic to $\Bbb Q$, and the projection $\pi:S\times\Bbb Q\to S$ maps it continuously onto $S$.


Let me give yet another argument for the second question. Note that you can partition $\mathbb{Q}$ into infinitely many nonempty open sets $U_n$ (for instance, let $\alpha_0<\alpha_1<\dots$ be your favorite unbounded increasing sequence of irrational numbers and let $U_n=(\alpha_{n-1},\alpha_n)\cap\mathbb{Q}$ where $\alpha_{-1}=-\infty$). The surjection $f:\mathbb{Q}\to\mathbb{N}$ sending $U_n$ to $n$ is continuous. Since any map with domain $\mathbb{N}$ is continuous, $\mathbb{Q}$ can continuously surject onto any space that $\mathbb{N}$ can surject onto, i.e. any countable nonempty space.