Monotone function with $f(\mathbb{R}) = \mathbb{R} \backslash \mathbb{Q}$

We can assume $f$ is increasing, else replace $f$ by $-f$.

Let $A=\{x \in \mathbb{R}\mid f(x) < 0\}$, and let $B=\{x \in \mathbb{R}\mid f(x) > 0\}$.

Clearly, the sets $A,B$ are disjoint and nonempty.

Also, since $0$ is not in the range of $f$, it follows that $A \cup B = \mathbb{R}$.

Since $f$ is increasing, it follows that for all $a,b$ with $a \in A\;$and$\;b\in B$, we have $a < b$.

Thus, $A$ is bounded above, and $B$ is bounded below.

Let $u$ be the LUB of $A$, and let $v$ be the GLB of $B$.

Necessarily $u=v$.

Since $f(u)$ is irrational, so is ${\large{\frac{f(u)}{2}}}$.

Let $t \in \mathbb{R}$ be such that $f(t) = {\large{\frac{f(u)}{2}}}$.

If $f(u) > 0$, then $f(t) > 0 \implies t \in B$, but then, since $f$ is increasing, $f(t) < f(u) \implies t < u$, contradiction (since $u$ is the GLB of $B$).

If $f(u) < 0$, then $f(t) < 0 \implies t \in A$, but then, since $f$ is increasing, $f(u) < f(t) \implies u < t$, contradiction (since $u$ is the LUB of $A$).

Either way, we have a contradiction.

Note: The proof didn't use strict monotonicity.


I think the idea is that for a monotone function to be discontinuous , it must have a "jump". The idea is that since it "jumps" the function misses an element of the dense set. Let me explain:

Let's assume $f$ is discontinuous at $x_0$ (which we can because $\mathbb{R}$ is connected and $\mathbb{R\setminus Q}$ is not). This means that there exists a monotone sequence $x_n$ where $x_n \rightarrow x_0$ but $|f(x_n)-f(x_0)|\geq ε $ for all $n \in \mathbb{R}$ and for some $ε >0$. Since $f$ is monotone $f(x_n)$ monotone and bounded so there there exists $s=\sup{f(x_n)}=\lim(f(x_n))$.

But we have that $|f(x_n)-f(x_0)|\geq ε$ so $|f(x_0)-s|\geq \frac{ε}{2}$. But since $\mathbb{R\setminus Q}$ is dense there must be an irrational number $q$ between $s$ and $f_(x_0)$. But this is absurd because no there and at the same time there is not a number $y$ with $f(y)=q.$

EDIT:The proof is done but to make the idea more implicit, lets asume that our function is increasing and the selected sequence converges from the left (it really makes no difference because since we took $x_n$ is monotone it will converege exclusivelly from one direction or another). Because $x_n$ goes as closely as we want to $x_0$ we can guarrante that there will be no $x<x_0$ with $|f(x_0)-f(x)|<s$ (the $s$ is the one used in the proof). This is because wecan find $N$ such that approaching closer $x<a_N<x_0$ which contradicts monotonicity.

The exact same idea is used to prove that a monotone functions has only countable discontinuities.