Given $f:\mathbb R \to \mathbb R$, $f$ is continuous, $f(f(x))=x$. Find $f(x)$. 
Given

*

*$f:\mathbb R \to \mathbb R$


*$f$ is continuous


*$f(f(x))=x$
Find $f(x)$.

I only find $f(x)=x$ and $f(x)=a-x$. Are there other solutions? Thank you.
 A: There are infinitely more continuous solutions.
In fact, let $g$ be any continuous bijection from $\mathbb{R}$ back to itself, then
the map defined by:
$$\mathbb{R} \ni x \;\overset{f}{\longrightarrow}\; g^{-1}(-g(x)) \in \mathbb{R}$$
is continuous and for all $x$, satisfies:
$$f(f(x)) = g^{-1}(-g(g^{-1}(-g(x))) = g^{-1}(-(-g(x)) = g^{-1}(g(x)) = x$$
For example, if one take $g(x) = x - \frac{a}{2}$, you get
$$g^{-1}(-g(x)) = \left(-\left(x - \frac{a}{2}\right)\right) + \frac{a}{2} = a - x$$
If you take something more crazy like $g(x) = x^3 - a/2$, you get:
$$g^{-1}(-g(x)) = \left(-\left(x^3 - \frac{a}{2}\right) + \frac{a}{2}\right)^{\frac13} = (a - x^3)^{\frac13}$$
A very strange looking curve but still a continuous solution for the equation $f(f(x)) = x$.

Credit above graph comes from $\mathbb{R}^n$ which exhibit the $x \leftrightarrow y$ symmetry explicitly.
A: If I were allowed to impose more strict condition

ii. $f$ is differentiable

then $f(x) = x$ and $f(x) = a - x$ are the only solutions.
From condition 3, we get ODE (f'(x))^2 = 1 $f'\big(f(x)\big)f'(x) = 1$.
If $f' \equiv 1$ then $f(x) = a + x$. And $x = f(f(x)) = 2a + x$ shows $a = 0$. Otherwise If $f' \equiv -1$ then $f(x) = a - x$. And $x = f(f(x)) = x$ shows arbitrary constant $a$ is allowed.
Edit: As @ChristianBlatter points out to me, I made a big mistake. I correct the error but this answer becomes almost worthless.
