Math 2.0

Number theory Proof

Proof of Fermat's little theorem by rearrangement

Builds on Prime numberCongruence modulo nDivisibilityEuclid's lemmaDivision algorithmCongruence is compatible with multiplication

Proof

  1. Let pp be a prime number and let aa be an integer with p∤ap \nmid a. Let R={1,2,…,p−1}R = \{ 1, 2, \dots, p - 1 \}.
  2. For i∈Ri \in R, we have 0<i<p0 < i < p, so pp does not divide ii. Since also p∤ap \nmid a, Euclid's lemma gives p∤iap \nmid i a.
  3. For i∈Ri \in R, let rir_i be the remainder of iai a on division by pp, given by the division algorithm. Then 0≤ri<p0 \le r_i < p and ri≡ia(modp)r_i \equiv i a \pmod p.
  4. If ri=0r_i = 0, then pp divides iai a, which contradicts step 2. So ri∈Rr_i \in R.
  5. Let i,j∈Ri, j \in R with ri=rjr_i = r_j. Then ia≡ja(modp)i a \equiv j a \pmod p, so pp divides (i−j)a(i - j) a.
  6. Since p∤ap \nmid a, Euclid's lemma gives p∣i−jp \mid i - j. Since ∣i−j∣<p\abs{i - j} < p, this forces i−j=0i - j = 0, so i=ji = j.
  7. By steps 4 and 6, the numbers r1,…,rp−1r_1, \dots, r_{p-1} are p−1p - 1 distinct elements of RR. Since RR has p−1p - 1 elements, they are all the elements of RR in some order.
  8. Hence r1r2⋯rp−1=1⋅2⋯(p−1)=(p−1)!r_1 r_2 \cdots r_{p-1} = 1 \cdot 2 \cdots (p - 1) = (p - 1)!.
  9. By step 3 and compatibility with multiplication, ∏i=1p−1(ia)≡∏i=1p−1ri(modp)\prod_{i=1}^{p-1} (i a) \equiv \prod_{i=1}^{p-1} r_i \pmod p.
  10. The left side of step 9 is ap−1(p−1)!a^{p-1} (p - 1)!. With step 8, we get ap−1(p−1)!≡(p−1)!(modp)a^{p-1} (p - 1)! \equiv (p - 1)! \pmod p.
  11. So pp divides (ap−1−1)(p−1)!(a^{p-1} - 1) (p - 1)!.
  12. The prime pp does not divide (p−1)!(p - 1)!. Otherwise, Euclid's lemma applied to the factors 1,…,p−11, \dots, p - 1 in turn would give p∣ip \mid i for some i∈Ri \in R, against step 2.
  13. By steps 11 and 12 and Euclid's lemma, pp divides ap−1−1a^{p-1} - 1. Hence ap−1≡1(modp)a^{p-1} \equiv 1 \pmod p.

Idea

Multiplying the nonzero residues 1,…,p−11, \dots, p - 1 by aa only shuffles them. So the product of all of them is unchanged, except for the factor ap−1a^{p-1} that comes out. Cancelling the product (p−1)!(p - 1)!, which pp does not divide, leaves ap−1≡1a^{p-1} \equiv 1.

Reading path

To understand this page from the ground up, read these 31 pages in order. The foundations come first. The path takes the proofs Proof of Bézout's identity, Proof of the generalized Euclid's lemma, Proof of the commutativity of addition by induction, Proof of Euclid's lemma, Proof of strong induction from ordinary induction, Proof that congruence is compatible with multiplication, Proof of the well-ordering principle from strong induction, Proof of the division algorithm.

Show the path as a graph
Definition by recursion, concept, no evidence levelDefinition by recursi…conceptDivisibility, definition, no evidence levelDivisibilitydefinitionMathematical induction, concept, no evidence levelMathematical inductionconceptNatural numbers, object, no evidence levelNatural numbersobjectPeano axioms, concept, no evidence levelPeano axiomsconceptCongruence modulo n, definition, no evidence levelCongruence modulo ndefinitionGreatest common divisor, definition, no evidence levelGreatest common divis…definitionPrime number, definition, no evidence levelPrime numberdefinitionSuccessor function, definition, no evidence levelSuccessor functiondefinitionProof that congruence is compatible with multiplication, proof, no evidence levelProof that congruence…proofCoprime integers, definition, no evidence levelCoprime integersdefinitionAddition of natural numbers, definition, no evidence levelAddition of natural n…definitionThe successor function is injective, statement, no evidence levelThe successor functio…statementZero is not a successor, statement, no evidence levelZero is not a success…statementCongruence is compatible with multiplication, statement, no evidence levelCongruence is compati…statementProof of the commutativity of addition by induction, proof, no evidence levelProof of the commutat…proofOrder on the natural numbers, definition, no evidence levelOrder on the natural …definitionCommutativity of addition, statement, no evidence levelCommutativity of addi…statementProof of strong induction from ordinary induction, proof, no evidence levelProof of strong induc…proofStrong induction, statement, no evidence levelStrong inductionstatementProof of the well-ordering principle from strong induction, proof, no evidence levelProof of the well-ord…proofWell-ordering principle, statement, no evidence levelWell-ordering princip…statementProof of the division algorithm, proof, no evidence levelProof of the division…proofDivision algorithm, statement, no evidence levelDivision algorithmstatementProof of Bézout's identity, proof, no evidence levelProof of Bézout's ide…proofBézout's identity, statement, no evidence levelBézout's identitystatementProof of the generalized Euclid's lemma, proof, no evidence levelProof of the generali…proofGeneralized Euclid's lemma, statement, no evidence levelGeneralized Euclid's …statementProof of Euclid's lemma, proof, no evidence levelProof of Euclid's lem…proofEuclid's lemma, statement, no evidence levelEuclid's lemmastatementProof of Fermat's little theorem by rearrangement, proof, no evidence levelProof of Fermat's lit…proof
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Definition by recursion concept
  2. Divisibility definition
  3. Mathematical induction concept
  4. Natural numbers object
  5. Peano axioms concept
  6. Congruence modulo n definition
  7. Greatest common divisor definition
  8. Prime number definition
  9. Successor function definition
  10. Proof that congruence is compatible with multiplication proof
  11. Coprime integers definition
  12. Addition of natural numbers definition
  13. The successor function is injective statement
  14. Zero is not a successor statement
  15. Congruence is compatible with multiplication statement
  16. Proof of the commutativity of addition by induction proof
  17. Order on the natural numbers definition
  18. Commutativity of addition statement
  19. Proof of strong induction from ordinary induction proof
  20. Strong induction statement
  21. Proof of the well-ordering principle from strong induction proof
  22. Well-ordering principle statement
  23. Proof of the division algorithm proof
  24. Division algorithm statement
  25. Proof of Bézout's identity proof
  26. Bézout's identity statement
  27. Proof of the generalized Euclid's lemma proof
  28. Generalized Euclid's lemma statement
  29. Proof of Euclid's lemma proof
  30. Euclid's lemma statement
  31. Proof of Fermat's little theorem by rearrangement proof

Where this leads

52 pages build on this one.

Further reading

  1. Web https://en.wikipedia.org/wiki/Proofs_of_Fermat%27s_little_theorem, Proof as a particular case of Euler's theorem
About this page
Tag4W0R66PGGM
URIm2://4W0R66PGGM
Kindproof
WritingW0 stub
MSC11A07
ProvesFermat's little theorem
UsesPrime number, Congruence modulo n, Divisibility, Euclid's lemma, Division algorithm, Congruence is compatible with multiplication
MethodsDirect proof
Changed4 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.