What are the $n$th roots of the identity function? What are all the functions $f:\mathbb{R}\rightarrow \mathbb{R}$ such that $f^n=I$ where $f^n$ denotes the composition $f\circ f\circ f\dots \circ f$ of $f$ with itself $n$ times, and $I:\mathbb{R}\rightarrow \mathbb{R}$ is the identity function?
Is there a neat description of such functions? (There seems to be infinitely many of them, for each $n>1$.)
It is easy to see that such a $f$ has to be bijective.
Is there a better answer if $f$ is assumed to be continuous?
 A: If you suppose that $f$ has to be continuous, then since it is bijective, it is monotonous.
If $f$ is increasing then $f = id$ : suppose not, then there is an $x$ such that $f(x) \neq x$. Suppose $f(x) > x$. Then $x = f^{\circ n}(x) > \ldots > f(f(x)) > f(x) > x$, which is a contradiction. The case when $f(x) < x$ works the same way.
If $n$ is odd then $f$ can't be decreasing so $f$ is increasing and $f = id$.
If $n$ is even then $f$ can be decreasing. Then $f^2$ is an $n/2$-th root of the identity and increasing, so $f^2 = id$.
So we are left to determine the continuous decreasing solutions to $f^2 = id$. Such a $f$ has a unique fixpoint $x_0$. You can define $f$ on $[x_0 ; \infty)$ in any way you want (as long as it's a bijection on $(-\infty ; x_0]$), then you have to extend $f$ on $(-\infty ; x_0]$ in a unique way with $f(x) = f^{-1}(x)$.

If you don't require $f$ to be continuous then such a $f$ can be obtained by partitioning $\Bbb R$ into finite sets $S_k = \{x_1^k,\ldots,x_{d_k}^k\}$ of cardinality $d_k$ with $d_k \mid n$, and then setting $f(x_i^k) = x_{i+1}^k$ and $f(x_{d_k}^k) = x_1^k$. There are many many possible functions then.
