Prove that there cannot be a continuous onto function $f :\Bbb R \to \Bbb R \setminus \Bbb Q$
Please let me know if you agree with my proof:
Suppose, toward a contradiction, that there exists such a continuous onto function $f :\Bbb R \to \Bbb R \setminus \Bbb Q$ . Since $\Bbb R$ is connected, $f(\Bbb R) \subset \Bbb R\setminus \Bbb Q$ must also be connected. Pick any $q \in \Bbb Q$ and let $U=(\infty, q)$ and $V=(q, \infty)$. Note that $U$ and $V$ are non-empty, disjoint and open. Then $U\cup V$ is a disconnection of $\Bbb R\setminus \Bbb Q$, a contradiction. Furthermore, ${\Bbb R}=f^{-1}(U \cup V)$ is also a contradiction since $\Bbb R$ is connected.
If two irrational numbers were in the image, then by intermediate value theorem any number between them would be in the image as well. Thus, some rational will have to get covered. So, at most one irrational may be in the image. So, $f$ must be a constant function.