<s>[INST] How to find $f$ if $f(f(x))=\frac{x+1}{x+2}$ let $f:\mathbb R\to \mathbb R$,and such

$$f(f(x))=\dfrac{x+1}{x+2}$$

Find the $f(x)$
My try

I found $f(x)=\dfrac{1}{x+1}$
  because when $f(x)=\dfrac{1}{x+1}$,then
  $$f(f(x))=f\left(\dfrac{1}{x+1}\right)=\dfrac{1}{\dfrac{1}{x+1}+1}=\dfrac{x+1}{x+2}$$
  so $f(x)=\dfrac{1}{x+1}$ such this condition,But $f(x)$  Have other form? Thank you

 [/INST] You can easily check that if we define
$$f_{A} = \frac{ax+b}{cx+d} \quad  \text{for} \quad A = \begin{pmatrix}a &  b \\ c & d \end{pmatrix}, $$
then $f_{A} \circ f_{B} = f_{AB}$. Thus any matrix $A$ satisfying
$$ A^{2} = k \begin{pmatrix} 1 & 1 \\ 1 & 2 \end{pmatrix}, \quad \text{for some} \ k \neq 0 $$
gives rise to a solution. Mathematica yields two different solutions
$$ f(x) = \frac{1}{x+1} \quad \text{and} \quad f(x) = \frac{2x+1}{x+3}, $$
but I'm not sure if other solutions exist.
</s>