Fixed points of a certain type of functions with intermediate value property Let $f: \mathbb R\to \mathbb R$ be a function, having intermediate value property, such that $f(f(x))=x , \forall x \in \mathbb R$, then is it true that either the set of fixed points of $f$ is $\mathbb R$ or it contains
a unique element? 
Please help 
 A: Since $f\circ f=id$, we know that $f$ is a bijection.
Now assume that $f\ne id$, i.e., there exists a point $x_0$ such that $$f(x_0)=y_0\ne x_0.$$
We know that also $$f(y_0)=x_0.$$
W.l.o.g. we can assume that $x_0<y_0$.
From the intermediate value property we can get some information about values of $f$. 


*

*We know that all values from the interval $[x_0,y_0]$ must be attained in the interval $[x_0,y_0]$, and every such value is attained exactly once.

*If $x<x_0$, then $f(x)>y_0$. (Otherwise $f$ would attain all values between $f(x)$ and $y_0$ somewhere in the interval $(x,x_0)$, which would mean that some values from the interval $[x_0,y_0]$ are attained twice. This contradicts the assumption that $f$ is a bijection.) 

*The same argument shows that $f(x)<x_0$ for $x>y_0$.


(If the above arguments are unclear, it helps to draw a picture.) 
So now we know that the only possible fixed points are in the interval $[x_0,y_0]$. Let us assume that there are two fixed points $x_1<x_2$, i.e. we have
$$f(x_1)=x_1<x_2=f(x_2)$$
for some $x_{1,2}\in(x_0,y_0)$.
Since $f(x_1)=x_1<x_2<y_0=f(x_0)$, we get from the intermediate value property that there is $t\in(x_0,x_1)$ such that $f(t)=x_2$. (I.e., the value $x_2$ is attained somewhere between $x_0$ and $x_1$.) But this implies
$$f(x_2)=x_2=f(t),$$
which again contradicts the assumption that $f$ is a bijection.

The following question is similar, but it requires that $f$ is continuous (which is stronger condition than intermediate value property a.k.a. Darboux property): Continuous involutions on $\mathbb R$ with at least two fixed points. I think the argument from one of the answers can be also used here.
A: It is not true, if this counter example is valid:
$$
g : \mathbb{R} \to \mathbb{R} \\
g(x) := \left\{
\begin{matrix} 
\frac{1}{x} & (x \ne 0) \\
0 & (x = 0)
\end{matrix}
\right.
$$
it fullfills
$$
g^2 = \mbox{id} \quad (\mbox{on } \mathbb{R}) \quad (*)
$$
but
$$
g(x) = x \iff x \in S := \{-1, 0, 1 \}
$$
with 
$$
S \ne \mathbb{R} \wedge |S| \ne 1
$$
Note: I assumed that $(*)$ is the intermediate value property.
In case that property is this one:
$$
\forall a, b \in \mbox{dom } f:
\forall y \in (f(a), f(b)) :
\exists c \in (a, b):
f(c) = y \quad (**)
$$
one could pick $a = 0$, $b = 1$, then $(g(a), g(b)) = (0, 1)$ and $y = 1/2 \in (0,1)$ is not assumed by $g$ on $(0,1)$, because $g((0,1)) = (1, \infty)$, so $(**)$ would not hold.
