Fermat`s Little Theorem Preliminaries: (1)

Fermat’s Little Theorem
Preliminaries:
(1) Factorial is defined by n! = 1 · 2 · · · · · n.
(2) There are exactly m congruence classes modulo m:
[0]m , [1]m , [2]m , . . . , [m − 1]m .
(3) Multiplication of congruence classes, applied to n congruence classes,
is given by
[a1 ]m × [a2 ]m × · · · × [an ]m = [a1 × a2 × · · · × an ]m .
(1)
Lemma 1 We have ab ≡ ac mod m and gcd (a, m) = 1 implies that b ≡ c
mod m.
Fermat’s Little Theorem is the following:
Theorem 24.1.1. If p is a prime number and a is a positive number
which is not a multiple of p, then ap−1 ≡ 1 mod p.
Proof. The clever idea of the proof is to consider the product of the
first p − 1 multiples of a:
a · 2a · · · · · (p − 1) a = (p − 1)! · ap−1 .
Also consider the set of congruence classes of these first p − 1 multiples of a:
n
o
S = [a]p , [2a]p , . . . , [(p − 1) a]p .
(2)
Proposition:
n
o
S = [1]p , [2]p , . . . , [p − 1]p .
(3)
In other words, the congruence classes [a]p , [2a]p , . . . , [(p − 1) a]p are the same
as the congruence classes [1]p , [2]p , . . . , [p − 1]p , except that they are written
in a different order.
Assuming the proposition, we have (by commutativity of multiplication)
[1]p × [2]p × · · · × [p − 1]p = [a]p × [2a]p × · · · × [(p − 1) a]p ,
1
which by the definition of multiplication of congruence classes, is the same
as (the middle equality below)
[(p − 1)!]p = [1 · 2 · · · · · (p − 1)]p = [a · 2a · · · · · (p − 1) a]p = (p − 1)! · ap−1 p .
(4)
In other words, rephrasing this equality of congruence classes as a congruence:
(p − 1)! ≡ (p − 1)! · ap−1 mod p.
Since the modulus p and the coefficient (p − 1)! are coprime, we conclude
that
1 ≡ ap−1 mod p.
(5)
Proof of the Proposition: We may write S as
n
o
S = [ka]p | 1 ≤ k ≤ p − 1 .
Claim 1: For each 1 ≤ k ≤ p − 1 we have [ka]p 6= [0]p .
Proof. If [ka]p = [0]p , then ka ≡ 0 mod p. This implies p divides ka,
which implies p divides k or p divides a. This is a contradiction.
Claim 2: If 1 ≤ k, ` ≤ p − 1 satisfy [ka]p = [`a]p , then k = `.
Proof. Suppose 1 ≤ k, ` ≤ p − 1 satisfy [ka]p = [`a]p . Then
ka ≡ `a mod p.
That is, p divides ka − `a = a (k − `) . Since p does not divide a, we conclude
that p divides k − `. This and 1 ≤ k, ` ≤ p − 1 imply that k = `.
Now Claim 1 implies that the congruence classes [a]p , [2a]p , . . . , [(p − 1) a]p
are all nonzero, i.e., 6= [0]p .
Furthermore, Claim 2 implies that the congruence classes [a]p , [2a]p , . . . , [(p − 1) a]p
are distinct, i.e., no two of them are equal. So we conclude from the Pigeonhole Principle that
n
o n
o
[a]p , [2a]p , . . . , [(p − 1) a]p = [1]p , [2]p , . . . , [p − 1]p .
2