Congruences
Modular Arithmetic
• base of the Congruence Modulo
• is a system of arithmetic for
integers, where numbers "wrap
around" when reaching a certain
value called the modulus (plural
moduli)
• developed by Johann Carl
Friedrich Gauss
https://www.youtube.com/results?search_query=modular+arithmetic+
The word ‘congruent’ means ‘in
agreement’. The term makes its first
appearance in modular arithmetic in Gauss’s
Disquisitiones Arithmeticae, which features in
the introduction to this unit, although it was
used much earlier than this by geometers.
Gauss chose the symbol ≡ because it is
similar, but not identical, to the more familiar
equals symbol =. Congruences share many
properties with, but are not identical to,
equations.
Congruence (Congruence Modulo) is a useful tool for
divisibility. Two integers a, b are said to be congruent
modulo n denoted by 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑛) and if their
difference (a - b) is integrally divisible by an integer n
where n > 0 denoted by 𝑛⃒(𝑎−𝑏). Also, we can write
the congruence as a = kn + b for some integer k.
https://www.youtube.com/watch?v=-SpWfD4WsmM
Properties of Congruence Modulo
Property 1. Congruence if reflexive, i.e., a ≡ a (mod m) for
every integer a and natural number m.
Property 2. Congruence is symmetric, i.e., if a ≡ b (mod m),
then b ≡ a (mod m).
Property 3. Congruence is transitive, i.e., if a ≡ b (mod m)
and b ≡ c (mod m), then a ≡ c (mod m).
Properties of Congruence Modulo
Property 4. Congruences may be added: if a ≡ b (mod m) and c ≡ d
(mod m), then a + b ≡ c + d (mod m).
Property 5. Congruences may be multiplied: if a ≡ b (mod m) and c
≡ d (mod m), then ab ≡ cd (mod m).
Property 6. Both sides of a congruence may be divided by a number
relatively prime to m: if ab ≡ ac (mod m) and (a, m) = 1, then b ≡ c
(mod m).
Checking Congruences
Which of the following congruence/s is/are true?
a. 11 ≡ 26 (𝑚𝑜𝑑 5)
b. 9 ≡ −9 (𝑚𝑜𝑑 5)
c. 28 ≡ 0 (𝑚𝑜𝑑 7)
Alternative Method for Checking Congruences
The following statements are equivalent:
• a and b are congruent modulo n
• a − b is divisible by n.
So to check whether two integers a and b are congruent
modulo n you can check the second of these statements
rather than the first.
27 ≡ 12 (𝑚𝑜𝑑 5)
Alternative Method for Checking Congruences
For example, according to this alternative method, 27
and 12 are congruent modulo 5 because 27 − 12 = 15,
which is divisible by 5. In contrast, 9 and −4 are not congruent
modulo 7 because 9 − (−4) = 13, which is not divisible
by 7.
Another way of stating that 𝑎 − 𝑏 is
Writing a divisible by n is to state that there is an
integer k (which may be negative) such that
Congruence as 𝑎 − 𝑏 = 𝑘𝑛; that is, 𝑎 = 𝑏 + 𝑘𝑛.
an Equation This useful observation allows you to
replace a congruence by an equation.
Writing a Congruence as an Equation
The congruence 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑛) is
equivalent to the statement that there is an
integer k such that
𝒂 = 𝒃 + 𝒏𝒌.
Writing a Congruence as an Equation
For example, the congruence 7 ≡ 22(𝑚𝑜𝑑 5) is
equivalent to the statement that there is an integer k
such that 7 = 22 + 5𝑘. There certainly is such an
integer 𝑘, namely 𝑘 = −3.
Write the given congruence as an equation
and solve the value of k.
1. 4 ≡ 10 (𝑚𝑜𝑑 3)
Answer: 4 = 10 + 3𝑘;
𝑘 = −2
2. −2 ≡ 13(𝑚𝑜𝑑 5)
Answer: −2 = 13 + 5𝑘;
𝑘 = −3
Residue Class
Given any integer a, the collection of all integers congruent to a
modulo n is known as the residue class, or congruence class, of a
modulo n.
Given an integer 𝑎 let 𝑞 and 𝑟 be its quotient and remainder upon
division by 𝑛, so that 𝑎 = 𝑞𝑛 + 𝑟, 0 ≤ 𝑟 ≤ 𝑛
Definition of congruence: a ≡ 𝑟(𝑚𝑜𝑑 𝑛)
In particular a ≡ 0 𝑚𝑜𝑑 𝑛 iff 𝑛|𝑎
Example
Residue class of 1 modulo 3
Because 1, 4 and −2 are all congruent modulo 3, you could also
describe the class of integers marked in the figure as the residue
class of 4 modulo 3, or as the residue class of −2 modulo 3.
2 = … , −8, −5, −2, 1, 4, 7, 10, 13
Plot the residue class of 1 modulo 4 on a number line
The remainder r is also known as the least
residue of a modulo n, because it is the smallest
number equal to or greater than 0 in the residue class
of a modulo n
Least residues
The least residue of a modulo n is the remainder r that
you obtain when you divide a by n.
The integer r is one of the numbers
0, 1, . . . , n − 1, and it satisfies
a ≡ r (mod n).
Example
Find the least residue 0f -33 modulo 7
Since −33 = 7 × (−5) + 2
the least residue is 2.
a ≡ r (mod n)
-33 ≡ 2 (mod 7)
Example
Find the least residue of 17 modulo 3
Since 17 = 3 × 5 + 2
the least residue is 2.
a ≡ r (mod n)
17 ≡ 2 (mod 3)
Example
Find the least residue of -2 modulo 3
Since - 2 = 3 x (-1) + 1
the least residue is 1.
a ≡ r (mod n)
-2 ≡ 1 (mod 3)
Example
Find the least residue of 50 modulo 10
Since 50 = 10 × 5 + 0
the least residue is 0.
a ≡ r (mod n)
50 ≡ 0 (mod 10)