TITLE: How to prove that if $f:\mathbb{R} \rightarrow \mathbb{R}$ is continuous and $|f(x) - f(y)| > |x-y|$ for all $x,y$,then range of $f$ is $\mathbb{R}$
QUESTION [6 upvotes]: Question:
Let $f:\mathbb{R} \rightarrow \mathbb{R}$ be continuous and $|f(x) - f(y)| > |x-y|$ for all $x,y \in \mathbb{R}$ and $x \neq y$. Prove that the range of $f$ is $\mathbb{R}$

Answer:
I have a hard time writing this.
For any [$x_0, x_1$], it must be that the function within this interval is strictly increasing or decreasing. Otherwise, there is a max (or min) value $f(x_2)$ such that $x_2 \in (x_0,x_1)$. Applying the Intermediate Value Theorem on $[x_0,x_2]$ and $[x_2,x_1]$, then there exists a point $a \in [x_0,x_2]$ and $b \in [x_2,x_1]$ such that $f(a)=f(b)$, contradicting $|f(x) - f(y)| > |x-y|$ for all $x,y \in \mathbb{R}$.
Furthermore, for arbitrary $y_0, y_1, y_2$, if $|f(y_2)-f(y_1)| > |y_2-y_1|$ and $|f(y_1)-f(y_0)| > |y_1-y_0|$ then we have $|f(y_2)-f(y_0)| > |y_2-y_0|$. Otherwise it means that the function on $[y_0,y_1]$ and $[y_1,y_2]$ were not both strictly increasing or strictly decreasing, which leads to the same contradiction, that there exist a $c \in [y_0,y_1]$,$d\in [y_1,y_2]$ on each interval respectively where $f(c)=f(d)$.
Would I be able to then conclude that the range is $\mathbb{R}$? Logically it seems like I can, but it also doesn't seem to be based on any "theorem". I'm essentially just saying "dot dot dot and so on". I don't know if I'm missing anything, or if the arguments are not sound.
Is there a more rigorous way to prove this?

REPLY [3 votes]: Assume that $|f(x) - f(y)| > |x - y|$ for any $x \neq y$. Note that this condition immediately imply the injectivity of $f$. Then we make the following series of observations:
$\textbf{1.} \ $ For any $x_1 < x_2 < x_3$, either $f(x_1) < f(x_2) < f(x_3)$ or $f(x_1) > f(x_2) > f(x_3)$ must hold. Indeed, assume otherwise. Then there exist $x_1 < x_2 < x_3$ such that either
$$ [f(x_1) < f(x_2) \text{ and } f(x_3) < f(x_2)] \qquad\text{or}\qquad [f(x_1) > f(x_2) \text{ and } f(x_3) > f(x_2)]. $$
Now either option contradicts the injectivity of $f$ via the intermediate value theorem, similarly as in OP's first step.
$\textbf{2.} \ $ By replacing $f(\cdot)$ by $f(-\cdot)$ if necessary, we may assume $f(1) > f(0)$. Then for each $x > 1$, we have $f(x) > f(1) > f(0) > f(-x)$, and so, we get
$$ f(-x) < f(0) - x \qquad \text{and} \qquad f(0) + x < f(x). $$
$\textbf{3.} \ $ Still assuming $f(1) > f(0)$ without losing the generality, we now prove $f(\mathbb{R}) = \mathbb{R}$. To show the equality of two sets, it suffices to verify that one is a subset of the other.

Let $y \in \mathbb{R}$ be arbitrary. The previous step allows to find $x > 1$ such that $f(-x) < y < f(x)$. Then by the intermediate value theorem, $y = f(c)$ for some $c \in (-x, x)$ and hence $y \in f(\mathbb{R})$. Since this holds for any $y \in \mathbb{R}$, we have $\mathbb{R}\subseteq f(\mathbb{R})$.
The other direction $f(\mathbb{R}) \subseteq \mathbb{R}$ is trivial, and so, the desired conclusion follows.