Let $a$ be an element of $\mathbb{F}\_p$, which is not a quadratic residue.


Define $$f(x) = \frac{x + a}{x+1},$$ which is a rational function on $\mathbb{F}\_p$. In fact, if we set $f(-1)=\infty$ and $f(\infty)=1$, then $f:\mathbb{F}\_p\cup\{\infty\}\rightarrow \mathbb{F}\_p\cup\{\infty\}$ is a bijection.


What is the order of $f$ under the operation of composition?


I expect that $f$ has order $p+1$, but I don't know how to prove it.


**Edit:**
As pointed out rightfully below, the sign of $a$ was wrong at first!



Order of a rational function on $\mathbb{F}_p$
As @DavidESpeyer [suggests](https://mathoverflow.net/questions/417698/order-of-a-rational-function-on-mathbbf-p#comment1072032_417698), I think you meant ${}+ a$ in place of ${}- a$. As @KevinCasto [says](https://mathoverflow.net/questions/417698/order-of-a-rational-function-on-mathbbf-p#comment1072031_417698), you are then looking for the order of $\begin{bmatrix} 1 & a \\ 1 & 1 \end{bmatrix}$ as an element of $\operatorname{PGL}\_2(\mathbb F\_p)$, i.e. (since its eigenvalues are $1 \pm \sqrt a$), the order of $1 \pm \sqrt a$ as an element of $\mathbb F\_{p^2}^\times/\mathbb F\_p^\times$. Certainly this order divides $p + 1 = \lvert\mathbb F\_{p^2}^\times/\mathbb F\_p^\times\rvert$; but, as @DavidESpeyer also [suggests](https://mathoverflow.net/questions/417698/order-of-a-rational-function-on-mathbbf-p#comment1072032_417698), it need not equal $p + 1$. Indeed, if $p = 5$ and $a = 2$, then the element has order $3$, since $\begin{pmatrix} 1 & 2 \\ 1 & 1 \end{pmatrix}^3 = \begin{pmatrix} 2 & 0 \\ 0 & 2 \end{pmatrix}$. (If you really did mean ${}- a$ instead of ${}+ a$, then the same example works; just pretend I took $a = 3$ instead of $a = 2$.)


EDIT: There was some discussion about what would happen if you had ${}- a$ in place of ${}+ a$. If $-a$ as well as $a$ is not a quadratic residue (i.e., if $-1$ *is* a quadratic residue), then the reasoning above shows that the order divides (but need not equal) $p + 1$. If $-a$ *is* a quadratic residue, then you are now looking for the order of $(1 + \sqrt{-a}, 1 - \sqrt{-a})$ as an element of the quotient of $\mathbb F\_p^\times \times \mathbb F\_p^\times$ by the diagonal copy of $\mathbb F\_p^\times$. The order thus now divides $p - 1$. Taking $p = 7$ and $a = 3$, and observing that $\begin{pmatrix} 1 & -3 \\ 1 & 1 \end{pmatrix}^3 = \begin{pmatrix} -1 & 0 \\ 0 & -1 \end{pmatrix}$, shows that the order may be a proper divisor of $p - 1$.


