Number Theory Notes PDF
Number Theory Notes PDF
Number Theory Notes PDF
Introduction:
Number theory is the branch of mathematics that studies the properties and the
relationships between particular type of numbers.
Of the sets of numbers studied in Number Theory, the most important is the set of
positive integers and primes.
A key result of Number Theory shows that the primes are the multiplicative building
blocks of the positive integers. This result called the Fundamental Theorem of Arithmetic,
tells us that every positive integer can be uniquely written as the product of primes in non-
decreasing order.
Integer Numbers:
The integers are the numbers in the set {…..-3,-2,-1,0,1,2,3,……}
Well-ordering principal:
Every non-empty set of positive integers has a least element.
Example:
1. The set of positive integers is well-ordered.
2. The set of all integers is not well-ordered.
Rational Number:
The real number r is rational, if there are integers p and q with 𝑞 ≠ 0 such that
𝑟 = 𝑝⁄𝑞 . If r is not rational, it is called as an irrational number.
12 2 0
Example: − , 17 , 1 are rational and √2 is irrational.
7
Note: The set of integers, positive integers, rational numbers and real numbers are denoted by
𝑍, 𝑍 + , 𝑄, 𝑅 respectively.
Divisibility:
If a, b are integers with 𝑎 ≠ 0, we say that a divides b, if there is an integer c such
that 𝑏 = 𝑎𝑐. If a divides b, we also say that a is a divisor (or) factor of b and that b is multiple
of a.
= (15,7)
=1
7. Find the GCD of 105,140,350
Sol: The positive divisors of 105 are 1,3,5,7,15,21,35,105
The positive divisors of 140 are 1,2,4,5,7,10,14,20,28,35,70,140
The positive divisors of 350 are 1,2,5,7,10,14,35,70,350
= (105,70)
= 35
8. Show that 8a+3 and 5a+2 are relatively prime for all integers a
Sol: By a known theorem, Let a, b, c are integers then (𝑎 + 𝑐𝑏, 𝑏) = (𝑎, 𝑏)
Consider (8𝑎 + 3, 5𝑎 + 2) = (8𝑎 + 3 − (5𝑎 + 2), 5𝑎 + 2) [For 𝑐 = −1]
= (3𝑎 + 1,5𝑎 + 2)
= (3𝑎 + 1,2𝑎 + 1)
= (3𝑎 + 1 − (2𝑎 + 1), 2𝑎 + 1)
= (𝑎, 2𝑎 + 1)
= (𝑎, 2𝑎 + 1 − 2(𝑎))
(8𝑎 + 3, 5𝑎 + 2) = (𝑎, 1) = 1
Thus 8a+3 and 5a+2 are relatively prime.
The Euclidean Algorithm:
We are going to develop a systematic method, or an algorithm to find the greatest
common divisor of two positive integers. This method is called the Euclidean algorithm.
Theorem: The Euclidean Algorithm:
Let 𝑟0 = 𝑎 and 𝑟1 = 𝑏 be integers such that 𝑎 ≥ 𝑏 > 0. If the division algorithm is
successively applied to obtain 𝑟𝑗 = 𝑟𝑗+1 𝑞𝑗+1 + 𝑟𝑗+2 with 0 < 𝑟𝑗+2 < 𝑟𝑗+1 for j = 0, 1, 2, ...n-2
and 𝑟𝑛+1 = 0, then (𝑎, 𝑏) = 𝑟𝑛 , the last nonzero remainder.
Problems:
b) (20785,44350)
Sol: Consider 44350 = 2 × 20785 + 2780
20785 = 7 × 2780 + 1325
2780 = 2 × 1325 + 130
1325 = 10 × 130 + 25
130 = 5 × 25 + 5
25 = 5 × 5 + 0
Last non-zero remainder is 5
Thus (20785,44350) = 5
c) (34709,100313)
Sol: Let us consider 100313 = 2 × 34709 + 30895
34709 = 1 × 30895 + 3814
30895 = 8 × 3814 + 383
3814 = 9 × 383 + 367
383 = 1 × 367 + 16
367 = 22 × 16 + 15
16 = 1 × 15 + 1
15 = 1 × 15 + 0
Last non-zero remainder is 1
Thus (34709,100313) = 1.
d) (300,2160,5040)
Sol: First we have to find the GCD of (2160,5040)
Let us consider 5040 = 2 × 2160 + 720
2160 = 3 × 720 + 0
Last non-zero remainder is 720
Thus (2160,5040) = 720.
Next we have to find the GCD of (300,720)
Let us consider 720 = 2 × 300 + 120
300 = 2 × 120 + 60
120 = 2 × 60 + 0
Last non-zero remainder is 60
Thus (300,720) = 60.
Finally Consider (300,2160,5040) = (300, (2160,5040))
= (300,720)
= 60
The Euclidean algorithm can be used to express the GCD of two integers as a linear
combination of these integers.
Example: Express (252,198) = 18 as a linear combination of 252 and 198.
From Euclidean algorithm 252 = 1 × 198 + 54
198 = 3 × 54 + 36
54 = 1 × 36 + 18
36 = 2 × 18 + 0
Last non-zero remainder is 18
Thus (252,198) = 18.
From the next to last division,
18 = 54 − 1(36)
= 54 − [198 − 3(54)]
= 54 − 198 + 3(54)
= 4(54) − 198
= 4[252 − 1(198)] − 198
= 4(252) − 4(198) − 198
∴ 18 = 4(252) − 5(198)
Thus we expressed 18 as a linear combination of 252 and 198.
Examples: 1) 240 = 2 × 2 × 2 × 2 × 3 × 5 = 24 × 3 × 5
2) 1001 = 7 × 11 × 13
Note:
Let the prime factorization of a and b be 𝑎 = 𝑝1 𝑎1 𝑝2 𝑎2 … . . 𝑝𝑛 𝑎𝑛 and 𝑏 = 𝑝1 𝑏1 𝑝2 𝑏2 … . . 𝑝𝑛 𝑏𝑛
Then (𝑎, 𝑏) = 𝑝1 min(𝑎1 ,𝑏1) 𝑝2 min (𝑎2,𝑏2 ) … . . 𝑝𝑛 min(𝑎𝑛,𝑏𝑛) where 𝑝1 , 𝑝2 , … . , 𝑝𝑛 are primes
Definition: The least common multiple of two non-integers a and b is the smallest positive
integer that is divisible by a and b.
The least common multiple of a and b is denoted by [a, b].
Note:
Let the prime factorization of a and b be 𝑎 = 𝑝1 𝑎1 𝑝2 𝑎2 … . . 𝑝𝑛 𝑎𝑛 and 𝑏 = 𝑝1 𝑏1 𝑝2 𝑏2 … . . 𝑝𝑛 𝑏𝑛
Then [𝑎, 𝑏] = 𝑝1 max (𝑎1,𝑏1 ) 𝑝2 max(𝑎2 ,𝑏2 ) … . . 𝑝𝑛 max(𝑎𝑛,𝑏𝑛) where 𝑝1 , 𝑝2 , … . , 𝑝𝑛 are primes
Problems:
1. Find the prime factorization of the following
a) 5040
Sol: Consider 5040 = 2 × 2520
= 2 × 2 × 2160
= 2 × 2 × 2 × 630
= 2 × 2 × 2 × 2 × 315 = 24 × 315
= 24 × 3 × 105
= 24 × 3 × 3 × 35
= 24 × 3 × 3 × 5 × 7
= 24 × 3 2 × 5 × 7
b) 9555
Sol: Consider 9555 = 3 × 3185
= 3 × 5 × 637
= 3 × 5 × 7 × 91
= 3 × 5 × 7 × 7 × 13
= 3 × 5 × 72 × 13
c) 10500000
Sol: Consider 10500000 = 2 × 2 × 2 × 2 × 2 × 328125
= 25 × 5 × 65625
= 25 × 5 × 5 × 13125
= 25 × 5 × 5 × 5 × 2625
= 25 × 5 × 5 × 5 × 5 × 525
= 25 × 5 × 5 × 5 × 5 × 5 × 105
= 25 × 5 × 5 × 5 × 5 × 5 × 5 × 21
= 25 × 5 6 × 3 × 7
2. Find the GCD and LCM of the following pairs
a) 28,35
Sol: consider 28 = 2 × 14 = 2 × 2 × 7 = 22 × 7
Also consider 35 = 5 × 7
GCD = 2min{2,0} × 5min{1,0} × 7min{1,1}
= 20 × 50 × 71 = 1 × 1 × 7
∴ (28,35) = 7
𝑛
Theorem: Every prime divisor of the Fermat number 𝐹𝑛 = 22 + 1 is of the form 2𝑛+2 𝑘 + 1
𝑘
Lemma: Let 𝐹𝑘 = 22 + 1 denote the kth Fermat number where k is a non-negative integer
then for all positive integers n we have 𝐹0 . 𝐹1 . 𝐹2 … … 𝐹𝑛−1 = 𝐹𝑛 − 2.
Theorem: Let m and n be distinct non-negative integers then the Fermat numbers 𝐹𝑚 and
𝐹𝑛 are relatively prime.
Fermat Factorization Method:
Theorem: If n is an odd positive integer then there is a one-to-one correspondence between
factorization of n into two positive integers and differences of two squares that equal to n.
𝑎+𝑏 𝑎−𝑏
𝑛 = 𝑎𝑏 = 𝑠 2 − 𝑡 2 where 𝑠 = and 𝑡 =
2 2
Problems:
1. Use Fermat’s method to factor 𝑛 = 6077
If 𝑚 (𝑎 − 𝑏), then we write 𝑎 ≢ 𝑏(𝑚𝑜𝑑𝑚) and we say that a and b are incongruent
modulo m. The integer m is called the modulus of the congruence.
Note: 1) If 𝑎 ≡ 𝑏(𝑚𝑜𝑑𝑚) ⇔ 𝑚|(𝑎 − 𝑏).
⇔ 𝑎 − 𝑏 = 𝑞𝑚, 𝑞 ∈ 𝑧
Example:
1) 22 ≡ 4(𝑚𝑜𝑑9) ⇔ 9|(22 − 4) = 9|18
2) 3 ≡ −6(𝑚𝑜𝑑9) ⇔ 9|(3 + 6)
3) 200 ≡ 2(𝑚𝑜𝑑9) ⇔ 9|(200 − 2)
⇒ 5 ≡ 2(𝑚𝑜𝑑3)
Corollary: If a, b, c and m are integers such that 𝑚 > 0, (𝑐, 𝑚) = 1 and 𝑎𝑐 ≡ 𝑏𝑐(𝑚𝑜𝑑𝑚)
then 𝑎 ≡ 𝑏(𝑚𝑜𝑑𝑚)
Example: we have 42 ≡ 7(𝑚𝑜𝑑5) and (5,7) = 1
42 7
⇒ ≡ (𝑚𝑜𝑑5)
7 7
⇒ 6 ≡ 1(𝑚𝑜𝑑5)
Theorem: If a, b, c, d and m are integers such that 𝑚 > 0 and 𝑎 ≡ 𝑏(𝑚𝑜𝑑𝑚) and
𝑐 ≡ 𝑑(𝑚𝑜𝑑𝑚) then
i) 𝑎 + 𝑐 ≡ 𝑏 + 𝑑 (𝑚𝑜𝑑𝑚)
𝑖𝑖) 𝑎 − 𝑐 ≡ 𝑏 − 𝑑 (𝑚𝑜𝑑𝑚)
𝑖𝑖𝑖) 𝑎𝑐 ≡ 𝑏𝑑(𝑚𝑜𝑑𝑚)
Ex: we have 13 ≡ 3(𝑚𝑜𝑑5) and 7 ≡ 2(𝑚𝑜𝑑5) then 13 + 7 ≡ 3 + 2(𝑚𝑜𝑑5)
13 − 7 ≡ 3 − 2(𝑚𝑜𝑑5) and 13.7 ≡ 3.2(𝑚𝑜𝑑5)
Theorem: If a, b, k and m are integers such that 𝑘 > 0, 𝑚 > 0 and 𝑎 ≡ 𝑏(𝑚𝑜𝑑𝑚) then
𝑎𝑘 ≡ 𝑏𝑘 (𝑚𝑜𝑑𝑚)
Ex: we have 7 ≡ 2(𝑚𝑜𝑑5) then 73 ≡ 23 (𝑚𝑜𝑑5)
Theorem: If 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚1 ), 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚2 ), … . . , 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚𝑘 ) where
𝑎, 𝑏, 𝑚1 , 𝑚2 , … , 𝑚𝑘 are integers with 𝑚1 , 𝑚2 , … , 𝑚𝑘 positive then 𝑎 ≡
𝑏 𝑚𝑜𝑑 ([𝑚1 , 𝑚2 , … , 𝑚𝑘 ]) where [𝑚1 , 𝑚2 , … , 𝑚𝑘 ] denotes the least common multiple of
𝑚1 , 𝑚2 , … , 𝑚𝑘 .
Corollary: If 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚1 ), 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚2 ), … . . , 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚𝑘 ) where a and b are
integers and 𝑚1 , 𝑚2 , … , 𝑚𝑘 are pairwise relatively prime positive integers then
𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚1 , 𝑚2 , … , 𝑚𝑘 ).
Fast Modular Exponentiation: Here we will be working with congruences involving large
powers of integers.
Ex: Find the least positive residue of 2644 modulo 645
Sol: First we compute the least positive residues of 2, 22 , 24 , … . . , 2512 successively squaring
and reducing modulo 645
We have 2 ≡ 2(𝑚𝑜𝑑 645)
22 ≡ 4(𝑚𝑜𝑑 645)
24 ≡ 16(𝑚𝑜𝑑 645)
28 = 24+4 = 24 × 24 (𝑚𝑜𝑑 645)
≡ 16 × 16 (𝑚𝑜𝑑 645)
∴ 28 ≡ 256 (𝑚𝑜𝑑 645)
216 = 28+8 = 28 × 28 (𝑚𝑜𝑑 645)
≡ 256 × 256 (𝑚𝑜𝑑 645) = 65536(𝑚𝑜𝑑 645)
∴ 216 ≡ 391 (𝑚𝑜𝑑 645)
232 = 216+16 = 216 × 216 (𝑚𝑜𝑑 645)
≡ 391 × 391(𝑚𝑜𝑑 645) = 152881(𝑚𝑜𝑑 645)
∴ 232 ≡ 16 (𝑚𝑜𝑑 645)
Similarly 264 ≡ 256 (𝑚𝑜𝑑 645); 2128 ≡ 391 (𝑚𝑜𝑑 645) ; 2256 ≡ 16 (𝑚𝑜𝑑 645)
And 2512 ≡ 256 (𝑚𝑜𝑑 645)
Finally consider 2644 = 2512+128+4 = 2512 × 2128 × 24
≡ 256 × 391 × 16(𝑚𝑜𝑑 645) = 1601536(𝑚𝑜𝑑 645)
2644 ≡ 1(𝑚𝑜𝑑 645)
Thus 1 is the least positive residue of 2644 (𝑚𝑜𝑑 645).
Problems:
1. Show that the following congruences holds or not
a) 13 ≡ 1(𝑚𝑜𝑑 2)
Sol: Clearly 13-1=12 and 2 divides 12
i.e., 2|12
∴ 13 ≡ 1(𝑚𝑜𝑑 2) holds.
b) 69 ≡ 62(𝑚𝑜𝑑 7)
Sol: Clearly 69-62=7 and 7 divides 7
i.e., 7|7
∴ 69 ≡ 62(𝑚𝑜𝑑 7) holds.
c) −3 ≡ 30(𝑚𝑜𝑑 11)
Sol: Clearly −3 − 30 = −33 and 11| − 33
∴ −3 ≡ 30(𝑚𝑜𝑑 11) holds.
2. For each of these pairs of integers, determine whether they are congruent modulo 7 or not
a) 1, 15
Sol: If 1, 15 are congruent modulo 7 means 15 ≡ 1(𝑚𝑜𝑑 7) holds.
Consider 15 − 1 = 14 and 7|(15 − 1)
15 ≡ 1(𝑚𝑜𝑑 7) holds.
Thus 1, 15 are congruent modulo 7.
b) 2,99
Sol: If 2, 99 are congruent modulo 7 means 99 ≡ 2(𝑚𝑜𝑑 7) holds.
Consider 99 − 2 = 97 and 7 97
99 ≢ 2(𝑚𝑜𝑑 7) holds.
Thus 2,99 are not congruent modulo 7.
c) -1,699
Sol: If -1,699are congruent modulo 7 means 699 ≡ −1(𝑚𝑜𝑑 7) holds.
Consider 699 − (−1) = 700 and 7|(700)
699 ≡ −1(𝑚𝑜𝑑 7) holds.
Thus -1,699 are congruent modulo 7.
3. For which positive integers m is each of the following statements true
a) 27 ≡ 5(𝑚𝑜𝑑 𝑚)
Sol: we have 27-5=22
The positive divisors of 22 are 1,2,11,22
Thus, the possibility of m are 1,2,11,22.
b) 1000 ≡ 1(𝑚𝑜𝑑 𝑚)
Sol: we have 1000-1=999
The positive divisors of 999 are 1,3,9,27,37,111,333,999
Thus, the possibility of m are 1,3,9,27,37,111,333,999.
4. Show that if a is an even integer, then 𝑎2 ≡ 0(𝑚𝑜𝑑 4) and if a is an odd integer then
𝑎2 ≡ 1(𝑚𝑜𝑑 4).
Sol: Suppose that if a is an even integer then 𝑎 = 2𝑘 for some integer k
𝑎2 = 4𝑘 2
⇒ 4|𝑎2
⇒ 4|(𝑎2 − 0)
Thus 𝑎2 ≡ 0(𝑚𝑜𝑑 4).
Suppose that if a is an odd integer then 𝑎 = 2𝑘 + 1 for some integer k
𝑎2 = (2𝑘 + 1)2 = 4𝑘 2 + 4𝑘 + 1
= 4(𝑘 2 + 𝑘 ) + 1
⇒ 𝑎 2 − 1 = 4(𝑘 2 + 𝑘 )
⇒ 4|(𝑎2 − 1)
Thus 𝑎2 ≡ 1(𝑚𝑜𝑑 4).
5. Find the least non-negative residue modulo 13 of the following integers
a) 22
Sol: Dividing 22 by 13 we have 22 = 1(13) + 9
⇒ 22 − 9 = 13
⇒ 22 − 9 is divisible by 13
⇒ 13|(22 − 9)
⇒ 22 ≡ 9(𝑚𝑜𝑑 13)
So 9 is the least non-negative residue of 22.
b) 1001
Sol: Dividing 1001 by 13 we have 1001 = 77(13) + 0
⇒ 1001 − 0 = 77(13)
⇒ 1001 is divisible by 13
⇒ 13|(1001 − 0)
⇒ 1001 ≡ 0(𝑚𝑜𝑑 13)
So 0 is the least non-negative residue of 1001.
c) -1
Sol: we write −1 = −1(13) + 12
⇒ −1 − 12 = −1(13)
⇒ −1 − 12 is divisible by 13
⇒ 13|(−1 − 12)
⇒ −1 ≡ 12(𝑚𝑜𝑑 13)
d) -100
Sol: Dividing -100 by 13 we have −100 = −8(13) + 4
⇒ −100 − 4 = −8(13)
⇒ −100 − 4 is divisible by 13
⇒ 13|(−100 − 4)
⇒ −100 ≡ 4(𝑚𝑜𝑑 13)
So 4 is the least non-negative residue of -100.
6. Find the least non-negative residue modulo 28 of the following integers
a) 99
Sol: Dividing 99 by 28 we have 99 = 3(28) + 15
⇒ 99 − 15 = 3(28)
⇒ 99 − 15 is divisible by 28
⇒ 28|(99 − 15)
⇒ 99 ≡ 15(𝑚𝑜𝑑 28)
So 15 is the least non-negative residue of 99.
b) 12345
Sol: Dividing 12345 by 28 we have 12345 = 440(28) + 25
⇒ 12345 − 25 = 440(28)
⇒ 12345 − 25 is divisible by 28
⇒ 28|(12345 − 25)
⇒ 12345 ≡ 25(𝑚𝑜𝑑 28)
So 25 is the least non-negative residue of 12345.
c) -54321
Sol: we have −54321 = −1941(28) + 27
−54321 − 27 = −1941(28)
⇒ 28|(−54321 − 27)
⇒ −54321 ≡ 27(𝑚𝑜𝑑 28)
So 27 is the least non-negative residue of -54321.
7. Find the least positive residue of 1! + 2! + 3! + ⋯ + 10! Modulo of the following
a) 3 b) 11 c) 23 d) 4
a) Modulo 3
Sol: Let us compute the factorials
1! = 1(𝑚𝑜𝑑 3) ; 2! = 2(𝑚𝑜𝑑 3) and 3! = 6 ≡ 0(𝑚𝑜𝑑 3)
4! = 4 × 3! ≡ 0(𝑚𝑜𝑑 3) and so on
Consider 1! + 2! + 3! + ⋯ + 10!
≡ 1 + 2 + 0 + 0 + ⋯ + 0(𝑚𝑜𝑑 3)
≡ 3 (𝑚𝑜𝑑 3)
∴ 1! + 2! + 3! + ⋯ + 10! ≡ 0 (𝑚𝑜𝑑 3)
b) Modulo 11
Sol: Let us compute the factorials
1! = 1(𝑚𝑜𝑑 11); 2! = 2(𝑚𝑜𝑑 11) ; 3! = 6(𝑚𝑜𝑑 11); 4! = 24(𝑚𝑜𝑑 11) ≡ 2(𝑚𝑜𝑑 11)
5! = 5 × 4! ≡ 5 × 2(𝑚𝑜𝑑 11) ≡ 10(𝑚𝑜𝑑 11)
6! = 6 × 5! ≡ 6 × 10(𝑚𝑜𝑑 11) = 60(𝑚𝑜𝑑 11) ≡ 5(𝑚𝑜𝑑 11)
7! = 7 × 6! ≡ 7 × 5(𝑚𝑜𝑑 11) = 35(𝑚𝑜𝑑 11) ≡ 2(𝑚𝑜𝑑 11)
8! = 8 × 7! ≡ 8 × 2(𝑚𝑜𝑑 11) = 16(𝑚𝑜𝑑 11) ≡ 5(𝑚𝑜𝑑 11)
9! = 9 × 8! ≡ 9 × 5(𝑚𝑜𝑑 11) = 45(𝑚𝑜𝑑 11) ≡ 1(𝑚𝑜𝑑 11)
10! = 10 × 9! ≡ 10 × 1(𝑚𝑜𝑑 11) = 10(𝑚𝑜𝑑 11) ≡ 10(𝑚𝑜𝑑 11)
Consider 1! + 2! + 3! + 4! + 5! + 6! + 7! + 8! + 9! + 10!
≡ (1 + 2 + 6 + 2 + 10 + 5 + 2 + 5 + 1 + 10)(𝑚𝑜𝑑 11)
= 44(𝑚𝑜𝑑 11)
∴ 1! + 2! + 3! + ⋯ + 10! ≡ 0 (𝑚𝑜𝑑 11)
8. Find the least positive residue of 1! + 2! + 3! + ⋯ + 100! of the following
a) mod 2 b) mod 12 c) mod 25 d) mod 7
Sol: b) Modulo 12
We have 4! = 24 = 12 × 2 ≡ 0 × 2(𝑚𝑜𝑑 12) ≡ 0(𝑚𝑜𝑑 12)
5! = 5 × 4! ≡ 5 × 0(𝑚𝑜𝑑 12) ≡ 0(𝑚𝑜𝑑 12) and so on
Consider 1! + 2! + 3! + ⋯ + 100! = 1! + 2! + 3! + 0 + 0 + ⋯ + 0(𝑚𝑜𝑑 12)
≡ 1 + 2 + 6(𝑚𝑜𝑑 12)
≡ 9 (𝑚𝑜𝑑 12)
c) Modulo 25
We have10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
= 50 × 9 × 8 × 7 × 6 × 4 × 3 × 2
= 50 × 72576
≡ 0(𝑚𝑜𝑑 25) because 50 ≡ 0(𝑚𝑜𝑑 25)
Similarly from 11!, 12!, ….., 100! Are all congruent to 0 modulo 25
Consider 1! + 2! + 3! + ⋯ + 100! = 1! + 2! + 3! + 4! + ⋯ + 10! + 11! + 12! + ⋯ + 100!
≡ 1! + 2! + 3! + 4! + ⋯ 9! + 0 + 0 + 0 + ⋯ + 0 (𝑚𝑜𝑑 25)
= 1 + 2 + 6 + 24 + 120 + 720 + 5040 + 40320 + 362880(𝑚𝑜𝑑 25)
≡ 1 + 2 + 6 + 24 + 20 + (−5) + 15 + (20) + 5(𝑚𝑜𝑑 25)
≡ 88(𝑚𝑜𝑑 25)
≡ 13(𝑚𝑜𝑑 25)
9. Construct a table for addition, subtraction and multiplication modulo 6
Sol: Let 𝐴 = {0,1,2,3,4,5}
𝑎 ⊕6 𝑏 = 𝑇ℎ𝑒 𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 𝑤ℎ𝑒𝑛 𝑎 + 𝑏 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 6
⊕6 0 1 2 3 4 5
0 0 1 2 3 4 5
1 1 2 3 4 5 0
2 2 3 4 5 0 1
3 3 4 5 0 1 2
4 4 5 0 1 2 3
5 5 0 1 2 3 4
10. Find the least positive residue of the following
a) 232 (𝑚𝑜𝑑 47) b) 247 (𝑚𝑜𝑑 47) c) 2200 (𝑚𝑜𝑑 47)
Sol: b) 𝟐𝟒𝟕 (𝒎𝒐𝒅 𝟒𝟕)
We have 2 ≡ 2(𝑚𝑜𝑑 47)
22 ≡ 4(𝑚𝑜𝑑 47)
23 ≡ 8(𝑚𝑜𝑑 47)
24 ≡ 16(𝑚𝑜𝑑 47)
25 ≡ 32(𝑚𝑜𝑑 47)
26 = 64(𝑚𝑜𝑑 47) ≡ 17(𝑚𝑜𝑑 47)
27 = 128(𝑚𝑜𝑑 47) ≡ 34(𝑚𝑜𝑑 47)
210 = 25+5 = 25 × 25 (𝑚𝑜𝑑 47)
≡ 32 × 32 (𝑚𝑜𝑑 47) = 1024(𝑚𝑜𝑑 47)
∴ 210 ≡ 37 (𝑚𝑜𝑑 47)
220 = 210+10 = 210 × 210 (𝑚𝑜𝑑 47)
≡ 37 × 37(𝑚𝑜𝑑 47) = 1369(𝑚𝑜𝑑 47)
∴ 220 ≡ 6 (𝑚𝑜𝑑 47)
240 = 220+20 = 220 × 220 (𝑚𝑜𝑑 47)
≡ 6 × 6(𝑚𝑜𝑑 47) = 36(𝑚𝑜𝑑 47)
∴ 240 ≡ 36 (𝑚𝑜𝑑 47)
Finally consider 247 = 240+7 = 240 × 27
≡ 36 × 34(𝑚𝑜𝑑 47) = 1224(𝑚𝑜𝑑 47)
247 ≡ 2(𝑚𝑜𝑑 47)
Thus 2 is the least positive residue of 247 (𝑚𝑜𝑑 47).
c) 𝟐𝟐𝟎𝟎 (𝒎𝒐𝒅 𝟒𝟕)
Sol: We have 2 ≡ 2(𝑚𝑜𝑑 47)
22 ≡ 4(𝑚𝑜𝑑 47)
23 ≡ 8(𝑚𝑜𝑑 47)
24 ≡ 16(𝑚𝑜𝑑 47)
25 ≡ 32(𝑚𝑜𝑑 47)
210 = 25+5 = 25 × 25 (𝑚𝑜𝑑 47)
≡ 32 × 32 (𝑚𝑜𝑑 47) = 1024(𝑚𝑜𝑑 47)
220 ≡ 6 (𝑚𝑜𝑑 47)
240 ≡ 36 (𝑚𝑜𝑑 47)
280 = 240+40 = 240 × 240 (𝑚𝑜𝑑 47)
≡ 36 × 36 (𝑚𝑜𝑑 47) = 27(𝑚𝑜𝑑 47)
280 ≡ 27 (𝑚𝑜𝑑 47)
2160 = 280+80 = 280 × 280 (𝑚𝑜𝑑 47)
≡ 27 × 27 (𝑚𝑜𝑑 47) = 729(𝑚𝑜𝑑 47)
2160 ≡ 24 (𝑚𝑜𝑑 47)
Finally consider 2200 = 2160+40 = 2160 × 240
≡ 24 × 36(𝑚𝑜𝑑 47) = 864(𝑚𝑜𝑑 47)
2200 ≡ 18(𝑚𝑜𝑑 47)
Thus 18 is the least positive residue of 2200 (𝑚𝑜𝑑 645).
11. Find the least positive residue of the following
a) 310 (𝑚𝑜𝑑 11) b) 516 (𝑚𝑜𝑑 17) c) 212 (𝑚𝑜𝑑 13) d) 322 (𝑚𝑜𝑑 23)
Sol: a) To find 𝟑𝟏𝟎 (𝒎𝒐𝒅 𝟏𝟏)
We have 3 ≡ 3(𝑚𝑜𝑑 11)
32 ≡ 9(𝑚𝑜𝑑 11)
33 ≡ 27(𝑚𝑜𝑑 11) ≡ 5(𝑚𝑜𝑑 11)
34 ≡ 81(𝑚𝑜𝑑 11) ≡ 4(𝑚𝑜𝑑 11)
35 = 33+2 = 33 × 32 ≡ 5 × 9(𝑚𝑜𝑑 11) = 45(𝑚𝑜𝑑 11) ≡ 1(𝑚𝑜𝑑 11)
310 = 35+5 = 35 × 35 ≡ 1 × 1(𝑚𝑜𝑑 11) ≡ 1(𝑚𝑜𝑑 11)
Thus 1 is the least positive residue of 310 (𝑚𝑜𝑑 11)
b) 𝟓𝟏𝟔 (𝒎𝒐𝒅 𝟏𝟕)
We have 5 ≡ 5(𝑚𝑜𝑑 17)
52 ≡ 25(𝑚𝑜𝑑 17) ≡ 8(𝑚𝑜𝑑 17)
53 = 52+1 = 52 × 51 ≡ 8 × 5(𝑚𝑜𝑑 17) ≡ 6(𝑚𝑜𝑑 17)
55 = 53+2 = 53 × 52 ≡ 6 × 8(𝑚𝑜𝑑 17) = 48(𝑚𝑜𝑑 17) ≡ 14(𝑚𝑜𝑑 17)
58 = 55+3 = 55 × 53 ≡ 14 × 6(𝑚𝑜𝑑 17) = 84(𝑚𝑜𝑑 17) ≡ −1(𝑚𝑜𝑑 17) ≡ 16(𝑚𝑜𝑑 17)
Finally consider 516 = 58+8 = 58 × 58 ≡ 16 × 16(𝑚𝑜𝑑 17)
= 256(𝑚𝑜𝑑 17) ≡ 1(𝑚𝑜𝑑 17)
Thus 1 is the least positive residue of 516 (𝑚𝑜𝑑 17)
12. Find the least positive residue of the following
a) 6! (𝑚𝑜𝑑 7) b) 10! (𝑚𝑜𝑑 11) c) 16! (𝑚𝑜𝑑 17) d) 12! (𝑚𝑜𝑑 13)
Sol: To find b) 𝟏𝟎! (𝒎𝒐𝒅 𝟏𝟏)
Consider 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
= (10 × 1) × (9 × 2) × (8 × 3) × (7 × 4) × (6 × 5) (𝑚𝑜𝑑 11)
≡ 10 × 7 × 2 × 6 × 8 (𝑚𝑜𝑑 11)
= (10) × (7 × 2) × (6 × 8) (𝑚𝑜𝑑 11)
≡ 10 × 3 × 4 (𝑚𝑜𝑑 11)
≡ 10 × 1(𝑚𝑜𝑑 11)
Thus 10! ≡ 10(𝑚𝑜𝑑 11)
c) 16! (𝑚𝑜𝑑 17)
Consider 16! = 16 × 15 × 14 × 13 × 12 × 11 × 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1
= (16 × 1) × (15 × 2) × (14 × 3) × (13 × 4) × (12 × 5) × (11 × 6) × (10 × 7)
× (9 × 8) (𝑚𝑜𝑑 17)
≡ 16 × 13 × 8 × 1 × 9 × 15 × 2 × 4 (𝑚𝑜𝑑 17)
= (16) × (13 × 4) × (8 × 9) × (15 × 2)(𝑚𝑜𝑑 17)
≡ 16 × 1 × 4 × 13(𝑚𝑜𝑑 17)
= 16 × (4 × 13) (𝑚𝑜𝑑 17)
≡ 16 × 1 (𝑚𝑜𝑑 17)
Thus 16! ≡ 16(𝑚𝑜𝑑 17)
Linear Congruences:
A congruence of the form 𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) where x is an unknown integer, is called
a linear congruence in one variable.
If 𝑥 = 𝑥0 is a solution of the congruence 𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) and if 𝑥1 ≡ 𝑥0 (𝑚𝑜𝑑 𝑚)
then 𝑎𝑥1 ≡ 𝑎𝑥0 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) so that 𝑥1 is also a solution.
Hence if one member of a congruence class modulo m is a solution then all members
of this class are also solutions.
Theorem: Let a, b and m be integers such that 𝑚 > 0 and (𝑎, 𝑚) = 𝑑. If 𝑑 𝑏 then
𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) has no solutions. If 𝑑|𝑏 then 𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) has exactly d incongruent
solutions modulo m.
Corollary: If a and m are relatively prime integers with 𝑚 > 0 and b is an integer then the
linear congruence 𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) has a unique solution modulo m.
Linear Diophantine Equation: Let a, b be integers with (𝑎, 𝑏) = 𝑑. The equation 𝑎𝑥 +
𝑏𝑦 = 𝑐 has no integral solutions if 𝑑 𝑐. If 𝑑|𝑐 then there are many integral solutions.
Ex: 15𝑥 + 6𝑦 = 7
9 = 6(1) + 3
6 = 3(2) + 0
Consider 3 = 9 − 6(1)
= 9 − [15 − 9(1)]
= 9 − 15 + 9
3 = 9(2) − 15
To get 12, multiply both sides with 4
3(4) = 9(2.4) − 15(4)
⇒ 9(8) + 15(4) = 12 which is given by 𝑥0 = 8; 𝑦0 = 4
∴ The complete set of three incongruent solutions are 𝑥 = 𝑥0 ≡ 8(𝑚𝑜𝑑 15)
And 𝑥 = 𝑥0 + 5 ≡ 8 + 5(𝑚𝑜𝑑 15) ≡ 13(𝑚𝑜𝑑 15)
𝑥 = 𝑥0 + 5(2) ≡ 18(𝑚𝑜𝑑 15) ≡ 3(𝑚𝑜𝑑 15)
Note: we can find these solutions by first finding a particular solution and then adding
15
appropriate multiples of =5
3
Modular Inverses:
We now consider congruences of the special form 𝑎𝑥 ≡ 1 (𝑚𝑜𝑑 𝑚), there is a
solution to this congruence if and only if (𝑎, 𝑚) = 1 and then all solutions are congruent
modulo m.
Definition: Given an integer a with (𝑎, 𝑚) = 1, an integer solution 𝑥 of 𝑎𝑥 ≡ 1 (𝑚𝑜𝑑 𝑚) is
called an inverse of a modulo m.
Ex: 7𝑥 ≡ 1 (𝑚𝑜𝑑 31)
Since 7.9 ≡ 1 (𝑚𝑜𝑑 31) then 7−1 = 9(𝑚𝑜𝑑 31)
Then 𝑥 ≡ 1 × 7−1 (𝑚𝑜𝑑 31) ≡ 1 × 9(𝑚𝑜𝑑 31)
𝑥 ≡ 9(𝑚𝑜𝑑 31)
Ex: To find the solutions of 7𝑥 ≡ 22 (𝑚𝑜𝑑 31)
We multiply both sides with 7−1
Then 𝑥 ≡ 22 × 7−1 (𝑚𝑜𝑑 31) ≡ 22 × 9(𝑚𝑜𝑑 31)
⇒ 𝑥 ≡ 198 (𝑚𝑜𝑑 31)
⇒ 𝑥 ≡ 12 (𝑚𝑜𝑑 31)
Example: To find all solutions of 7𝑥 ≡ 4 (𝑚𝑜𝑑 12)
Sol: we note that GCD (7,12) = 1, there is a unique solution modulo 12.
To find this, we need only the linear Diophantine equation, 7𝑥 + 12𝑦 = 4
The Euclidean algorithm gives,
12 = 7(1) + 5
7 = 5(1) + 2
5 = 2(2) + 1
2 = 1(2) + 0
By reverse process, 1 = 5 − 2(2)
= 5 − 2[7 − 5(1)]
= 5 − 2(7) + 2(5)
= 3(5) − 2(7)
= 3[12 − 7(1)] − 2(7)
= 3(12) − 3(7) − 2(7)
∴ 1 = 3(12) − 5(7)
To get 12, multiply both sides with 4
1(4) = 3(12.4) − 5(4)7
⇒ −20(7) + 12(12) = 4 which is given by 𝑥0 = −20; 𝑦0 = 12
Hence all the solutions of the linear congruence are given by 𝑥 = 𝑥0 ≡ −20(𝑚𝑜𝑑 12)
⇒ 𝑥 ≡ −8(𝑚𝑜𝑑 12)
Hence the unique solution is 𝑥 ≡ 4(𝑚𝑜𝑑 12).
Theorem: Let p be prime. The positive integer a is its own inverse modulo p if and only if
𝑎 ≡ 1(𝑚𝑜𝑑 𝑝) (or) 𝑎 ≡ −1(𝑚𝑜𝑑 𝑝)
Problems:
1. Find all solutions of each of the following linear congruences
a) 𝟐𝒙 ≡ 𝟓 (𝒎𝒐𝒅 𝟕)
Sol: we note that GCD (2,7) = 1, and 1|5
∴ There is a unique solution modulo 7.
To find particular solution, we consider the linear Diophantine equation, 2𝑥 + 7𝑦 = 5
The Euclidean algorithm gives,
7 = 3(2) + 1
3 = 3(1) + 0
By reverse process, 1 = 7 − 3(2)
∴ 1 = 7(1) − 3(2)
multiply both sides with 5
5 = 5(7) − 3(5)(2)
⇒ 2(−15) + 7(5) = 5 which is given by 𝑥0 = −15; 𝑦0 = 5
Hence the solution of the linear congruence is 𝑥 = 𝑥0 ≡ −15(𝑚𝑜𝑑 7)
𝑥 ≡ −1(𝑚𝑜𝑑 7)
19 = 2(9) + 1
9 = 9(1) + 0
By reverse process, 1 = 19 − 2(9)
= 19 − [40 − 2(19)]9
= 19 − 9(40) + 18(19)
= −9(40) + 19(19)
∴ 1 = 19(19) + 40(−9)
multiply 30 on both sides
30 = 19(30 × 19) + 40(30 × −9)
⇒ 19(570) + 40(−270) = 30 which is given by 𝑥0 = 570; 𝑦0 = −270
So the solution of the linear congruence is 𝑥 ≡ 𝑥0 (𝑚𝑜𝑑 40)
𝑥 ≡ 570(𝑚𝑜𝑑 40)
31 = 3(10) + 1
10 = 1(10) + 0
By reverse process, 1 = 31 − 3(10)
= 31 − 3[71 − 2(31)]
= 31 − 3(72) + 6(31)
= 7(31) − 3(72)
= 7(103) − 10(72)
= 7(103) − 10[999 − 9(103)]
= 7(103) − 10(999) + 90(103)
= 97(103) − 10(999)
∴ 1 = 103(97) + 999(−10)
multiply 444 on both sides
444 = 103(97 × 444) + 999(−10 × 444)
⇒ 43068(103) + 999(−4440) = 444
∴The particular solution is 𝑥0 = 43068; 𝑦0 = −4440
So the solution of the linear congruence is 𝑥 ≡ 𝑥0 (𝑚𝑜𝑑 999) ≡ 43068(𝑚𝑜𝑑 999)
60 = 1(40) + 20
40 = 2(20) + 0
By reverse process, 20 = 60 − 1(40)
= 60 − 1[100 − 1(60)]
= 2(60) − 1(100)
= 2[260 − 2(100)] − 1(100)
= 2(260) − 5(100)
= 2(260) − 5[360 − 1(260)]
= 7(260) − 5(360)
= 7[620 − 1(360)] − 5(360)
= 7(620) − 12(360)
= 7(620) − 12[980 − 1(620)]
= 19(620) − 12(980)
= 19[1600 − 980] − 12(980)
= 19(1600) − 31(980)
∴ 1 = 980(−31) + 1600(19)
multiply 1500 on both sides
1500 = 980(−31 × 1500) + 1600(19 × 1500)
⇒ −46500(980) + 28500(1600) = 1500 ……(2)
∴ from (1) and (2) The particular solution is 𝑥0 = −46500; 𝑦0 = 28500
So the solution of the linear congruence is 𝑥 ≡ 𝑥0 (𝑚𝑜𝑑 1600)
𝑥 ≡ −46500(𝑚𝑜𝑑 1600)
All possible solutions are given by x ≡ 75 + 80k (mod 1600) where k is an integer such that
0 ≤ k ≤ 19.
10 = 3(3) + 1
3 = 1(3) + 0
By reverse process, 1 = 10 − 3(3)
= 10 − 3[13 − 1(10)]
= 10 − 3(13) + 3(10)
= 4(10) − 3(13)
= 4(23 − 1(13)) − 3(13)
= 4(23) − 7(13)
= 4(23) − 7[105 − 4(23)]
= 4(23) − 7(105) + 28(23)
= 32(23) − 7(105)
= 32[128 − 1(105)] − 7(105)
= 32(128) − 39(105)
= 32(128) − 39[1001 − 7(128)]
= 32(128) − 39(1001) + 273(128)
∴ 1 = 305(128) + 1001(−39)
multiply 833 on both sides
833 = 128(305 × 833) + 1001(−39 × 833)
⇒ 254065(128) + 1001(−32487) = 833
∴The particular solution is 𝑥0 = 254065; 𝑦0 = −32487
So the solution of the linear congruence is 𝑥 ≡ 𝑥0 (𝑚𝑜𝑑 1001)
𝑥 ≡ 254065(𝑚𝑜𝑑 1001)
Sol: To find the inverse of 11, we consider 11𝑥 ≡ 1(𝑚𝑜𝑑 13) ⇒ 𝑥 ≡ 11(𝑚𝑜𝑑 13)
For this we solve the Diophantine equation 11𝑥 + 13𝑦 = 1
From Euclidean algorithm, 13 = 1(11) + 2
11 = 5(2) + 1
2 = 1(2) + 0
∴ 1 = 11 − 5(2)
= 11 − 5[13 − 1(11)]
= 6(11) − 5(13)
1 = 11(6) + 13(−5)
Thus 𝑥 ≡ 6(𝑚𝑜𝑑 13) is a solution
Hence the inverse of 11 (modulo 13) is 6
c) Inverse of 7 modulo 17:
= 2(14 − 1(9)) − 9
1 = 2(14) − 3(9)
This is same as 9(−3) + 14(2) = 1
Thus 𝑥 ≡ −3(𝑚𝑜𝑑 14) ⇒ 𝑥 ≡ 11(𝑚𝑜𝑑 14)
So, the inverse of 9 (modulo 14) is 11.
Similarly, the inverse of 11 is 9
Finally, for a=13, we have to solve 13𝑥 ≡ 1(𝑚𝑜𝑑 14)
We consider Diophantine equation 13𝑥 + 14𝑦 = 1
From Euclidean algorithm, 14 = 1(13) + 1
1 = 13(−1) + 1(14)
we observe that 𝑥 ≡ −1(𝑚𝑜𝑑 14) ≡ 13(𝑚𝑜𝑑 14)
Thus 13 is the inverse of 13 modulo 14.
Hence 1 and 13 have their own inverses
3 and 5 are inverses of each other modulo 14
9 and 11 are inverses of each other modulo 14
Note: The linear congruence in two variables 𝑎𝑥 + 𝑏𝑦 ≡ 𝑐(𝑚𝑜𝑑 𝑚) where a, b, c, m are
integers m>0 with 𝑑 = (𝑎, 𝑏, 𝑚) has exactly dm incongruent solutions if 𝑑|𝑐 and if 𝑑 𝑐
then there are no solutions
∴ 𝑦1 = 2
∴ 𝑦2 = 1
∴ 𝑦3 = 1
Now consider 𝑥 = ∑ 𝑦𝑖 𝑀𝑖 𝑎𝑖 = 𝑦1 𝑀1 𝑎1 + 𝑦2 𝑀2 𝑎2 + 𝑦3 𝑀3 𝑎3
= (2 × 35 × 1) + (1 × 21 × 2) + (1 × 15 × 3) (𝑚𝑜𝑑 105)
= 70 + 42 + 45 (𝑚𝑜𝑑 105)
≡ 157 (𝑚𝑜𝑑 105)
Hence the solution is 𝑥 ≡ 52(𝑚𝑜𝑑 105)
Problems:
Using Chinese Remainder Theorem find all the solutions of the following congruences.
1) 𝑥 ≡ 4(𝑚𝑜𝑑 11); 𝑥 ≡ 3(𝑚𝑜𝑑 17)
2) 𝑥 ≡ 1(𝑚𝑜𝑑 2); 𝑥 ≡ 2(𝑚𝑜𝑑 3); 𝑥 ≡ 3(𝑚𝑜𝑑 5)
3) 𝑥 ≡ 0(𝑚𝑜𝑑 2); 𝑥 ≡ 0(𝑚𝑜𝑑 3); 𝑥 ≡ 1(𝑚𝑜𝑑 5); 𝑥 ≡ 6(𝑚𝑜𝑑 7)
4) 𝑥 ≡ 1(𝑚𝑜𝑑 2); 𝑥 ≡ 2(𝑚𝑜𝑑 3); 𝑥 ≡ 3(𝑚𝑜𝑑 5); 𝑥 ≡ 4(𝑚𝑜𝑑 7); 𝑥 ≡ 5(𝑚𝑜𝑑 11)
Solutions:
3) 𝑥 ≡ 0(𝑚𝑜𝑑 2); 𝑥 ≡ 0(𝑚𝑜𝑑 3); 𝑥 ≡ 1(𝑚𝑜𝑑 5); 𝑥 ≡ 6(𝑚𝑜𝑑 7)
Sol: Here 𝑎1 = 0; 𝑎2 = 0; 𝑎3 = 1; 𝑎4 = 6
we have 𝑀 = 2.3.5.7 = 210
210 210 210 210
𝑀1 = = 105; 𝑀2 = = 70; 𝑀3 = = 42; 𝑀4 = = 30
2 3 5 7
Take 𝑀𝑖 𝑦𝑖 ≡ 1(𝑚𝑜𝑑 𝑛𝑖 )
To determine 𝑦1 , we solve 105𝑦1 ≡ 1(𝑚𝑜𝑑 2)
Let us take Diophantine equation, 105𝑦1 + 2𝑡 = 1…..(1)
From Euclidean algorithm, 105 = 2(102) + 1
∴ 1 = 105 − 2(102)
1 = 105(1) + 2(−102) …..(2)
From (1) & (2) This shows that 𝑦1 ≡ 1(𝑚𝑜𝑑 2)
∴ 𝑦1 = 1
∴ 𝑦2 = 1
To determine 𝑦3 , we solve 42𝑦3 ≡ 1(𝑚𝑜𝑑 5)
Let us take Diophantine equation, 42𝑦3 + 5𝑡 = 1
From Euclidean algorithm, 42 = 5(8) + 2
5 = 2(2) + 1
∴ 1 = 5 − 2(2)
= 5 − 2[42 − 5(8)]
= 5 − 2(42) + 5(16)
1 = 42(−2) + 5(17)
This shows that 𝑦3 ≡ −2(𝑚𝑜𝑑 5) ≡ 3(𝑚𝑜𝑑 5)
∴ 𝑦3 = 3
∴ 𝑦4 = 4
Now consider 𝑥 = ∑ 𝑦𝑖 𝑀𝑖 𝑎𝑖 = 𝑦1 𝑀1 𝑎1 + 𝑦2 𝑀2 𝑎2 + 𝑦3 𝑀3 𝑎3 + 𝑦4 𝑀4 𝑎4
= (1 × 105 × 0) + (1 × 70 × 0) + (3 × 42 × 1) + (4 × 30 × 6) (𝑚𝑜𝑑 210)
= 126 + 720 (𝑚𝑜𝑑 210)
≡ 846 (𝑚𝑜𝑑 210)
Hence the solution is 𝑥 ≡ 6(𝑚𝑜𝑑 210)
2) Find an integer that leaves a remainder 1 when divided by either 2 or 5, but that is divisible
by 3.
Sol: From the given data, 𝑥 ≡ 1(𝑚𝑜𝑑 2); 𝑥 ≡ 1(𝑚𝑜𝑑 5); 𝑥 ≡ 0(𝑚𝑜𝑑 3)
We use Chinese Remainder theorem to solve the given congruences
Here 𝑎1 = 0; 𝑎2 = 1; 𝑎3 = 0
we have 𝑀 = 2.5.3 = 30
30 30 30
𝑀1 = = 15; 𝑀2 = = 6; 𝑀3 = = 10
2 5 3
Take 𝑀𝑖 𝑦𝑖 ≡ 1(𝑚𝑜𝑑 𝑛𝑖 )
To determine 𝑦1 , we solve 15𝑦1 ≡ 1(𝑚𝑜𝑑 2)
Now consider 𝑥 = ∑ 𝑦𝑖 𝑀𝑖 𝑎𝑖 = 𝑦1 𝑀1 𝑎1 + 𝑦2 𝑀2 𝑎2 + 𝑦3 𝑀3 𝑎3
= (1 × 15 × 1) + (1 × 6 × 1) + (1 × 10 × 0) (𝑚𝑜𝑑 30)
= 15 + 6 (𝑚𝑜𝑑 30)
≡ 21 (𝑚𝑜𝑑 30)
Hence 21 is the required integer.
Iterative Method:
There is an iterative method for solving simultaneous system of congruences, we
solve the following. This method is useful when the integers 𝑚1 , 𝑚2 , … , 𝑚𝑟 are not pair wise
relatively prime.
For example,
1. Find the solution to the linear congruences 𝑥 ≡ 1(𝑚𝑜𝑑 5); 𝑥 ≡ 2(𝑚𝑜𝑑 6); 𝑥 ≡ 3(𝑚𝑜𝑑 7)
Sol: From the first congruence, we write 𝑥 = 5𝑡 + 1 where 𝑡 ∈ 𝑍
Substitute this x value in 2 nd congruence
5𝑡 + 1 ≡ 2(𝑚𝑜𝑑6)
⇒ 5𝑡 ≡ 1(𝑚𝑜𝑑 6) …..(1)
To sole this we consider Diophantine equation 5𝑡 + 6𝑥 = 1 …. (2)
From Euclidean algorithm, 6 = 1(5) + 1
⇒ 1 = 6 − 1(5)
⇒ 1 = 5(−1) + 6(1) ….. (3)
From (2) and (3) we get 𝑡 = −1
From (1), ⇒ 𝑡 ≡ −1(𝑚𝑜𝑑 6)
⇒ 𝑡 ≡ 5(𝑚𝑜𝑑 6)
⇒ 𝑡 = 6𝑢 + 5, u is an integer
Since 𝑥 = 5𝑡 + 1 = 5(6𝑢 + 5) + 1
⇒ 𝑥 = 30𝑢 + 26
Substitute this x in the 3rd congruence we get
30𝑢 + 26 ≡ 3(𝑚𝑜𝑑 7)
⇒ 30𝑢 ≡ −23(𝑚𝑜𝑑 7)
⇒ 30𝑢 ≡ −2(𝑚𝑜𝑑 7)
⇒ 30𝑢 ≡ 5(𝑚𝑜𝑑 7) …..(4)
To solve this we consider 30𝑢 + 7𝑦 = 5 …..(5)
From Euclidean algorithm, 30 = 7(4) + 2
⇒ 7 = 3(2) + 1
⇒ 1 = 7 − 3(2) = 7 − 3[30 − 7(4)]
= 7 − 3(30) + 7(12)
1 = 30(−3) + 7(13)
Multiply both sides by 5 we get 30(−15) + 7(65) = 5 ….. (6)
From (5) and (6) we get 𝑢 = −15
From (4), ⇒ 𝑢 ≡ −15(𝑚𝑜𝑑 7)
⇒ 𝑢 ≡ −1(𝑚𝑜𝑑 7)
⇒ 𝑢 ≡ 6(𝑚𝑜𝑑 7)
⇒ 𝑢 = 7𝑣 + 6, v is an integer
Since 𝑥 = 30𝑢 + 26 = 30(7𝑣 + 6) + 26
𝑥 = 210𝑣 + 206
Translating this equality into congruence 𝑥 ≡ 206(𝑚𝑜𝑑 210) is a solution
2. Find an integer that leaves a remainder of 2 when divided by either 3 or 5 but that is
divisible by 4.
Sol: From the data we have 𝑥 ≡ 2(𝑚𝑜𝑑 3); 𝑥 ≡ 2(𝑚𝑜𝑑 5); 𝑥 ≡ 0(𝑚𝑜𝑑 4)
Since the moduli are not relatively prime, so we use iterative method to solve
From 3rd congruence, 𝑥 = 4𝑘
Place this x value in 2 nd congruence,
4𝑘 ≡ 2(𝑚𝑜𝑑 5) …..(1)
To sole this we consider, 4𝑘 + 5𝑡 = 2 …..(2)
From Euclidean algorithm, 5 = 1(4) + 1
⇒ 1 = 5 − 1(4)
⇒ 1 = 4(−1) + 5(1)
Multiply both sides with 2 we get 2 = 4(−2) + 5(2) …..(3)
From (2) and (3) we get 𝑘 = −2
From (1), 𝑘 ≡ −2(𝑚𝑜𝑑 5) ≡ 3(𝑚𝑜𝑑 5)
⇒ 𝑘 = 5𝑢 + 3
Since 𝑥 = 4𝑘 = 4(5𝑢 + 3) = 20𝑢 + 12
Substitute this x value in 1 st congruence we get
20𝑢 + 12 ≡ 2(𝑚𝑜𝑑 3)
⇒ 20𝑢 ≡ −10(𝑚𝑜𝑑 3)
⇒ 20𝑢 ≡ −1(𝑚𝑜𝑑 3)
⇒ 20𝑢 ≡ 2(𝑚𝑜𝑑 3)
⇒ 10𝑢 ≡ 1(𝑚𝑜𝑑 3) …..(4)
To sole this we consider, 10𝑢 + 3𝑡 = 1 …..(5)
From Euclidean algorithm, 10 = 3(3) + 1
⇒ 1 = 10 − 3(3)
⇒ 1 = 10(1) + 3(−3) ……(6)
From (5) and (6) we get 𝑢 = 1
From (4), 𝑢 ≡ 1(𝑚𝑜𝑑 3)
⇒ 𝑢 = 3𝑡 + 1
Since 𝑥 = 20𝑢 + 12 = 20(3𝑡 + 1) + 12 = 60𝑢 + 32
𝑥 = 60𝑢 + 32
We write into congruence form 𝑥 ≡ 32(𝑚𝑜𝑑 60)
Hence 32 is such number.
3. Find an integer that leaves a remainder 9 when it is divided by either 10 or 11 but that is
divisible by 13.
Sol: From the data we have 𝑥 ≡ 9(𝑚𝑜𝑑 10); 𝑥 ≡ 9(𝑚𝑜𝑑 11); 𝑥 ≡ 0(𝑚𝑜𝑑 13)
Since the moduli are not relatively prime, so we use iterative method to solve
From 3rd congruence, 𝑥 = 3𝑘
Place this x value in 2 nd congruence,
13𝑘 ≡ 9(𝑚𝑜𝑑 11) …..(1)
To sole this we consider, 13𝑘 + 11𝑡 = 9 …..(2)
From Euclidean algorithm, 13 = 1(11) + 2
11 = 5(2) + 1
⇒ 1 = 11 − 5(2)
= 11 − 5[13 − 1(11)]
= 11 − 5(13) + 5(11)
= 13(−5) + 11(6)
⇒ 1 = 13(−5) + 11(6)
Multiply both sides with 9 we get 9 = 13(−45) + 11(54) …..(3)
From (2) and (3) we get 𝑘 = −45
From (1), 𝑘 ≡ −45(𝑚𝑜𝑑 11) ≡ −1(𝑚𝑜𝑑 11) ≡ 10(𝑚𝑜𝑑 11)
⇒ 𝑘 = 11𝑢 + 10
Since 𝑥 = 13𝑘 = 13(11𝑢 + 10) = 143𝑢 + 130
Substitute this x value in 1 st congruence we get
143𝑢 + 130 ≡ 9(𝑚𝑜𝑑 10)
⇒ 143𝑢 ≡ −121(𝑚𝑜𝑑 10)
⇒ 143𝑢 ≡ −1(𝑚𝑜𝑑 10)
⇒ 143𝑢 ≡ 9(𝑚𝑜𝑑 10) …..(4)
To sole this we consider, 143𝑢 + 10𝑦 = 9 …..(5)
From Euclidean algorithm, 143 = 10(14) + 3
10 = 3(3) + 1
⇒ 1 = 10 − 3(3)
= 10 − 3[143 − 10(14)]
= 143(−3) + 10 + 10(42)
⇒ 1 = 143(−3) + 10(43)
Multiply both sides with 9 we get 143(−27) + 10(387) = 9 ……(6)
From (5) and (6) we get 𝑢 = −27
From (4), 𝑢 ≡ −27(𝑚𝑜𝑑 10) ≡ −7(𝑚𝑜𝑑 10) ≡ 3(𝑚𝑜𝑑 10)
∴ 𝑢 ≡ 3(𝑚𝑜𝑑 10)
⇒ 𝑢 = 10𝑡 + 3
Since 𝑥 = 143𝑢 + 130 = 143(10𝑡 + 3) + 130 = 1430𝑢 + 429 + 130
𝑥 = 1430𝑢 + 559
We write into congruence form 𝑥 ≡ 559(𝑚𝑜𝑑 1430)
Hence 559 is such number.
Note: 1) If 𝒙 ≡ 𝒂𝟏 (𝒎𝒐𝒅 𝒎𝟏 ); 𝒙 ≡ 𝒂𝟐 (𝒎𝒐𝒅 𝒎𝟐 ) has a solution iff (𝒎𝟏 , 𝒎𝟐 )|(𝒂𝟏 − 𝒂𝟐 ).
If there is a solution then write 𝒙 as 𝒙 = 𝒂𝟏 + 𝒌𝒎𝟏 , 𝒌 ∈ 𝒁 and then insert this into 2nd
congruence.
⇒ 𝑦 ≡ 11 × 7(𝑚𝑜𝑑 13)
∴ 𝑦 ≡ 11 × 2(𝑚𝑜𝑑 13) ≡ 22(𝑚𝑜𝑑 13)
𝑦 ≡ 9(𝑚𝑜𝑑 13)
Hence the solution of this system of congruences are 𝑥 ≡ 7(𝑚𝑜𝑑 13) 𝑦 ≡ 9(𝑚𝑜𝑑 13)
Theorem: Let a, b, c, d, e, f and m be integers with 𝑚 > 0 and (𝑎𝑑 − 𝑏𝑐, 𝑚) = 1 i.e.,
(∆, 𝑚) = 1. Then the system of congruences 𝑎𝑥 + 𝑏𝑦 ≡ 𝑒(𝑚𝑜𝑑 𝑚); 𝑐𝑥 + 𝑑𝑦 ≡ 𝑓(𝑚𝑜𝑑 𝑚)
Has a unique solution modulo m given by
𝑥 ≡ ∆(𝑑𝑒 − 𝑏𝑓) (𝑚𝑜𝑑 𝑚); 𝑦 ≡ ∆(𝑎𝑓 − 𝑐𝑒) (𝑚𝑜𝑑 𝑚), where ∆ is an inverse of ∆ modulo m.
To study system of n linear congruences involving n unknowns, it is helpful to use the
language of matrices. Before we proceed, we need to define congruences of matrices.
Definition: Let A and B be 𝑛 × 𝑘 matrices with integer entries 𝑎𝑖𝑗 , 𝑏𝑖𝑗 respectively. We say
that A is congruent to B modulo m if 𝑎𝑖𝑗 ≡ 𝑏𝑖𝑗 (𝑚𝑜𝑑 𝑚) for 1 ≤ 𝑖 ≤ 𝑛; 1 ≤ 𝑗 ≤ 𝑘, we write
𝐴 ≡ 𝐵(𝑚𝑜𝑑 𝑚).
15 3 ] [ 4 3]
We consider [ ≡ (𝑚𝑜𝑑 11)
8 12 −3 1
4 3
≡[ ] (𝑚𝑜𝑑 11)
8 1
Theorem: If A and B be 𝑛 × 𝑘 matrices with 𝐴 ≡ 𝐵(𝑚𝑜𝑑 𝑚), C is a 𝑘 × 𝑝 matrix and D is a
𝑝 × 𝑛 matrix with all integer entries then 𝐴𝐶 ≡ 𝐵𝐶 (𝑚𝑜𝑑 𝑚) and 𝐷𝐴 ≡ 𝐷𝐵(𝑚𝑜𝑑 𝑚)
Now let us consider the system of congruences
𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 ≡ 𝑏1 (𝑚𝑜𝑑 𝑚)
𝑎12 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 ≡ 𝑏2 (𝑚𝑜𝑑 𝑚)
… ….. ….. …. ….. ….. ….. ….. …. …..
… ….. ….. …. ….. ….. ….. ….. …. …..
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 ≡ 𝑏𝑛 (𝑚𝑜𝑑 𝑚)
𝑎11 𝑎12 … 𝑎1𝑛
𝑎12 𝑎22 … 𝑎2𝑛
Using matrix notation, we write 𝐴𝑋 ≡ 𝐵(𝑚𝑜𝑑 𝑚) where 𝐴 = [ … … … … ]
𝑎𝑛1 𝑎𝑛2 … 𝑎𝑛𝑛
𝑥1 𝑏1
𝑥2 𝑏
𝑋 = […] 𝐵 = [ 2]
…
𝑥𝑛 𝑏𝑛
The system 3𝑥 + 4𝑦 ≡ 5(𝑚𝑜𝑑 13)
2𝑥 + 5𝑦 ≡ 7(𝑚𝑜𝑑 13)
3 4 𝑥
can be written as [ ] [𝑦 ] = [5] (𝑚𝑜𝑑 13)
2 5 7
we now develop a method for solving congruences of the form 𝐴𝑋 ≡ 𝐵(𝑚𝑜𝑑 𝑚). This method
is based on finding a matrix 𝐴 such that 𝐴. 𝐴 ≡ 𝐼(𝑚𝑜𝑑 𝑚) where I is the identity matrix.
≡ −6(𝑚𝑜𝑑 7) ≡ 1(𝑚𝑜𝑑 7)
(−5) × 4(𝑚𝑜𝑑 7) ≡ 1(𝑚𝑜𝑑 7)
Thus 𝐴 = ∆(𝑎𝑑𝑗𝐴)(𝑚𝑜𝑑 7)
−2 −3 5
𝐴 = 4 [−5 0 10 ] (𝑚𝑜𝑑 7)
4 1 −10
−8 −12 20
≡ [−20 0 40 ] (𝑚𝑜𝑑 7)
16 4 −40
−1 −5 6
≡ [−6 0 5 ] (𝑚𝑜𝑑 7)
2 4 −5
6 2 6
Hence 𝐴 ≡ [1 0 5] (𝑚𝑜𝑑 7) is the inverse of A
2 4 2
We can use an inverse of A modulo m to solve the system 𝐴𝑋 ≡ 𝐵(𝑚𝑜𝑑 𝑚) where
𝐺𝐶𝐷 (𝑑𝑒𝑡𝐴, 𝑚) = 1 .
𝐴(𝐴𝑋) ≡ 𝐴𝐵(𝑚𝑜𝑑 𝑚)
⇒ 𝑋 ≡ 𝐴𝐵(𝑚𝑜𝑑 𝑚) is the solution of the given system of congruences.
Example: We consider the system of congruences
2𝑥 + 5𝑦 + 6𝑧 ≡ 3(𝑚𝑜𝑑 7); 2𝑥 + 𝑧 ≡ 4(𝑚𝑜𝑑 7); 𝑥 + 2𝑦 + 3𝑧 ≡ 1(𝑚𝑜𝑑7)
2 5 6 𝑥 3
This is equivalent to the matrix congruence [2 0 1] [𝑦 ] = [4] (𝑚𝑜𝑑 7)
1 2 3 𝑧 1
2 5 6 6 2 6
From the last example the inverse of [2 0 1] is [1 0 5] modulo 7
1 2 3 2 4 2
Thus the solution is 𝑋 ≡ 𝐴𝐵(𝑚𝑜𝑑 𝑚)
𝑥 6 2 6 3 32 4
⇒ [𝑦 ] ≡ [1 0 5] [4] (𝑚𝑜𝑑 7) ≡ [ 8 ] (𝑚𝑜𝑑 7) ≡ [1] (𝑚𝑜𝑑 7)
𝑧 2 4 2 1 24 3
4
Hence the solution of the given congruence is 𝑋 ≡ [1] (𝑚𝑜𝑑 7)
3
Problems:
1) Find the solutions of the following systems of linear congruences
a) Solve 𝑥 + 2𝑦 ≡ 1(𝑚𝑜𝑑 5); 2𝑥 + 𝑦 ≡ 1(𝑚𝑜𝑑 5)
Sol: Given system of congruences are 𝑥 + 2𝑦 ≡ 1(𝑚𝑜𝑑 5) ….. (1)
2𝑥 + 𝑦 ≡ 1(𝑚𝑜𝑑 5) ….. (2)
Multiply (1) with 2 and subtracting from (2) we get
2𝑥 + 4𝑦 ≡ 2(𝑚𝑜𝑑 5)
2𝑥 + 𝑦 ≡ 1(𝑚𝑜𝑑 5)
From (3)-(4), we get 3𝑦 ≡ 1(𝑚𝑜𝑑 5)
⇒ 𝑦 ≡ 1 × 3(𝑚𝑜𝑑 5) ….(3)
⇒ 𝑦 ≡ 2(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 2(𝑚𝑜𝑑 5)
Hence the unique solution is 𝑥 ≡ 2(𝑚𝑜𝑑 5); 𝑦 ≡ 2(𝑚𝑜𝑑 5)
b) Solve 𝑥 + 3𝑦 ≡ 1(𝑚𝑜𝑑 5); 3𝑥 + 4𝑦 ≡ 2(𝑚𝑜𝑑 5)
Sol: Given system of congruences are 𝑥 + 3𝑦 ≡ 1(𝑚𝑜𝑑 5) ….. (1)
3𝑥 + 4𝑦 ≡ 2(𝑚𝑜𝑑 5) ….. (2)
Multiply (1) with 3 and subtracting from (2) we get
3𝑥 + 9𝑦 ≡ 3(𝑚𝑜𝑑 5)
3𝑥 + 4𝑦 ≡ 2(𝑚𝑜𝑑 5)
On subtracting we get 5𝑦 ≡ 1(𝑚𝑜𝑑 5)
This is not possible because (5,5) = 5 ≠ 1
The system has no solution.
c) Solve 4𝑥 + 𝑦 ≡ 2(𝑚𝑜𝑑 5); 2𝑥 + 3𝑦 ≡ 1(𝑚𝑜𝑑 5)
Sol: Given system of congruences are 4𝑥 + 𝑦 ≡ 2(𝑚𝑜𝑑 5) ….. (1)
2𝑥 + 3𝑦 ≡ 1(𝑚𝑜𝑑 5) ….. (2)
Multiply (2) with 2 and subtracting we get
4𝑥 + 6𝑦 ≡ 2(𝑚𝑜𝑑 5)
4𝑥 + 𝑦 ≡ 2(𝑚𝑜𝑑 5)
we get 5𝑦 ≡ 0(𝑚𝑜𝑑 5)
The solutions to this are all values of y
i.e., 𝑦 = 0,1,2,3 (or) 4(𝑚𝑜𝑑 5)
put 𝑦 = 0 then from (1), 4𝑥 ≡ 2(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 2 × 4(𝑚𝑜𝑑 5) ….(3)
⇒ 𝑥 ≡ 3(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 1 × 4(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 1 × 4(𝑚𝑜𝑑 5) since 4−1 = 4
𝑥 ≡ 4(𝑚𝑜𝑑 5)
put 𝑦 = 2 then from (1), 4𝑥 + 2 ≡ 2(𝑚𝑜𝑑 5)
4𝑥 ≡ 0(𝑚𝑜𝑑 5)
𝑥 ≡ 0(𝑚𝑜𝑑 5)
𝑥 ≡ 1(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 3 × 4(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 3 × 4(𝑚𝑜𝑑 5) since 4−1 = 4
⇒ 𝑥 ≡ 12(𝑚𝑜𝑑 5)
𝑥 ≡ 2(𝑚𝑜𝑑 5)
𝑥 ≡ 3(𝑚𝑜𝑑 7)
𝑥 ≡ 5(𝑚𝑜𝑑 7)
𝑦 ≡ 4(𝑚𝑜𝑑 5)
⇒ 𝑧 ≡ 4(𝑚𝑜𝑑 5)
𝑦 ≡ 4(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 3(𝑚𝑜𝑑 5)
if 𝑧 = 1 then 2𝑥 + 1 ≡ 1(𝑚𝑜𝑑 5)
⇒ 2𝑥 ≡ 0(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 0(𝑚𝑜𝑑 5)
if 𝑧 = 2 then 2𝑥 + 2 ≡ 1(𝑚𝑜𝑑 5)
⇒ 2𝑥 ≡ −1(𝑚𝑜𝑑 5)
⇒ 2𝑥 ≡ 4(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 2(𝑚𝑜𝑑 5)
if 𝑧 = 3 then 2𝑥 + 3 ≡ 1(𝑚𝑜𝑑 5)
⇒ 2𝑥 ≡ −2(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ −1(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 4(𝑚𝑜𝑑 5)
⇒ 𝑥 ≡ 1(𝑚𝑜𝑑 5)