Cyclic composition of functions While putting together some challenge problems for my College Algebra class, I ran across the following problem.

Problem: Let $y_1(x) = \dfrac{x + 1}{x - 1}$. Then recursively define the sequence of functions $\{y_i\}$ by $$y_{i+1} = (y_1 \circ
 y_{i})(x) \quad \text{for } i \ge 1.$$ Calculate $y_{500}(2)$.

After calculating, one quickly sees that $y_2(x) = (y_1 \circ y_1)(x) = x$, and we can then see that $y_{2k}(x) = x$ and $y_{2k-1}(x) = y_1(x)$ for all $k\in \mathbb{N}$. That is, the sequence of functions repeats on a 2-cycle.
I was able to make similar problems by taking $y_1 = \dfrac{ax + b}{cx + d}$ where $a,b,c,d$ satisfy $$\begin{pmatrix} a & b \\ c & d \end{pmatrix}^k = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \quad \text{for } k = 2, 3, 4,$$ and defining $y_{i+1}$ as before to give sequences that repeat on 2,3, and 4-cycles; however, I could not find a sequence which repeats on a 5-cycle or higher (without having a lower cycle contained within).
This lead me to two questions:

*

*Are there algebraic/geometric explanations for why I could not find linear fractional functions which do not repeat on a 5-cycle (or higher) other than that the equations for $a,b,c,d$ are inconsistent.

*Are there similar ways of constructing functions whose compositions are cyclic?


Update: While playing around, I was able to find an example of a 5-cycle:  $$y_1 = \dfrac{x - (5 + 2\sqrt{5})}{x+1}.$$

Another update: I've also found examples of 6, 8, 10, and 12-cycles of the form $y_1 = \dfrac{ax + b}{cx + d}$ where $a,b,c,d \in \mathbb{R}$.
 A: One method of generating a rational function with linear terms in the numerator and denominator that satisfies $f^n(x)=x$ for any $n$ is using angle addition formulas related to $\tan$.
We can see that if $f(x)$ satisfies $\tan^{-1}(f(x))=\tan^{-1}(x)+\frac{\pi}{n}$. From there, you can see that $\tan^{-1}(f^k(x))=\tan^{-1}(x)+\frac{\pi k}{n}$, so it follows that only when $n|k$, we have that $\tan^{-1}(f^k(x))=\tan^{-1}(x)+\frac{\pi k}{n}\implies f^k(x)=x$
Now to actually find a formula for $f(x)$, take the tangent of both sides to get
$$f(x)=\tan\left(\tan^{-1}(x)+\frac{\pi}{n}\right)$$
$$f(x)=\frac{x+\tan\left(\frac{\pi}{n}\right)}{1-\tan\left(\frac{\pi}{n}\right)x}$$
So, one example of a rational function with linear terms in the numerator and denominator satisfying $f^5(x)=x$ is
$$f(x)=\frac{x+\sqrt{5-2\sqrt{5}}}{1-x\sqrt{5-2\sqrt{5}}}$$
However, as you have already found, there are other functions that satisfy this relation and the function generated by this method is not always the nicest.
