Classifying Solutions to $f^n(x) = x$ Let $f: \mathbb{R} \to \mathbb{R}$ be continuous everywhere in $\mathbb{R}$ except on some finite set.
Suppose we also have $f^n(x) = x$ for all $x$ where $f$ is defined. Note that by $f^n(x)$ I mean the $n$th composition of $f$ with itself.
Given a fixed $n$, how do you classify all solutions to this?
For $n=1,2$ this is easy enough.
But when $n=3$ we have for example, $f(x) = \frac{1}{1-x}$. It's not obvious how to find all the solutions to $f^3(x) = x$.
 A: Here is the $n=2$ case, where already it's not so simple.  
Consider the maximal open intervals on which $f$ is continuous and $f(x) \ne x$. Of these intervals, let $A_k$ be the ones on which $f(x) > x$ and $B_k$ the ones on which $f(x) < x$.
Note that if $f(x) > x$, $f(f(x)) = x < f(x)$.  Thus $f$ must map each interval $A_j$ into an interval $B_k$, and then $B_k$ into $A_j$.  Moreover, it's easy to see these maps must be 1-1 and onto. 
On the other hand, consider any partition of $\mathbb R$ into finitely many intervals.  The set of endpoints of these intervals may be mapped to itself by any permutation whose square is the identity (thus a product of disjoint transpositions).
Let some of the open intervals be paired with others; on the unpaired intervals we just take $f(x)=x$.  If interval $A$ is paired with interval $B$, let the restriction of $f$ to $A$ be any homeomorphism of $A$ to $B$, and the restriction to $B$ be the inverse of that homeomorphism.  The result is a function $f$ such that $f^2(x)=x$, continuous except on the set of endpoints. 
A: Let $S \subset \mathbb{R}$ be a finite set and $f : \mathbb{R} \setminus S \to \mathbb{R} \setminus S$ be a continuous function which satisfies $f^n = id$ for some integer $n \ge 2$. Then $f$ admits a continuous inverse $f^{-1} = f^{n-1}$ i.e. it is a homeomorphism. We aim to show that $f$ can be 'decomposed into blocks' and that each 'block' is homeomorphically conjugated to some 'standard block'.
Decomposition into irreducible blocks. Let $C_f = \pi_0(\mathbb{R}\setminus S)$ denote the (finite) set of connected components of $\mathbb{R}\setminus S$. Then $f$ induces an action of the cyclic group $C_n$ on $C_f$. If $O \subset C_f$ is an orbit of this action, then denoting by $I_O$ the reunion of the intervals that are elements of $O$, we get that $f_O := \left. f \right|_{I_O} : I_O \to I_O$ is a homeomorphism which satisfies $(f_O)^k = id$ for some divisor $k$ of $n$. (Observe that $k$ is equal to the number of elements in $O$.) Hence $f$ can be described as the 'reunion' of its many 'blocks' $f_O$. It is therefore sufficient to study those functions $f_O$ (which acts transitively on their set of connected components).
Conjugation of irreducible blocks to standard maps. To simplify notations, write simply $f = f_O$, $I = I_O = \mathrm{dom}(f) = \mathrm{codom}(f)$ and also $k=n$. Now consider the set $I_n := \sqcup_{i=1}^n (i-1, i)$ and observe that there is a homeomorphism $h : I_n \to I$. The map $f_h := h^{-1} \circ f \circ h : I_n \to I_n$ satisfies $f_h^n = id$ and acts transitively on its set of connected components. In fact, we can choose $h$ so that $f_h$ sends the interval $(i-1,i)$ to $(i, i+1)$ (where $i$ is taken modulo $n$).
Description of the standard maps. The possible maps $f_h : I_n \to I_n$ are easily described. For $i=1, \dots, n-1$, each map $f_{h,i} := \left. f_h \right|_{(i-1,i)} : (i-1, i) \to (i, i+1)$ can be any homeomorphism chosen independently from one another. The only remaining restriction $f_{h,n} := \left. f_h \right|_{(n-1,n)} : (n-1, n) \to (0, 1)$ is chosen as $f_{h,1}^{-1} \circ \dots \circ f_{h,n-1}^{-1}$. Any such map satisfies $f_h^n = id$.
