Proving that if $f(x)=x$ has no real solution then $f(f(x))=x$ has no real solution either

If $f:\mathbb{R} \to \mathbb{R}$ is a continuous function such that $f(x)=x$ has no real solution, then show that $f(f(x))=x$ has no real solution either.

Is the proof trivial as it seems or does it need an analytical approach?

• Do you want a hint or a full solution? My hint is look at $f(x)-x$. – Emre Jun 4 '16 at 11:16
• @Emre I need more than that, thanks. – StubbornAtom Jun 4 '16 at 11:17

As $f$ is continuous, $g(x)=f(x)-x$ is also continuous. We know that $g(x)=0$ has no root. Thus, either $g(x)>0$ for all $x\in\mathbb{R}$ or $g(x)<0$ for all $x\in\mathbb{R}$. In the first case, we have $f(x)>x$ for all $x\in\mathbb{R}$. So, $$f(f(x))>f(x)>x$$ In the second case, we have $f(x)<x$ for all $x\in\mathbb{R}$. So, $$f(f(x))<f(x)<x$$