If $ f: \mathbb{R} \to \mathbb{R} $ is continuous, and $\forall x \in \mathbb{R} :\;(f \circ f \circ f)(x) = x $, show that $ f(x) = x $.
The condition that $f$ is continuous on $\mathbb{R}$ is crucial for the proof. I can find functions such as $\displaystyle\frac{x-3}{x+1}$ that satisfies $ (f \circ f \circ f)(x) = x $.
I have tried to negate the conclusion to see if there's a contradiction, but got stuck.
Pick any $x$ and look at the three numbers $x,f(x),f(f(x))$. If any two of them are equal, then they are all equal by applying $f$ and using $ f \circ f \circ f = id$, and so $x = f(x) = f(f(x))$.
So suppose they are distinct. Without loss of generality, you can assume $x$ to be between $f(x)$ and $f(f(x))$ (if it's not, pick $f(x)$ or $f(f(x))$ in place of $x$). Then, by the intermediate value theorem, there exist a number $y$ between $x$ and $f(x)$ such that $f(y) = x$. Then, $y = f(f(f(y))) = f(f(x))$, which is impossible because $f(f(x))$ cannot be between $x$ and $f(x)$ ($x$ is between the other two)