MAT246H1-S – LEC0201/9201
Concepts in Abstract Mathematics
FERMAT’S LITTLE THEOREM
February 23rd, 2021
Jean-Baptiste Campesato MAT246H1-S – LEC0201/9201 – Feb 23, 2021 1 / 4
Binomial coefficients
Given0 ≤ 𝑘 ≤ 𝑛two natural numbers, we denote by(𝑛𝑘)(read as ”𝑛choose𝑘”) the number of ways to choose an (unordered) subset of𝑘elements from a fixed set of𝑛elements.
Remember that it satisfies(proved in class, see the video):
• (𝑛𝑘) = 𝑘!(𝑛−𝑘)!𝑛!
• For0 ≤ 𝑘 < 𝑛, we have(𝑘+1𝑛+1) = (𝑛𝑘) + (𝑘+1𝑛 ) (Pascal’s triangle)
• ∀𝑥, 𝑦 ∈ ℝ, ∀𝑛 ∈ ℕ, (𝑥 + 𝑦)𝑛=
𝑛
∑𝑘=0(𝑛
𝑘)𝑥𝑘𝑦𝑛−𝑘 (Binomial theorem)
Lemma
Let𝑝be a prime number. Then∀𝑘 ∈ {1, … , 𝑝 − 1}, (𝑝𝑘) ≡ 0 (mod𝑝). Proof.
Let𝑘 ∈ {1, … , 𝑝 − 1}. Then𝑘(𝑝𝑘) = 𝑝(𝑝−1𝑘−1). Hence,𝑝|𝑘(𝑝𝑘).
Sincegcd(𝑝, 𝑘) = 1, by Gauss’ lemma, we get that𝑝|(𝑘𝑝). ■
Binomial coefficients
Given0 ≤ 𝑘 ≤ 𝑛two natural numbers, we denote by(𝑛𝑘)(read as ”𝑛choose𝑘”) the number of ways to choose an (unordered) subset of𝑘elements from a fixed set of𝑛elements.
Remember that it satisfies(proved in class, see the video):
• (𝑛𝑘) = 𝑘!(𝑛−𝑘)!𝑛!
• For0 ≤ 𝑘 < 𝑛, we have(𝑘+1𝑛+1) = (𝑛𝑘) + (𝑘+1𝑛 ) (Pascal’s triangle)
• ∀𝑥, 𝑦 ∈ ℝ, ∀𝑛 ∈ ℕ, (𝑥 + 𝑦)𝑛=
𝑛
∑𝑘=0(𝑛
𝑘)𝑥𝑘𝑦𝑛−𝑘 (Binomial theorem)
Lemma
Let𝑝be a prime number. Then∀𝑘 ∈ {1, … , 𝑝 − 1}, (𝑝𝑘) ≡ 0 (mod𝑝).
Proof.
Let𝑘 ∈ {1, … , 𝑝 − 1}. Then𝑘(𝑝𝑘) = 𝑝(𝑝−1𝑘−1). Hence,𝑝|𝑘(𝑝𝑘).
Sincegcd(𝑝, 𝑘) = 1, by Gauss’ lemma, we get that𝑝|(𝑘𝑝). ■
Jean-Baptiste Campesato MAT246H1-S – LEC0201/9201 – Feb 23, 2021 2 / 4
Binomial coefficients
Given0 ≤ 𝑘 ≤ 𝑛two natural numbers, we denote by(𝑛𝑘)(read as ”𝑛choose𝑘”) the number of ways to choose an (unordered) subset of𝑘elements from a fixed set of𝑛elements.
Remember that it satisfies(proved in class, see the video):
• (𝑛𝑘) = 𝑘!(𝑛−𝑘)!𝑛!
• For0 ≤ 𝑘 < 𝑛, we have(𝑘+1𝑛+1) = (𝑛𝑘) + (𝑘+1𝑛 ) (Pascal’s triangle)
• ∀𝑥, 𝑦 ∈ ℝ, ∀𝑛 ∈ ℕ, (𝑥 + 𝑦)𝑛=
𝑛
∑𝑘=0(𝑛
𝑘)𝑥𝑘𝑦𝑛−𝑘 (Binomial theorem)
Lemma
Let𝑝be a prime number. Then∀𝑘 ∈ {1, … , 𝑝 − 1}, (𝑝𝑘) ≡ 0 (mod𝑝).
Proof.
Fermat’s little theorem, version 1
Fermat’s little theorem, version 1
Let𝑝be a prime number and𝑎 ∈ ℤ. Then𝑎𝑝 ≡ 𝑎 (mod𝑝).
Proof.We first prove the theorem for𝑎 ∈ ℕby induction. Base case at𝑎 = 0:0𝑝= 0 ≡ 0 (mod𝑝).
Induction step:assume that𝑎𝑝≡ 𝑎 (mod𝑝)for some𝑎 ∈ ℕ. Then (𝑎 + 1)𝑝=
𝑝
∑𝑛=0(𝑝
𝑛)𝑎𝑛 by the binomial formula
≡ 𝑎𝑝+ 1 (mod𝑝) since𝑝|(𝑝
𝑛)for1 ≤ 𝑛 ≤ 𝑝 − 1
≡ 𝑎 + 1 (mod𝑝) by the induction hypothesis Which ends the induction step.
We still need to prove the theorem for𝑎 < 0.
In this case−𝑎 ∈ ℕ, hence, from the first part of the proof,(−𝑎)𝑝≡ −𝑎 (mod𝑝). Multiplying both sides by(−1)𝑝we get that𝑎𝑝≡ (−1)𝑝+1𝑎 (mod𝑝).
If𝑝 = 2then either𝑎 ≡ 0 (mod2)or𝑎 ≡ 1 (mod2), and the statement holds for both cases.
Otherwise,𝑝is odd, and hence(−1)𝑝+1= 1. Thus𝑎𝑝≡ 𝑎 (mod𝑝). ■
Jean-Baptiste Campesato MAT246H1-S – LEC0201/9201 – Feb 23, 2021 3 / 4
Fermat’s little theorem, version 1
Fermat’s little theorem, version 1
Let𝑝be a prime number and𝑎 ∈ ℤ. Then𝑎𝑝 ≡ 𝑎 (mod𝑝).
Proof.We first prove the theorem for𝑎 ∈ ℕby induction.
Base case at𝑎 = 0:0𝑝= 0 ≡ 0 (mod𝑝).
Induction step:assume that𝑎𝑝≡ 𝑎 (mod𝑝)for some𝑎 ∈ ℕ. Then (𝑎 + 1)𝑝=
𝑝
∑𝑛=0(𝑝
𝑛)𝑎𝑛 by the binomial formula
≡ 𝑎𝑝+ 1 (mod𝑝) since𝑝|(𝑝
𝑛)for1 ≤ 𝑛 ≤ 𝑝 − 1
≡ 𝑎 + 1 (mod𝑝) by the induction hypothesis Which ends the induction step.
We still need to prove the theorem for𝑎 < 0.
In this case−𝑎 ∈ ℕ, hence, from the first part of the proof,(−𝑎)𝑝≡ −𝑎 (mod𝑝).
Fermat’s little theorem, version 2
Fermat’s little theorem, version 2
Let𝑝be a prime number and𝑎 ∈ ℤ. Ifgcd(𝑎, 𝑝) = 1then𝑎𝑝−1≡ 1 (mod𝑝).
Proof.
By the first version of Fermat’s little theorem,𝑎𝑝 ≡ 𝑎 (mod𝑝). Hence𝑝|𝑎𝑝− 𝑎 = 𝑎(𝑎𝑝−1− 1).
Sincegcd(𝑎, 𝑝) = 1, by Gauss’ lemma,𝑝|𝑎𝑝−1− 1.
Thus𝑎𝑝−1≡ 1 (mod𝑝). ■
Remark
Note that both versions of Fermat’s little theorem are equivalent.
Jean-Baptiste Campesato MAT246H1-S – LEC0201/9201 – Feb 23, 2021 4 / 4
Fermat’s little theorem, version 2
Fermat’s little theorem, version 2
Let𝑝be a prime number and𝑎 ∈ ℤ. Ifgcd(𝑎, 𝑝) = 1then𝑎𝑝−1≡ 1 (mod𝑝).
Proof.
By the first version of Fermat’s little theorem,𝑎𝑝 ≡ 𝑎 (mod𝑝).
Hence𝑝|𝑎𝑝− 𝑎 = 𝑎(𝑎𝑝−1− 1).
Sincegcd(𝑎, 𝑝) = 1, by Gauss’ lemma,𝑝|𝑎𝑝−1− 1.
Thus𝑎𝑝−1≡ 1 (mod𝑝). ■
Remark
Note that both versions of Fermat’s little theorem are equivalent.
Fermat’s little theorem, version 2
Fermat’s little theorem, version 2
Let𝑝be a prime number and𝑎 ∈ ℤ. Ifgcd(𝑎, 𝑝) = 1then𝑎𝑝−1≡ 1 (mod𝑝).
Proof.
By the first version of Fermat’s little theorem,𝑎𝑝 ≡ 𝑎 (mod𝑝).
Hence𝑝|𝑎𝑝− 𝑎 = 𝑎(𝑎𝑝−1− 1).
Sincegcd(𝑎, 𝑝) = 1, by Gauss’ lemma,𝑝|𝑎𝑝−1− 1.
Thus𝑎𝑝−1≡ 1 (mod𝑝). ■
Remark
Note that both versions of Fermat’s little theorem are equivalent.
Jean-Baptiste Campesato MAT246H1-S – LEC0201/9201 – Feb 23, 2021 4 / 4