Fermat's little theorem
Statement
If is prime and , then . Equivalently, for every integer .
Why is it true?
The nonzero residues modulo a prime form a closed system under multiplication: multiplying every one of them by a fixed just shuffles them among themselves. Repeating this shuffle times must therefore return every element to its own position, which is exactly the statement .
Proof sketch
Consider the set of nonzero residues modulo , and the map sending each element of to a residue.
This map is injective on : if for , then since , the cancellation law (proved in the previous topic) gives , hence because both lie in . Also no can be for , since is prime and divides neither nor . So the map actually lands back inside .
An injective map from the finite set to itself is automatically a bijection. Therefore is simply written in a different order.
Multiply all elements of both sets together. On one side we get ; on the other, since it's the same numbers reordered, we get exactly . So .
Since is prime, none of is divisible by , so . Applying the cancellation law once more to remove the common factor from both sides gives .
(Group-theoretic restatement: the nonzero residues form a group of order under multiplication since is prime, and Lagrange's theorem says the order of any element — here, the smallest with — must divide the group's order ; hence automatically.)
Topics that use this theorem
Step-by-step proofs
No step-by-step proof yet for this theorem.
References
- Ronald L. Rivest, Adi Shamir, Leonard M. Adleman (1978). A Method for Obtaining Digital Signatures and Public-Key Cryptosystems · DOI:10.1145/359340.359342
- W. R. Alford, Andrew Granville, Carl Pomerance (1994). There are Infinitely Many Carmichael Numbers · DOI:10.2307/2118576