TITLE: Find a smooth function $f:\mathbb{R}\to\mathbb{R}$ such that $|f'(x)| < 1$ and $f(x) \neq x$ for all $x\in\mathbb{R}$
QUESTION [8 upvotes]: Exercise: Find a smooth function $f:\mathbb{R}\to\mathbb{R}$ such that $|f'(x)| < 1$ and $f(x) \neq x$ for all $x\in\mathbb{R}$
I got this exercise from the book "Curso de Análise: volume 1", by Elon Lages Lima. (In Portuguese).
My attempts include
$1$) integrate $\frac{2\text{arctan}(x)}{\pi}$, but I get this. (Adding larger constants doesn't seem to help.)
$2$) $f(x) = \text{sin}(x/2) + x + 2$ but its derivative gets too large.
Any ideas?

REPLY [3 votes]: $$f(x)=x-\arctan(x)+\frac{\pi}{2}$$