TITLE: $f(f(f(x)))=x,$ but $f(x)\neq x$
QUESTION [5 upvotes]: Let $f: \mathbb{R}\to \mathbb{R}$ be strictly increasing function such that  $f(f(f(x)))=x$ then by this $f(x)=x.$ Does the result fail if we drop the hypothesis that f is strictly increasing? 
I find such an example if I change the domain and codomain to $\mathbb{R}^2$ and $f=rotation \ by\  120^o,$ but could not think of a map from $\mathbb{R}\to \mathbb{R}.$ 
Any help is appreciated.

REPLY [2 votes]: If you allow yourself to consider the projective line (i.e., the reals with a point at infinity), then the function 
$$
f(x) = \frac{1}{1-x}
$$
is a nice continuous solution to the problem (although you have to make sense of "continuous" for this extended line). Pierre Samuel's book on Projective Geometry has a nice exposition of this around page 58. 
(By the way, this answer was inspired by @DonaldSplutterwit's deleted answer, although I might have stumbled on it myself, since I've been thinking about projective geometry and looking at Samuel's book today anyhow. Thanks, Donald!)