WILSON’S THEOREM & THE CHINESE REMAINDER THEOREM
Wilson’s theorem – 1
Lemma
Let𝑝be a prime number. Then
∀𝑎 ∈ ℤ, 𝑎2≡ 1 (mod𝑝) ⟹ (𝑎 ≡ −1 (mod𝑝)or𝑎 ≡ 1 (mod𝑝)) Proof.
Let𝑝be a prime number and𝑎 ∈ ℤsatisfying𝑎2≡ 1 (mod𝑝).
Then𝑝|𝑎2− 1 = (𝑎 − 1)(𝑎 + 1).
By Euclid’s lemma, either𝑝|𝑎 − 1or𝑝|𝑎 + 1, i.e. 𝑎 ≡ 1 (mod𝑝)or𝑎 ≡ −1 (mod𝑝).
■
Jean-Baptiste Campesato MAT246H1-S – LEC0201/9201 – Feb 25, 2021 2 / 5
Wilson’s theorem
Let𝑛 ∈ ℕ ⧵ {0, 1}. Then𝑛is prime if and only if(𝑛 − 1)! ≡ −1 (mod𝑛).
Proof.Let𝑛 ∈ ℕ ⧵ {0, 1}.
• Assume that𝑛is a composite number.
Then there exists𝑘 ∈ ℕsuch that𝑘|𝑛and1 < 𝑘 < 𝑛.
Assume by contradiction that(𝑛 − 1)! ≡ −1 (mod𝑛)then𝑛|(𝑛 − 1)! + 1and hence𝑘|(𝑛 − 1)! + 1.
But𝑘|(𝑛 − 1)!, thus𝑘|((𝑛 − 1)! + 1 − (𝑛 − 1)!), i.e.𝑘|1. So𝑘 = 1which leads to a contradiction.
• Assume that𝑛is prime.
Let𝑎 ∈ {1, 2, … , 𝑛 − 1}thengcd(𝑎, 𝑛) = 1.
Hence𝑎admits a multiplicative inverse modulo𝑛:
∃𝑏 ∈ {1, 2, … , 𝑛 − 1}such that𝑎𝑏 ≡ 1 (mod𝑛).
Note that this𝑏is unique.
By the above lemma,𝑎 = 1and𝑎 = 𝑛 − 1are the only𝑎as above being their self-multiplicative inverse:
otherwise𝑏 ≠ 𝑎.
Thus(𝑛 − 1)! = 1 × 2 × ⋯ × (𝑛 − 1) ≡ 1 × (𝑛 − 1) (mod𝑛) ≡ −1 (mod𝑛).
Wilson’s theorem – 3
Wilson’s theorem
Let𝑛 ∈ ℕ ⧵ {0, 1}. Then𝑛is prime if and only if(𝑛 − 1)! ≡ −1 (mod𝑛).
Examples
• Take𝑝 = 17then(17 − 1)! + 1 = 20922789888001 = 17 × 1230752346353.
• Take𝑝 = 15then(15 − 1)! + 1 = 87178291201 = 15 × 5811886080 + 1.
Remark
Wilson’s theorem is a very inefficient way to check whether a number is prime or not.
Jean-Baptiste Campesato MAT246H1-S – LEC0201/9201 – Feb 25, 2021 4 / 5
The Chinese remainder theorem
Let𝑛1, 𝑛2∈ ℕ ⧵ {0, 1}be such thatgcd(𝑛1, 𝑛2) = 1and let𝑎1, 𝑎2∈ ℤ.
Then there exists𝑥 ∈ ℤsatisfying {
𝑥 ≡ 𝑎1(mod𝑛1) 𝑥 ≡ 𝑎2(mod𝑛2)
Besides, if𝑥1, 𝑥2∈ ℤare two solutions of the above system then𝑥1≡ 𝑥2(mod𝑛1𝑛2).
Proof.
• Existence. By Bézout’s identity, there exist𝑚1, 𝑚2∈ ℤsuch that𝑛1𝑚1+ 𝑛2𝑚2= 1.
Note that𝑛1𝑚1≡ 0 (mod𝑛1)and that𝑛1𝑚1≡ 𝑛1𝑚1+ 𝑛2𝑚2(mod𝑛2) ≡ 1 (mod𝑛2).
Similarly𝑛2𝑚2≡ 0 (mod𝑛2)and𝑛2𝑚2≡ 1 (mod𝑛1).
Thus, if we set𝑥 = 𝑎2𝑛1𝑚1+ 𝑎1𝑛2𝑚2then
• 𝑥 ≡ 𝑎2× 0 + 𝑎1× 1 (mod𝑛1) ≡ 𝑎1(mod𝑛1),
• 𝑥 ≡ 𝑎2× 1 + 𝑎1× 0 (mod𝑛2) ≡ 𝑎2(mod𝑛2).
• Uniqueness modulo𝑛1𝑛2.Let𝑥1, 𝑥2∈ ℤbe two solutions.
Then𝑥1− 𝑥2≡ 0 (mod𝑛1)so𝑥1− 𝑥2= 𝑘𝑛1for some𝑘 ∈ ℤ.
Similarly𝑛2|𝑥1− 𝑥2= 𝑘𝑛1.