Prove or disprove that there does not exist a monotone function $f:\mathbb{R}\rightarrow\mathbb{Q}$ which is onto. Prove or disprove that there does not exist a monotone function $f:\mathbb{R}\rightarrow\mathbb{Q}$ which is onto.
Clearly $f$ can not be continuous. Suppose $f$ is discontinuous. Then it can have only countably many points of discontinuity. From this how to proceed?
 A: There's nothing wrong with the proof above.  I offer a slightly different approach.
If such a function $f$ exists, then (substituting $-f$ for $f$ if necessary) there is an increasing function that works.
Choose $y \in \Bbb R \setminus \Bbb Q$.  Then $\exists r \in \Bbb Q$ with $y \lt r$.  Since $f$ is surjective, $\exists t \in \Bbb R$ such that $f(t) = r$.  Because $f$ is increasing, that means that $t$ is an upper bound for $A= \{ x \in \Bbb R ~\vert~ f(x) \lt y \}$ (which we know is non-empty because $f$ is surjective and $\exists s \lt y$ with $s$ rational), so $x = \sup A$ exists.
Since (by assumption) $y \notin \Bbb Q = \operatorname{range}(f)$, we have $f(x) \neq y$.  If $f(x) \lt y$, then because $\Bbb Q$ is dense in $\Bbb R, \exists s \in \Bbb Q$ with $f(x) \lt s \lt y$.  But then $f$ surjective $\Rightarrow \exists x_1$ such that $f(x_1) = s$.  Since $f$ is increasing, $x \lt x_1$, but $x_1 \in A$ and $x = \sup A \Rightarrow x_1 \leq x$ so that's not possible.
Conversely, if $y \lt f(x)$, then $\exists s \in \Bbb Q$ with $y \lt s=f(x_2) \lt f(x)$.  But then $x_2 \lt x$ is an upper bound for $A$, contradicting our definition of $x$.
So there is no value $f(x)$ can take, establishing a contradiction.  Thus, no such function $f$ can exist.
A: Assume WLOG $f$ is non-decreasing. First of all,

Claim As an $\mathbb R\to\mathbb R$ function, $f$ cannot be continuous everywhere.
proof. Suppose $f$ is continuous on $\mathbb R$. Then we find a sequence $\{a_n\}$ in $\mathbb Q$ such that $a_n\nearrow\sqrt{2}$. By the surjectiveness (when considered as a $\mathbb R\to\mathbb Q$ function) we can find $\{x_n\}$ in $\mathbb R$ such that
$$f(x_n)=a_n$$
and by the monotonicity of $f$ we assume $\{x_n\}$ is an increasing sequence. Clearly $\{x_n\}$ is bounded, otherwise $f$ is bounded by $\sqrt 2$, which contradicts $f$ being onto $\mathbb Q$. Hence $\{x_n\}$ tends to its upper bound (denoted by $\alpha<\infty)$ as $n\to\infty$. Now by the continuity of $f$,
$$f(\alpha)=\lim_{n\to\infty}f(x_n)=\lim_{n\to\infty}a_n=\sqrt{2}$$
which contradicts the range of $f$ being $\mathbb Q$.

By this claim, $f$ is non-decreasing and discontinuous at at least one point, say $\beta$, then
$$\lim_{x\to\beta^-}f(x)<\lim_{x\to\beta^+}f(x)$$
(The limits may not lie in $\mathbb Q$) Now again by the non-decreasing property, $f$ cannot assume any value inside the interval
$$(\lim_{x\to\beta^-}f(x),\lim_{x\to\beta^+}f(x))$$
which surely contains a rational number. This contradicts $f$ being onto $\mathbb Q$.
