MAT246H1-S – LEC0201/9201
Concepts in Abstract Mathematics
MODULAR ARITHMETIC
February 11th, 2021
• This new layer of abstraction allowed to simplify previous proofs and to prove new theorems.
• Informally, we windℤon itself as below:
−13−12−11−10 −9 −8 −7 −6 −5 −4 −3 −2 −1 0 1 2 3 4 5 6 7 8 9 10 11 12 13
ℤ
… , −12, −6, 0, 6, 12, …
… , −11, −5, 1, 7, 13, …
… , −10, −4, 2, 8, 14, …
… , −9, −3, 3, 9, 15, …
… , −8, −2, 4, 10, 16, … … , −7, −1, 5, 11, 17, …
ℤmodulo6
Congruences – 1
Definition: equivalence relation
We say that a binary relationℛon a set𝐸is anequivalence relationif
1 ∀𝑥 ∈ 𝐸, 𝑥ℛ𝑥 (reflexivity)
2 ∀𝑥, 𝑦 ∈ 𝐸, 𝑥ℛ𝑦 ⟹ 𝑦ℛ𝑥 (symmetry)
3 ∀𝑥, 𝑦, 𝑧 ∈ 𝐸, (𝑥ℛ𝑦and𝑦ℛ𝑧) ⟹ 𝑥ℛ𝑧 (transitivity)
We say that𝑎and𝑏arecongruent modulo𝑛, denoted by𝑎 ≡ 𝑏 (mod𝑛), if𝑛|𝑎 − 𝑏.
Proposition
Congruence modulo𝑛is an equivalence relation onℤ.
Proof.
• Reflexivity. Let𝑎 ∈ ℤthen𝑛|0 = 𝑎 − 𝑎. Hence𝑎 ≡ 𝑎 (mod𝑛).
• Symmetry. Let𝑎, 𝑏 ∈ ℤbe such that𝑎 ≡ 𝑏 (mod𝑛).
Then𝑛|𝑏 − 𝑎 = −(𝑎 − 𝑏)hence𝑏 ≡ 𝑎 (mod𝑛).
• Transitivity.Let𝑎, 𝑏, 𝑐 ∈ ℤbe such that𝑎 ≡ 𝑏 (mod𝑛)and𝑏 ≡ 𝑐 (mod𝑛).
Then𝑛|𝑎 − 𝑏and𝑛|𝑏 − 𝑐. Hence𝑛|𝑎 − 𝑐 = (𝑎 − 𝑏) + (𝑏 − 𝑐).
Thus𝑎 ≡ 𝑐 (mod𝑛). ■
Congruences – 3
Proposition
Let𝑛 ∈ ℕ ⧵ {0}and𝑎, 𝑏 ∈ ℤ.
Then𝑎 ≡ 𝑏 (mod𝑛)if and only if𝑎and𝑏have same remainder for the Euclidean division by𝑛.
Proof.
⇒. Assume that𝑎 ≡ 𝑏 (mod𝑛), then𝑏 − 𝑎 = 𝑘𝑛for some𝑘 ∈ ℤ.
By Euclidean division,𝑎 = 𝑛𝑞 + 𝑟for𝑞, 𝑟 ∈ ℤsatisfying0 ≤ 𝑟 < 𝑛.
Hence𝑏 = 𝑎 + 𝑘𝑛 = 𝑛𝑞 + 𝑟 + 𝑘𝑛 = (𝑞 + 𝑘)𝑛 + 𝑟.
⇐. Assume that𝑎and𝑏have same remainder for the Euclidean division by𝑛.
Then𝑎 = 𝑛𝑞1+ 𝑟and𝑏 = 𝑛𝑞2+ 𝑟where𝑞1, 𝑞2, 𝑟 ∈ ℤwith0 ≤ 𝑟 < 𝑛.
Hence𝑎 − 𝑏 = 𝑛𝑞1+ 𝑟 − (𝑛𝑞2+ 𝑟) = 𝑛(𝑞1− 𝑞2).
Thus𝑛|𝑎 − 𝑏, i.e. 𝑎 ≡ 𝑏 (mod𝑛). ■
Corollary
Let𝑛 ∈ ℕ ⧵ {0}and𝑎 ∈ ℤ. Then𝑎is congruent modulo𝑛to exactly one element of{0, 1, … , 𝑛 − 1}.
• 𝑎𝑐 ≡ 𝑏𝑑 (mod𝑛)
Proof.Let𝑎, 𝑏, 𝑐, 𝑑 ∈ ℤand𝑛 ∈ ℕ ⧵ {0}. Assume that𝑎 ≡ 𝑏 (mod𝑛)and that𝑐 ≡ 𝑑 (mod𝑛).
Hence𝑎 − 𝑏 = 𝑛𝑘and𝑐 − 𝑑 = 𝑛𝑙for some𝑘, 𝑙 ∈ ℤ. Then
• (𝑎 + 𝑐) − (𝑏 + 𝑑) = (𝑎 − 𝑏) + (𝑐 − 𝑑) = 𝑛𝑘 + 𝑛𝑙 = 𝑛(𝑘 + 𝑙), hence𝑎 + 𝑐 ≡ 𝑏 + 𝑑 (mod𝑛).
• 𝑎𝑐 − 𝑏𝑑 = (𝑏 + 𝑛𝑘)(𝑑 + 𝑛𝑙) − 𝑏𝑑 = 𝑏𝑛𝑙 + 𝑑𝑛𝑘 + 𝑛2𝑘𝑙 = 𝑛(𝑏𝑙 + 𝑑𝑘 + 𝑛𝑘𝑙), hence𝑎𝑐 ≡ 𝑏𝑑 (mod𝑛). ■
Corollary
Let𝑎, 𝑏 ∈ ℤand𝑛 ∈ ℕ ⧵ {0}. Then∀𝑘 ∈ ℕ, 𝑎 ≡ 𝑏 (mod𝑛) ⟹ 𝑎𝑘≡ 𝑏𝑘(mod𝑛).
Proof.We prove the statement by induction on𝑘.
Base case at𝑘 = 0:𝑎0= 𝑏0= 1hence𝑎0≡ 𝑏0(mod𝑛).
Induction step:assume that𝑎 ≡ 𝑏 (mod𝑛) ⟹ 𝑎𝑘≡ 𝑏𝑘(mod𝑛)for some𝑘 ∈ ℕ.
If𝑎 ≡ 𝑏 (mod𝑛)then by the IH we also have𝑎𝑘≡ 𝑏𝑘(mod𝑛). Hence𝑎𝑘𝑎 ≡ 𝑏𝑘𝑏 (mod𝑛). ■
Modular multiplicative inverse
Proposition
Let𝑎 ∈ ℤand𝑛 ∈ ℕ ⧵ {0}. Then𝑎has a multiplicative inverse modulo𝑛if and only ifgcd(𝑎, 𝑛) = 1.
Otherwise stated,
∃𝑏 ∈ ℤ, 𝑎𝑏 ≡ 1 (mod𝑛) ⇔gcd(𝑎, 𝑛) = 1
Proof.∃𝑏 ∈ ℤ, 𝑎𝑏 ≡ 1 (mod𝑛) ⇔ ∃𝑏, 𝑐 ∈ ℤ, 𝑎𝑏 + 𝑛𝑐 = 1 ⇔gcd(𝑎, 𝑛) = 1 ■
Remark
When it exists, the multiplicative inverse is unique modulo𝑛.
Indeed, assume that𝑎𝑏 ≡ 1 (mod𝑛)and𝑎𝑏′≡ 1 (mod𝑛)then𝑎𝑏 ≡ 𝑎𝑏′(mod𝑛)so𝑛|𝑎(𝑏 − 𝑏′).
Sincegcd(𝑎, 𝑛) = 1, by Gauss’ lemma we get𝑛|𝑏 − 𝑏′. Therefore𝑏′≡ 𝑏 (mod𝑛).
Note thatgcd(4, 25) = 1so4has a multiplicative inverse modulo25.
We may find one representative of the inverse from a Bézout’s identity: 4 × (−6) + 25 × 1 = 1.
So4 × (−6) ≡ 1 (mod25).
Proof.Note that10 ≡ 1 (mod3), hence 𝑎𝑟𝑎𝑟−1… 𝑎010=
𝑟
∑𝑘=0
𝑎𝑘10𝑘≡
𝑟
∑𝑘=0
𝑎𝑘1𝑘(mod3) ≡
𝑟
∑𝑘=0
𝑎𝑘(mod3)
Thus, 3|𝑎𝑟𝑎𝑟−1… 𝑎010⇔ 𝑎𝑟𝑎𝑟−1… 𝑎010≡ 0 (mod3) ⇔
𝑟
∑𝑘=0
𝑎𝑘≡ 0 (mod3) ⇔ 3|
𝑟
∑𝑘=0
𝑎𝑘
■
Examples
• 91524is divisible by3since9 + 1 + 5 + 2 + 4 = 21 = 7 × 3is.
• Let’s study whether8546921469is a multiple of3or not:
3|8546921469 ⇔ 3|8 + 5 + 4 + 6 + 9 + 2 + 1 + 4 + 6 + 9 = 54 ⇔ 3|5 + 4 = 9.
But9 = 3 × 3, hence3|8546921469.
Application: divisibility criterion for 9
Note that10 ≡ 1 (mod9), hence we have a similar result:
Proposition
9|𝑎𝑟𝑎𝑟−1… 𝑎010if and only if9|
𝑟
∑𝑘=0
𝑎𝑘
Proof.Note that10 = 4 × 25hence10 ≡ 0 (mod4)for𝑘 ≥ 2. Hence 4|𝑎𝑟𝑎𝑟−1… 𝑎010⇔ 𝑎𝑟𝑎𝑟−1… 𝑎010≡ 0 (mod4)
⇔
𝑟
∑𝑘=0
𝑎𝑘10𝑘≡ 0 (mod4)
⇔ 𝑎1× 10 + 𝑎0≡ 0 (mod4)
⇔ 𝑎1𝑎010≡ 0 (mod4)
⇔ 4|𝑎1𝑎010 ■
Example
• 4 ∤ 856987454251100125since4 ∤ 25.
• 4|98854558715580since4|80 = 4 × 20.