Let $f$ be a continuous function from $\mathbb{R}$ to $\mathbb{R}$ such that $f(f(x))=x$. I have to prove or disprove whether $f$ is identity or not.
Given conditions imply that $f$ is both injective and bijective. We know that a injective continuous function is monotone.
Assume on the contrary that $f$ is not identity then there exist a point $y$ such that $f(x)=y$ and $x \neq y$
Since $x$ is not equal to $y$, by order properties of reals there are two choices left. Either $x>y$ or $x<y$.
WLOG: Let us say $x>y$.
Suppose $f$ is monotonically increasing then $f(x)>f(y)$ which implies $y>x$ a contradiction. Suppose $f$ is monotonically decreasing then $f(x)<f(y)$ which implies $y<x$.
As I am not able to arrive at the contradiction, This lead me to believe that there are function which are continuous and satisfy the above condition but are not identity.
Am I right? Please give some examples.
Edits:
What additional condition can be put to ensure that $f$ is identity?