Theorem 1.

If is prime and , then .

Proof
Assume is prime and . is congruent to one of . Multiply all of these by : . We will show that this is a rearrangement of the congruence classes we started with. Clearly, none of can be congruent to . We will now show that all of the new congruence classes are distinct. Pick two values: , . If , . Thus, , which can only happen if :

Thus, is a rearrangement of . Thus,

since . ❏

Example 2.

ghci> a=[1..10]
[1,2,3,4,5,6,7,8,9,10]
ghci> map (\x-> mod x 11) (map (*2) a)
[2,4,6,8,10,1,3,5,7,9]
ghci> map (\x-> mod x 11) (map (*3) a)
[3,6,9,1,4,7,10,2,5,8]
ghci> map (\x-> mod x 11) (map (*4) a)
[4,8,1,5,9,2,6,10,3,7]
ghci> map (\x-> mod x 11) (map (*5) a)
[5,10,4,9,3,8,2,7,1,6]
ghci> map (\x-> mod x 11) (map (*6) a)
[6,1,7,2,8,3,9,4,10,5]
ghci> map (\x-> mod x 11) (map (*7) a)
[7,3,10,6,2,9,5,1,8,4]
ghci> map (\x-> mod x 11) (map (*8) a)
[8,5,2,10,7,4,1,9,6,3]
ghci> map (\x-> mod x 11) (map (*9) a)
[9,7,5,3,1,10,8,6,4,2]
ghci> map (\x-> mod x 11) (map (*10) a)
[10,9,8,7,6,5,4,3,2,1]

Can be packaged up in a matrix:

Example 1.1.9: It can be deduced from Fermat’s little theorem that every element in has an inverse: For any , one of must be . We can also see why this doesn’t work when is not prime. For example, if , the matrix is

Only elements which are co-prime with 10 have inverses. Those not co-prime with 10 fall into cycles, and can never reach since they always reach .