Cycle structure of affine transformation Consider the ring $\mathbb{Z}_n$ of remainders modulo $n$ for some number $n.$ Let $a,b \in \mathbb{Z}_n$ and consider the map $$f_{a,b}(x) = ax+b.$$
If $a$ is invertible then the above map is bijective and it can therefore be viewed as a permutation.
My question is

Is it possible to determine the cycle structure of $f_{a,b}(x)$ as a permutation? If so, how?

 A: $\mathfrak S_n$, the symmetrical group of order $n$ acts faithfully on the set $\{0,1,\ldots, n-1\}$, so the maps in form $f_{a,b}$ represent a subset of $\mathfrak S_n$. Since $f_{c,d}\circ f_{a,b}=f_{ca,cb+d}$ (and $\mathfrak S_n$ is finite) this subset is a subgroup. The identity below shows that the order of the permutation represented by $f_{a,b}$ is a multiple of the order $a$ in the reduced restclasses modulo $n$. In the special case when $b=0$ the two order is the same. If $a=1$, the order of $f_{1,b}$ is the order of $b$ in the additive group of $\mathbb Z_n$. One can notice, that our subgroup contains in every case the subgroup generated by the cycle $(0,1,2,\ldots,n-1)$ because its generator corresponds to the map $f_{1,1}$. I guess, the other properties of our group are depending on the concrete value of n.
A: The case when $a = 1$ should be clear. So assume $a \ne 1$.
I can tell you what happens when $n$ is prime.
If $a \ne 1$, so that $a - 1$ is invertible, there is a $1$-cycle for the fixed point $x_{0}$ of $f_{a,b}$, the solution of $a x_{0} + b = x_{0}$, i.e. $x_{0} = -b (a - 1)^{-1}$.
Now in general we have $f_{a,b}^{n}(x) = a^{n} x + b (a^{n-1} + \dots + a + 1)$. Note that $a^{n} = 1$ iff $a^{n-1} + \dots + a + 1 = 0$.
Suppose $f_{a,b}^{n}(x) = x$ for some $n$. If $a^{n-1} + \dots + a + 1 \ne 0$, then we see that $x$ is a fixed point for $f_{a,b}$, see above. If $a^{n-1} + \dots + a + 1 = 0$, then $a^{n} = 1$, and it follows that all other cycles have length the multiplicative period of $a$. 
