Académique Documents
Professionnel Documents
Culture Documents
Theory
By: Dr. T. Sritharan
Modular Arithmetic
Division of an integer by a positive integer produces a quotient and a remainder.
Working with these remainders leads to modular arithmetic, which plays an
important role in mathematics and which is used throughout computer science.
Definition: Let 𝑎 and 𝑏 be two integers with 𝑎 ≠ 0. we say that 𝑎 divides 𝑏 if there
is an integer 𝑐 such that 𝑏 = 𝑎𝑐.
When 𝑎 divides 𝑏 we say that 𝑎 is a factor or divisor of 𝑏, and that 𝑏 is a multiple of
𝑎 and is denoted by 𝑎 | 𝑏.
Example: Let 𝑛 and 𝑑 be positive integers. How many positive integers not
exceeding 𝑛 are divisible by 𝑑?
Corollary 2: If 𝑎, 𝑏, and 𝑐 are integers, where 𝑎 ≠ 0, such that 𝑎|𝑏 and 𝑎|𝑐, then
𝑎| 𝑚𝑏 + 𝑛𝑐 whenever 𝑚 and 𝑛 are integers.
Theorem 5: Let 𝑚 be a positive integer. The integers 𝑎 and 𝑏 are congruent modulo 𝑚
if and only if there is an integer 𝑘 such that 𝑎 = 𝑏 + 𝑘𝑚.
42 ≡ 3 𝑚𝑜𝑑 13;
44 ≡ 32 ≡ 9 ≡ −4 𝑚𝑜𝑑 13;
48 ≡ −4 2 ≡ 16 ≡ 3 𝑚𝑜𝑑 13;
416 ≡ 32 ≡ 9 ≡ −4 𝑚𝑜𝑑 13;
432 ≡ −4 2 ≡ 16 ≡ 3 𝑚𝑜𝑑 13;
464 ≡ 32 ≡ 9 ≡ −4 𝑚𝑜𝑑 13;
𝑎 +𝑚 b = a + b mod m
𝑎 ×𝑚 b = a × b mod m for all 𝑎, 𝑏 ∈ ℤ𝒎 .
The operations +𝑚 and ×𝑚 are called addition and multiplication modulo m and
when we use these operations, we are said to be doing arithmetic modulo m.
Example: Use the definition of addition and multiplication in ℤ𝟏𝟏 to find 8+11 9 and
7×11 9.
• The largest Mersenne prime number (50th) known to mankind (December 26,
2017) is 277,232,917 − 1. (This is the largest prime known).
Theorem 9 (The Prime Number Theorem – 1896): If 𝜋(𝑥) be the number of primes
𝜋(𝑥)
less than or equal to the number x, then lim 𝑥 = 1.
𝑥→∞ ln 𝑥
• The probability that a randomly selected positive integer less than n is prime is
1
approximately ln 𝑛.
1
• The odds that an integer near 101000 is prime are approximately , which
ln 101000
is approximately 1/2300.
Definition: The integers 𝑎 and 𝑏 are relatively prime if their greatest common
divisor is 1.
Definition: The integers 𝑎1 , 𝑎2 , ⋯ , 𝑎𝑛 are pairwise relatively prime if gcd 𝑎𝑖 , 𝑎𝑗 = 1
whenever 1 ≤ 𝑖 < 𝑗 ≤ 𝑛.
Example: Integers 17 and 22 are relatively prime, because gcd(17, 22) = 1.
Integers 10, 17, and 21 are pairwise relatively prime.
Theorem 10: Let 𝑎 and 𝑏 be positive integers. Then 𝑎𝑏 = 𝑔𝑐𝑑(𝑎, 𝑏) · 𝑙𝑐𝑚(𝑎, 𝑏).
Example: Let us compute the greatest common divisor of 945 and 2415.
2415 = 945 × 2 + 525
945 = 525 × 1 + 420
525 = 420 × 1 + 105
420 = 105 × 4 + 0.
∴ gcd 2415, 945 = 105.
252 = 1 × 198 + 54 18 = 54 − 1 × 36
198 = 3 × 54 + 36 = 54 − 1 198 − 3 × 54
54 = 1 × 36 + 18 = 4 × 54 − 1 × 198
Lemma 14: If 𝑝 is a prime and 𝑝|𝑎1 𝑎2 ⋯ 𝑎𝑛 , where each 𝑎𝑖 is an integer, then 𝑝|𝑎𝑖 for
some 𝑖.
Theorem 16: Let 𝑚 ≥ 2. If 𝑎 and 𝑚 are relatively prime then there exists a unique
integer 𝑎 such that 𝑎𝑎 ≡ 1 (𝑚𝑜𝑑 𝑚) and 0 < 𝑎 < m.
4620 = 45 · 101 + 75
101 = 1 · 75 + 26
75 = 2 · 26 + 23
26 = 1 ∙ 23 + 3
23 = 7 · 3 + 2
3 = 1 · 2 + 1
2 = 2 · 1.
Proposition 17:
• If 𝑝 is prime, 𝜑 𝑝 = 𝑝 − 1.
• If 𝑝 is prime and 𝑛 ≥ 1, then 𝜑 𝑝𝑛 = 𝑝𝑛 − 𝑝𝑛−1 .
• If gcd 𝑚, 𝑛 = 1, 𝑡ℎ𝑒𝑛 𝜑 𝑚𝑛 = 𝜑(𝑚)𝜑(𝑛).
𝑎 𝑎 𝑎
• For any integer 𝑛 > 1, if 𝑛 = 𝑝1 1 𝑝2 2 ⋯ 𝑝𝑠 𝑠 is the prime power factorization,
1 1 1
then 𝜑 𝑛 = 𝑛 1 − 𝑝 1−𝑝 ⋯ 1−𝑝 .
1 2 𝑠
Example: {1, 5, 7, 11} is a reduced residue system mod 12. {−11, 17, 31,−1} is also
another reduced residue system for mod 12.
Since gcd 𝑎, 𝑛 = 1, { 𝑎𝑎1 , 𝑎𝑎2 , ⋯ , 𝑎𝑎𝑘 }, is another reduced residue system mod n.
Since this is the same set of numbers mod n as the original system, the two systems
must have the same product mod n:
𝑎𝑎1 × 𝑎𝑎2 × ⋯ × 𝑎𝑎𝑘 ≡ 𝑎1 × 𝑎2 × ⋯ × 𝑎𝑘 (𝑚𝑜𝑑 𝑛)
⟹ 𝑎𝑘 𝑎1 × 𝑎2 × ⋯ × 𝑎𝑘 ≡ 𝑎1 × 𝑎2 × ⋯ × 𝑎𝑘 𝑚𝑜𝑑 𝑛
⟹ 𝑎𝑘 ≡ 1 𝑚𝑜𝑑 𝑛 ∵ gcd 𝑎𝑖 , 𝑛 = 1 & applying theorem 12 .