Nonzero residue permutation

ID: nonzero-residue-permutation

For a prime number and , multiplication by gives a permutation of the nonzero residue classes. For modulo seven, the representatives map to : the same collection in a different order. Repeating this permutation from one visits all six representatives before returning.
Figure 1.
Multiplication by three modulo seven permutes all six nonzero residue classes
. The upper arrows show each input and its image. The lower arrows repeatedly apply the same permutation to one, displaying the powers modulo seven. The highlighted final one is the first positive return, at exponent six. Details.
For modulo seven, the permutation cycles are instead and . The powers of two visit only the permutation cycle containing one, so their multiplicative order is three. Both permutation cycles return after three steps; applying the permutation six times still fixes every nonzero residue class. Fermat's little theorem guarantees a return at six, not that every base visits every nonzero residue class.
Figure 2.
Multiplication by two modulo seven gives two permutation cycles of length three
. Every arrow multiplies by two modulo seven. The left permutation cycle contains one and hence the powers of two. The right permutation cycle contains the other three nonzero residue classes. Their common length three divides . Details.
More generally, every permutation cycle of this map has length equal to the multiplicative order of : starting at a nonzero residue class , a return means , and its modular multiplicative inverse allows cancellation of . Thus the nonzero residue classes split into equal-length permutation cycles, which also explains the divisibility of the multiplicative order into .
The product argument gives a short proof outline. Since multiplication by is a permutation of the nonzero residue classes,
Every factor is a unit, so their product has a modular multiplicative inverse and can be cancelled. This leaves . The whole argument works for , where the product is just one.[ref]

New to topics? Read the docs here!