Module 1
Fundamentals of Number Theory
Topic
Modular Arithmetic & Congruence
Modular Arithmetic
Modulus
• If a is an integer and n is a positive integer, we define a mod n
to be the remainder when a is divided by n. The integer n is
called the modulus.
• Thus, for any integer a, we can rewrite the Equation as
follows:
• a = qn + r 0 ≤ r < n; q = [a/n];
• a = [a/n] x n + (a mod n)
• Ex, 11 mod 7 = 4; Ex, -11 mod 7 = 3;
• 11 = 1 (7) + 4; = 7 – (11 mod 7);
• 11 = 11 =7–4=3
-11 = -2 (7) + 3
-11 = -14 + 3
-11 = -11
Congruent modulo
• Let us know the meaning of equality principle.
• Two numbers are equal. For example, if a = 8 and b = 8, then
we would say that a and b are equal. Similarly, a is congruent
(≡) to b(mod n) if and only if (a – b) is a multiple of n.
• Therefore, two unequal numbers let us say a and b may be
congruentially equal under the modulo divison operation.
• Let a, b and n be integers with n not equal to zero. We say
that a ≡ b(mod n) if (a – b) is a multiple of n or n | (a – b).
• Ex, 73 ≡ 4 (mod 23) (here, a = 73, b = 4, n = 23) 73 – 4 =
69
• 73 mod 23 = 4 mod 23 23 │69
• 4=4
Congruent modulo
• Two integers a and b are said to be congruent modulo n, if
(a mod n) = (b mod n).
• a ≡ b (mod n)
• For ex,
73 ≡ 4 (mod 23)
73 mod 23 = 4 mod 23
4 = 4
• For ex,
24 ≡ 2 (mod 10)
24 mod 10 = 2 mod 10
4≠2
Properties of Congruences
• 1. a ≡ b (mod n) if n │ (a - b).
• 2. a ≡ b (mod n) implies b ≡ a (mod n).
• 3. a ≡ b (mod n) and b ≡ c (mod n) imply a ≡ c (mod n).
Example for property 1
• a ≡ b (mod n) if n │ (a - b)
• 73 ≡ 4 (mod 23)
• 23 │ (73-4)
• 23 │ 69 = 3
• Yes. Condition is satisfied. 73 ≡ 4 (mod 23)
Example for property 2
• a ≡ b (mod n) implies b ≡ a (mod n)
• 73 ≡ 4 (mod 23)
• n│a–b
• 23 │ (73-4)
• 23 │ 69 = 3
• 4 ≡ 73 (mod 23)
• n│b–a
• 23 │ 4 – 73
• 23 │ – 69 = 3
• Condition is satisfied
Example for property 3
• a ≡ b (mod n) and b ≡ c (mod n) imply a ≡ c (mod n)
• a ≡ b (mod n) = n │a – b ------- 1
• b ≡ c (mod n) = n │b – c ------- 2
• 1+2
• n│a–b+b–c
• n │a – c
• a ≡ c (mod n)
• Ex, n= 5, a = 30, b= 15, c =10
• n │a – b = 5 │ 30 – 15 = 5 │ 15
• n │b – c = 5 │ 15 – 10 =5│5
• n │a – c = 5 │ 30 – 10 = 5 │ 20
• Condition is satisfied
Other Example 1
Other Example 2
Other Example 3
Properties of Modular Arithmetic
Example for the Properties of Modular
Arithmetic
Exponentiation
• Exponentiation is performed by repeated multiplication, as in
ordinary arithmetic.
117=1,94,87,171
=1,94,87,171 mod 13
=2
Additive and multiplicative
inverse modulo 8
Residue classes
Other Properties of Modular Arithmetic