Module 4: Modular Arithmetic
4.1 Congruence
Introduction:
Divisibility:
Consider two integers 𝑎 and 𝑏. Where 𝑎 ≠ 0.
𝑎 divides 𝑏 (𝑎|𝑏) if there exists 𝑘 such that 𝑏 = 𝑘𝑎.
Example: 3|24, 5| − 35, 4 ∤ 25, 6 ∤ −20
Division algorithm:
Consider two numbers 𝑎 and 𝑏. Where 𝑎 ≠ 0.
Two unique numbers 𝑞 and 𝑟 can always be found such that 𝑏 = 𝑎𝑞 + 𝑟, 0 ≤ 𝑟 < 𝑎.
This is known as division algorithm. Where 𝑞 is quotient and 𝑟 is remainder.
Example: 85 = 11(7) + 8, 43 = 10(4) + 3, −25 = 4(−7) + 3
(Remainder is always positive.)
Greatest common divisor:
G.C.D. of two integers 𝑎 and 𝑏 is a unique positive integer 𝑑 such that
(i) 𝑑|𝑎 and 𝑑|𝑏 (ii) If 𝑥|𝑎 and 𝑥|𝑏 then 𝑥|𝑑.
Congruence:
𝑎 is congruent to 𝑏 modulo 𝑚 [ 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚)] if and only if 𝑚|(𝑎 − 𝑏)
Example: 25 ≡ 3 (𝑚𝑜𝑑 11)
25 − 3 ≡ 0 (𝑚𝑜𝑑 11)
22 ≡ 0 (𝑚𝑜𝑑 11)
That means 11|22 (11 divides 22).
Maths dept. Dr. HNNCE, Bengaluru-70
1
1. Find the unit digit or the last digit in the following numbers:
(i) 𝟕𝟏𝟏𝟖 (ii) 𝟕𝟐𝟎𝟏𝟑 (iii) 𝟕𝟐𝟖𝟗 (iv) 𝟕𝟔𝟎𝟎𝟑
(i) 74 ≡ 1 (𝑚𝑜𝑑 10)
7118 ≡ 74(29)+2 (𝑚𝑜𝑑 10)
≡ (74 )29 × 72 (𝑚𝑜𝑑 10)
≡ 129 × 49 (𝑚𝑜𝑑 10)
≡ 9 (𝑚𝑜𝑑 10)
Therefore, the unit digit of the given number is 9.
(ii) 74 ≡ 1 (𝑚𝑜𝑑 10)
72013 ≡ 74(503)+1 (𝑚𝑜𝑑 10)
≡ (74 )503 × 7 (𝑚𝑜𝑑 10
≡ 1503 × 7 (𝑚𝑜𝑑 10)
≡ 1 × 7 (𝑚𝑜𝑑 10)
≡ 7 (𝑚𝑜𝑑 10)
Therefore, the unit digit of the given number is 7.
(iii) 74 ≡ 1 (𝑚𝑜𝑑 10)
7289 ≡ 74(72)+1 (𝑚𝑜𝑑 10)
≡ (74 )72 × 7 (𝑚𝑜𝑑 10)
≡ 172 × 7 (𝑚𝑜𝑑 10)
≡ 1 × 7 (𝑚𝑜𝑑 10)
≡ 7 (𝑚𝑜𝑑 10)
Therefore, the unit digit of the given number is 7.
(iv) 74 ≡ 1 (𝑚𝑜𝑑 10)
76003 ≡ 74(1500)+3 (𝑚𝑜𝑑 10)
≡ (74 )1500 × 73 (𝑚𝑜𝑑 10)
≡ 11500 × 73 (𝑚𝑜𝑑 10)
≡ 1 × 343 (𝑚𝑜𝑑 10)
≡ 3 (𝑚𝑜𝑑 10)
Therefore, the unit digit of the given number is 3.
Maths dept. Dr. HNNCE, Bengaluru-70
2
2. Find the unit digit or the last digit in the following numbers:
(i) 𝟐𝟏𝟐𝟔 (ii) 𝟒𝟑𝟕 (iii) 𝟖𝟐𝟎𝟓 (iv) 𝟔𝟒𝟔𝟓
(i) 24 ≡ 6 (𝑚𝑜𝑑 10)
2126 ≡ 24(31)+2 (𝑚𝑜𝑑 10)
≡ (24 )31 × 4 (𝑚𝑜𝑑 10)
≡ 631 × 4 (𝑚𝑜𝑑 10)
≡ 6 × 4 (𝑚𝑜𝑑 10)
≡ 24 (𝑚𝑜𝑑 10)
≡ 4 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 4.
(ii) 42 ≡ 6(𝑚𝑜𝑑 10)
437 ≡ 42(18)+1 (𝑚𝑜𝑑 10)
≡ (42 )18 × 4 (𝑚𝑜𝑑 10)
≡ 618 × 4 (𝑚𝑜𝑑 10)
≡ 6 × 4 (𝑚𝑜𝑑 10)
≡ 24 (𝑚𝑜𝑑 10)
≡ 4 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 4.
(iii) 84 ≡ 6(𝑚𝑜𝑑 10)
8205 ≡ 84(51)+1 (𝑚𝑜𝑑 10)
≡ (84 )51 × 8 (𝑚𝑜𝑑 10)
≡ 651 × 8 (𝑚𝑜𝑑 10)
≡ 6 × 8 (𝑚𝑜𝑑 10)
≡ 48 (𝑚𝑜𝑑 10)
≡ 8 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 8.
Maths dept. Dr. HNNCE, Bengaluru-70
3
(iv) 642 ≡ 6 (𝑚𝑜𝑑 10)
6465 ≡ 642(32)+1 (𝑚𝑜𝑑 10)
≡ 642(32) × 64 (𝑚𝑜𝑑 10)
≡ (642 )32 × 64
≡ 632 × 64 (𝑚𝑜𝑑 10)
≡ 6 × 64 (𝑚𝑜𝑑 10)
≡ 134 (𝑚𝑜𝑑 10)
≡ 4 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 4.
3. Find the unit digit or the last digit in the following numbers:
(i) 𝟑𝟐𝟏𝟑𝟎 (ii) 𝟗𝟐𝟎𝟎 (iii) 𝟏𝟑𝟑𝟕 (iv) 𝟔𝟐𝟓𝟒
(i) 34 ≡ 1 (𝑚𝑜𝑑 10
32130 ≡ 34(532)+2 (𝑚𝑜𝑑 10)
≡ (34 )532 × 32 (𝑚𝑜𝑑 10)
≡ 1532 × 9 (𝑚𝑜𝑑 10)
≡ 1 × 9 (𝑚𝑜𝑑 10)
≡ 9 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 9.
(ii) 92 ≡ 1(𝑚𝑜𝑑 10)
9200 ≡ (92 )100 (𝑚𝑜𝑑 10)
≡ 1100 (𝑚𝑜𝑑 10)
≡ 1 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 1.
(iii) 134 ≡ 1 (𝑚𝑜𝑑 10)
1337 ≡ 134(9)+1 (𝑚𝑜𝑑 10)
≡ (134 )9 × 13 (𝑚𝑜𝑑 10)
≡ 19 × 13 (𝑚𝑜𝑑 10)
≡ 13 (𝑚𝑜𝑑 10)
≡ 3 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 3.
Maths dept. Dr. HNNCE, Bengaluru-70
4
(iv) 62 ≡ 6 (𝑚𝑜𝑑 10)
6254 ≡ (62 )127 (𝑚𝑜𝑑 10)
≡ 6127 (𝑚𝑜𝑑 10)
≡ 6 (𝑚𝑜𝑑 10)
Therefore, the remainder of the given number is 6.
4. Find the remainder when 𝟏𝟕𝟓 × 𝟏𝟏𝟑 × 𝟓𝟑 is divided by 11.
175 ≡ −1 (𝑚𝑜𝑑 11)
113 ≡ 3 (𝑚𝑜𝑑 11)
53 ≡ −2 (𝑚𝑜𝑑 11)
175 × 113 × 53 ≡ (−1) × 3 × (−2) (𝑚𝑜𝑑 11)
175 × 113 × 53 ≡ 6 (𝑚𝑜𝑑 11)
Therefore, the remainder is 6.
5. Find the remainder when 𝟑𝟒𝟗 × 𝟕𝟒 × 𝟑𝟔 is divided by 3.
349 ≡ 1 (𝑚𝑜𝑑 3)
74 ≡ 2 (𝑚𝑜𝑑 3)
36 ≡ 0 (𝑚𝑜𝑑 3)
349 × 74 × 36 ≡ 1 × 2 × 0 (𝑚𝑜𝑑 3)
349 × 74 × 36 ≡ 0 (𝑚𝑜𝑑 3)
Therefore, the remainder is 0.
6. Find the remainder when 𝟔𝟒 × 𝟔𝟓 × 𝟔𝟔 is divided by 67.
64 ≡ −3 (𝑚𝑜𝑑 67)
65 ≡ −2 (𝑚𝑜𝑑 67)
66 ≡ −1 (𝑚𝑜𝑑 67)
64 × 65 × 66 ≡ (−3) × (−2) × (−1) (𝑚𝑜𝑑 67)
64 × 65 × 66 ≡ −6 (𝑚𝑜𝑑 67)
64 × 65 × 66 ≡ 61 (𝑚𝑜𝑑 67)
Therefore, the remainder is 61.
Maths dept. Dr. HNNCE, Bengaluru-70
5
7. Find the remainder when 𝟏𝟑𝟓 × 𝟕𝟒 × 𝟒𝟖 is divided by 7.
135 ≡ 2 (𝑚𝑜𝑑 7)
74 ≡ −3 (𝑚𝑜𝑑 7)
48 ≡ −1 (𝑚𝑜𝑑 7)
135 × 74 × 48 ≡ 2 × (−3) × (−1) (𝑚𝑜𝑑 7)
135 × 74 × 48 ≡ 6 (𝑚𝑜𝑑 7)
Therefore, the remainder is 6.
8. What is the remainder when 𝟐𝟐𝟑 is divided by 𝟒𝟕?
28 ≡ 21 (𝑚𝑜𝑑 47)
28 × 28 × 27 ≡ 21 × 21 × 128 (𝑚𝑜𝑑 47)
223 ≡ 441 × 128 (𝑚𝑜𝑑 47)
≡ 18 × 34 (𝑚𝑜𝑑 47)
≡ 612 (𝑚𝑜𝑑 47), 13 × 47 = 611
≡ 1 (𝑚𝑜𝑑 47)
4.2 Fermat’s little theorem
If 𝑝 is a prime number and (𝑎, 𝑝) = 1 then 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
1. Find the least positive remainder when 𝟐𝟑𝟎𝟏 is divided by 5.
5 is a prime number and (𝑎, 𝑝) = (2, 5) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 2, 𝑝 = 5 we get 24 ≡ 1 (𝑚𝑜𝑑 5)
Therefore,
2301 ≡ 24(75)+1 (𝑚𝑜𝑑 5)
≡ (24 )75 × 2 (𝑚𝑜𝑑 5)
≡ 175 × 2 (𝑚𝑜𝑑 5)
≡ 1 × 2 (𝑚𝑜𝑑 5)
≡ 2 (𝑚𝑜𝑑 5)
The remainder of the given number is 2.
Maths dept. Dr. HNNCE, Bengaluru-70
6
2. Find the remainder when 𝟐𝟏𝟎𝟎𝟎 is divided by 𝟏𝟑.
13 is a prime number and (𝑎, 𝑝) = (2, 13) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 2, 𝑝 = 13 we get 212 ≡ 1 (𝑚𝑜𝑑 13)
Therefore,
21000 ≡ 212(83)+4
≡ (212 )83 × 24 (𝑚𝑜𝑑 13)
≡ 183 × 16(𝑚𝑜𝑑 13)
≡ 1 × 16 (𝑚𝑜𝑑 13)
≡ 16 (𝑚𝑜𝑑 13)
≡ 3(𝑚𝑜𝑑 13)
Therefore, the remainder is 3.
3. What is remainder in the division of 𝟐𝟓𝟎 by 𝟕?
7 is a prime number and (𝑎, 𝑝) = (2, 7) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 2, 𝑝 = 7 we get 26 ≡ 1 (𝑚𝑜𝑑 7)
Therefore,
250 ≡ 26(8)+2 (𝑚𝑜𝑑 7)
≡ (26 )8 × 22 (𝑚𝑜𝑑 7)
≡ 18 × 4 (𝑚𝑜𝑑 7)
≡ 1 × 4 (𝑚𝑜𝑑 7)
≡ 4 (𝑚𝑜𝑑 7)
The remainder is 4.
4. Show that 𝟖𝟑𝟎 − 𝟏 is divisible by 𝟑𝟏.
31 is a prime number and (𝑎, 𝑝) = (8, 31) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 8, 𝑝 = 31 we get 830 ≡ 1(𝑚𝑜𝑑 31)
Therefore, 830 − 1 is divisible by 31.
Maths dept. Dr. HNNCE, Bengaluru-70
7
5. Find the remainder when 𝟕𝟐𝟏𝟎𝟎𝟏 is divided by 𝟑𝟏.
31 is a prime number and (𝑎, 𝑝) = (72, 31) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 72, 𝑝 = 31 we get 7230 ≡ 1(𝑚𝑜𝑑 31)
Therefore,
721001 ≡ 7230(33)+11 (𝑚𝑜𝑑 31)
≡ (7230 )33 × 7211 (𝑚𝑜𝑑 31)
≡ 133 × 1011 (𝑚𝑜𝑑 31)
≡ 1 × 103 × 103 × 103 × 102 (𝑚𝑜𝑑 31)
≡ 1 × 8 × 8 × 8 × 7 (𝑚𝑜𝑑 31)
≡ 64 × 56 (𝑚𝑜𝑑 31)
≡ 2 × 25 (𝑚𝑜𝑑 31)
≡ 19 (𝑚𝑜𝑑 31)
The remainder is 19.
6. Find the remainder when 𝟒𝟏𝟕𝟓 is divided by 𝟑.
3 is a prime number and (𝑎, 𝑝) = (41, 3) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 72, 𝑝 = 31 we get 412 ≡ 1(𝑚𝑜𝑑 3)
Therefore,
4175 ≡ 412(37)+1 (𝑚𝑜𝑑 3)
≡ (412 )37 × 41 (𝑚𝑜𝑑 3)
≡ 137 × 41 (𝑚𝑜𝑑 3)
≡ 1 × 2 (𝑚𝑜𝑑 3)
≡ 2 (𝑚𝑜𝑑 3)
The remainder is 2.
Maths dept. Dr. HNNCE, Bengaluru-70
8
7. Find the remainder when 𝟓𝟏𝟏 is divided by 𝟕.
7 is a prime number and (𝑎, 𝑝) = (5, 7) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 5, 𝑝 = 7 we get 56 ≡ 1(𝑚𝑜𝑑 7)
Therefore,
511 ≡ 56 × 55 (𝑚𝑜𝑑 7)
≡ 1 × 52 × 52 × 5(𝑚𝑜𝑑 7)
≡ 1 × 4 × 4 × 5 (𝑚𝑜𝑑 7)
≡ 80 (𝑚𝑜𝑑 7)
≡ 3 (𝑚𝑜𝑑 7)
Therefore, the remainder is 3.
8. Find the remainder when 𝟔𝟔𝟎𝟎 is divided by 𝟑𝟕.
37 is a prime number and (𝑎, 𝑝) = (6, 37) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 6, 𝑝 = 37 we get 636 ≡ 1(𝑚𝑜𝑑 37)
Therefore,
6600 ≡ 636(16)+24 (𝑚𝑜𝑑 37)
≡ 116 × 624 (𝑚𝑜𝑑 37)
≡ 1 × (62 )12 (𝑚𝑜𝑑 37)
≡ (−1)12 (𝑚𝑜𝑑 7)
≡ 1 (𝑚𝑜𝑑 7)
Therefore, the remainder is 1.
Maths dept. Dr. HNNCE, Bengaluru-70
9
9. Find the remainder when 𝟕𝟐𝟎𝟎 is divided by 𝟐𝟑.
23 is a prime number and (𝑎, 𝑝) = (7, 23) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 7, 𝑝 = 23 we get 722 ≡ 1(𝑚𝑜𝑑 23)
Therefore,
7200 ≡ 722(9)+2 (𝑚𝑜𝑑 23)
≡ 7198 × 72 (𝑚𝑜𝑑 23)
≡ 1198 × 49 (𝑚𝑜𝑑 23)
≡ 1 × 49 (𝑚𝑜𝑑 23)
≡ 49 (𝑚𝑜𝑑 23)
≡ 3 (𝑚𝑜𝑑 23)
Therefore, the remainder is 3.
10. Find the remainder when 𝟑𝟏𝟎𝟎𝟎𝟎𝟎 is divided by 𝟓𝟑.
53 is a prime number and (𝑎, 𝑝) = (3, 53) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 3, 𝑝 = 53 we get 352 ≡ 1 (𝑚𝑜𝑑 53)
Therefore,
3100000 ≡ 352(1923)+4
≡ (352 )1923 × 34
≡ 11923 × 34 (𝑚𝑜𝑑 53)
≡ 1 × 34 (𝑚𝑜𝑑 53)
≡ 1 × 81(𝑚𝑜𝑑 53)
≡ 28 (𝑚𝑜𝑑 53)
The remainder is 28.
Maths dept. Dr. HNNCE, Bengaluru-70
10
11. Find the remainder when 𝟐𝟒𝟏𝟗𝟒𝟕 is divided by 𝟏𝟕.
17 is a prime number and (𝑎, 𝑝) = (24, 17) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 24, 𝑝 = 17 we get 2416 ≡ 1 (𝑚𝑜𝑑 17)
Therefore,
241947 ≡ 2416(121)+11 (𝑚𝑜𝑑 17)
≡ 1121 × 2411 (𝑚𝑜𝑑 17)
≡ 1 × 2411 (𝑚𝑜𝑑 17)
≡ 2411 (𝑚𝑜𝑑 17)
≡ 711 (𝑚𝑜𝑑 17)
≡ (72 )5 × 7 (𝑚𝑜𝑑 17)
≡ (−2)5 × 7 (𝑚𝑜𝑑 17)
≡ −32 × 7 (𝑚𝑜𝑑 17)
≡ −32 × 7 (𝑚𝑜𝑑 17)
≡ −15 × 7 (𝑚𝑜𝑑 17)
≡ 2 × 7 (𝑚𝑜𝑑 17)
Therefore, the remainder is 14.
12. Find the remainder when 𝟏𝟑𝟓𝟓 is divided by 𝟏𝟕.
17 is a prime number and (𝑎, 𝑝) = (13, 17) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 13, 𝑝 = 17 we get 1316 ≡ 1(𝑚𝑜𝑑 17)
Therefore,
1355 ≡ 1316(3)+7 (𝑚𝑜𝑑 17)
≡ (1316 )3 × 137
≡ 13 × (132 )3 × 13 (𝑚𝑜𝑑 17)
≡ (−1)3 × (−4) (𝑚𝑜𝑑 17)
≡ 4 (𝑚𝑜𝑑 17)
The remainder is 4.
Maths dept. Dr. HNNCE, Bengaluru-70
11
13. Find 𝟕𝟏𝟐𝟏 𝒎𝒐𝒅 𝟏𝟑.
13 is a prime number and (𝑎, 𝑝) = (7, 13) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 7, 𝑝 = 13 we get 716 ≡ 1(𝑚𝑜𝑑 13)
Therefore,
7121 ≡ 712(10)+1 (𝑚𝑜𝑑 13)
≡ (712 )10 × 71 (𝑚𝑜𝑑 13)
≡ 110 × 7 (𝑚𝑜𝑑 13)
≡ 7 (𝑚𝑜𝑑 13)
The remainder is 7.
14. Find 𝟑𝟑𝟏 𝒎𝒐𝒅 𝟕.
7 is a prime number and (𝑎, 𝑝) = (3, 7) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 3, 𝑝 = 7 we get 36 ≡ 1(𝑚𝑜𝑑 7)
Therefore,
331 ≡ 36(5)+1 (𝑚𝑜𝑑 7)
≡ (36 )5 × 31 (𝑚𝑜𝑑 7)
≡ 15 × 3 (𝑚𝑜𝑑 7)
≡ 3(𝑚𝑜𝑑 7)
Therefore, the remainder is 3.
15. Find 𝟏𝟐𝟖𝟏𝟐𝟗 𝒎𝒐𝒅 𝟏𝟕.
17 is a prime number and (𝑎, 𝑝) = (128, 17) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 128, 𝑝 = 17 we get 12816 ≡ 1(𝑚𝑜𝑑 17)
Therefore,
128129 ≡ 12816(8)+1
≡ (12816 )8 × 1281 (𝑚𝑜𝑑 17)
≡ 18 × 128 (𝑚𝑜𝑑 17)
≡ 1 × 128 (𝑚𝑜𝑑 17)
≡ 2 (𝑚𝑜𝑑 17)
Therefore, the remainder is 2.
Maths dept. Dr. HNNCE, Bengaluru-70
12
16. Find 𝟐𝟗𝟐𝟓 𝒎𝒐𝒅 𝟏𝟏.
11 is a prime number and (𝑎, 𝑝) = (29, 11) = 1.
By Fermat’s little theorem, 𝑎𝑝−1 ≡ 1(𝑚𝑜𝑑 𝑝)
Put 𝑎 = 29, 𝑝 = 11 we get 2910 ≡ 1(𝑚𝑜𝑑 11)
2925 ≡ 2910(2)+5 (𝑚𝑜𝑑 11)
≡ (2910 )2 × 295 (𝑚𝑜𝑑 11)
≡ 12 × 295 (𝑚𝑜𝑑 11)
≡ 75 (𝑚𝑜𝑑 11)
≡ 72 × 72 × 7 (𝑚𝑜𝑑 11)
≡ 5 × 5 × 7 (𝑚𝑜𝑑 11)
≡ 25 × 7 (𝑚𝑜𝑑 11)
≡ 3 × 7 (𝑚𝑜𝑑 11)
≡ 10 (𝑚𝑜𝑑 11)
Therefore, the remainder is 10.
4.3 Euler’s theorem
Relatively prime numbers:
Two numbers 𝑎 and 𝑛 are relatively prime numbers if there is no common factor other than 1.
It is denoted by (𝑎, 𝑛) = 1 .
Euler’s totient function:
𝛼 𝛼 𝛼
If 𝑛 = 𝑝1 1 𝑝2 2 … 𝑝𝑘 𝑘 then Euler’s totient function is given by
1 1 1
𝜙(𝑛) = 𝑛 (1 − ) (1 − ) … (1 − )
𝑝1 𝑝2 𝑝𝑘
Euler’s theorem:
If (𝑎, 𝑛) = 1 then 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛).
Maths dept. Dr. HNNCE, Bengaluru-70
13
1. Evaluate (i) 𝝓(𝟑𝟎), (ii) 𝝓(𝟑𝟔), (iii) 𝝓(𝟗𝟎𝟎) and (iv) 𝝓(𝟐𝟎𝟎𝟎) .
(i) 30 = (2)1 (3)1 (5)1
1 1 1 1 2 4
𝜙(30) = 30 (1 − ) (1 − ) (1 − ) = 30 × × × = 8
2 3 5 2 3 5
Therefore, there are 8 relatively prime numbers to 30.
(ii) 36 = (2)2 (3)2
1 1 1 2
𝜙(36) = 36 (1 − ) (1 − ) = 36 × × = 12
2 3 2 3
Therefore, there are 12 relatively prime numbers to 36.
(iii) 900 = (2)2 (3)2 (5)2
1 1 1 1 2 4
𝜙(900) = 900 (1 − ) (1 − ) (1 − ) = 900 × × × = 240
2 3 5 2 3 5
Therefore, there are 240 relatively prime numbers to 900.
(iv) 2000 = (2)4 (5)3
1 1 1 4
𝜙(30) = 2000 (1 − ) (1 − ) = 2000 × × = 800
2 5 2 5
Therefore, there are 800 relatively prime numbers to 2000.
2. Using Euler’s theorem find the remainder when 𝟐𝟑𝟏𝟑𝟎 is divided by 25.
1
𝑛 = 25 = 52 and 𝜙(𝑛) = 25 (1 − 5) = 20
By Euler’s theorem, 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛).
If 𝑎 = 23, 𝜙(𝑛) = 20 then 2320 ≡ 1 (𝑚𝑜𝑑 25)
Therefore,
23130 ≡ 2320(6)+10 (𝑚𝑜𝑑 25)
≡ (2320 )6 × 2310 (𝑚𝑜𝑑 25)
≡ 16 × 2310 (𝑚𝑜𝑑 25)
≡ 2310 (𝑚𝑜𝑑 25)
≡ (−2)10 (𝑚𝑜𝑑 25)
≡ 1024 (𝑚𝑜𝑑 25)
≡ 24 (𝑚𝑜𝑑 25)
The remainder is 24.
Maths dept. Dr. HNNCE, Bengaluru-70
14
3. Using Euler’s theorem find the remainder when 𝟕𝟑𝟎 is divided by 15.
𝑛 = 15 = (3)(5)
1 1 2 4
𝜙(𝑛) = 15 (1 − 3) (1 − 5) = 15 (3) (5) = 8
By Euler’s theorem, 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛).
If 𝑎 = 7, 𝜙(𝑛) = 8 then 78 ≡ 1 (𝑚𝑜𝑑 15), 30 = 8(3) + 6
730 ≡ 78(3)+6 (𝑚𝑜𝑑 15)
≡ (78 )3 × 76 (𝑚𝑜𝑑 15)
≡ 13 × 493 (𝑚𝑜𝑑 15)
≡ 1 × 493 (𝑚𝑜𝑑 15)
≡ 43 (𝑚𝑜𝑑 15)
≡ 64 (𝑚𝑜𝑑 15)
≡ 4 (𝑚𝑜𝑑 15)
Therefore, the remainder is 4.
4. Using Euler’s theorem find the remainder when 𝟓𝟏𝟐 is divided by 36.
𝑎 = 5, 𝑛 = 36 = (2)2 (3)2
1 1 1 2
𝜙(𝑛) = 36 (1 − ) (1 − ) = 36 ( ) ( ) = 12
2 3 2 3
By Euler’s theorem, 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛).
If 𝑎 = 5, 𝜙(𝑛) = 12 then 512 ≡ 1 (𝑚𝑜𝑑 36),
Therefore, the remainder is 1.
5. Using Euler’s theorem find the remainder when 𝟑𝟒𝟒 is divided by 10.
𝑛 = 10 = (2)(5)
1 1 1 4
𝜙(𝑛) = 10 (1 − 2) (1 − 5) = 10 (2) (5) = 4
By Euler’s theorem, 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛)
If 𝑎 = 3, 𝜙(𝑛) = 4 then 34 ≡ 1 (𝑚𝑜𝑑 10)
344 ≡ 34(11)
≡ (34 )11 (𝑚𝑜𝑑 10)
≡ 111 (𝑚𝑜𝑑 10)
≡ 1 (𝑚𝑜𝑑 10)
Therefore, the remainder is 1.
Maths dept. Dr. HNNCE, Bengaluru-70
15
6. Solve 𝟑𝟐𝟎𝟐 mod 𝟏𝟑 using Euler’s theorem.
𝑎 = 3, 𝑛 = 13 = (3)(5)
1 12
𝜙(𝑛) = 13 (1 − 13) = 13 (13) = 12
By Euler’s theorem, 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛).
If 𝑎 = 3, 𝜙(𝑛) = 12 then 312 ≡ 1 (𝑚𝑜𝑑 13)
Therefore,
3202 ≡ 312(16)+10 (𝑚𝑜𝑑 13)
≡ (312 )16 × 310 (𝑚𝑜𝑑 13)
≡ 116 × (33 )3 × 3 (𝑚𝑜𝑑 13)
≡ (33 )3 × 3 (𝑚𝑜𝑑 13)
≡ 13 × 3 (𝑚𝑜𝑑 13)
≡ 3 (𝑚𝑜𝑑 13)
Therefore, the solution is 3.
7. Solve 𝟒𝟗𝟗 mod 𝟑𝟓 using Euler’s theorem.
𝑛 = 35 = (5)(7)
1 1 4 6
𝜙(𝑛) = 35 (1 − 5) (1 − 7) = 35 (5) (7) = 24
By Euler’s theorem, 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛).
If 𝑎 = 4, 𝜙(𝑛) = 24 then 424 ≡ 1 (𝑚𝑜𝑑 35)
Therefore,
499 ≡ 424(4)+3 (𝑚𝑜𝑑 35)
≡ (424 )4 × 43 (𝑚𝑜𝑑 35)
≡ 14 × 64 (𝑚𝑜𝑑 35)
≡ 64 (𝑚𝑜𝑑 35)
≡ 29 (𝑚𝑜𝑑 35)
The solution is 29.
Maths dept. Dr. HNNCE, Bengaluru-70
16
8. Find the unit digit in 𝟑𝟏𝟎𝟎 using Euler’s theorem.
𝑛 = 10 = (2)(5)
1 1 1 4
𝜙(𝑛) = 10 (1 − 2) (1 − 5) = 10 (2) (5) = 4
By Euler’s theorem, 𝑎𝜙(𝑛) ≡ 1 (𝑚𝑜𝑑 𝑛).
If 𝑎 = 3, 𝜙(𝑛) = 4 then 34 ≡ 1 (𝑚𝑜𝑑 10)
Therefore,
3100 ≡ 34(25) (𝑚𝑜𝑑 10)
≡ 125 (𝑚𝑜𝑑 10)
≡ 1 (𝑚𝑜𝑑 10)
Therefore, unit digit is 1.
4.4 Wilson’s theorem
If 𝑝 is a prime then (𝑝 − 1)! ≡ −1 (𝑚𝑜𝑑 𝑝)
or
If 𝑝 is a prime then (𝑝 − 2)! ≡ 1 (𝑚𝑜𝑑 𝑝)
or
𝑝−1
If 𝑝 is a prime then (𝑝 − 3)! ≡ (𝑚𝑜𝑑 𝑝)
2
1. Find the remainder when 𝟏𝟒! is divided by 17.
By the corollary of Wilson’s theorem,
𝑝−1
If 𝑝 is a prime then (𝑝 − 3)! ≡ (𝑚𝑜𝑑 𝑝)
2
16
Since 17 is a prime, (17 − 3)! ≡ (𝑚𝑜𝑑 17)
2
14! ≡ 8 (𝑚𝑜𝑑 17)
Therefore, the remainder is 8.
2. Find the remainder when 𝟐(𝟐𝟔!) is divided by 29.
By the corollary of Wilson’s theorem,
𝑝−1
If 𝑝 is a prime then (𝑝 − 3)! ≡ (𝑚𝑜𝑑 𝑝)
2
28
Since 29 is a prime, (29 − 3)! ≡ (𝑚𝑜𝑑 29)
2
26! ≡ 14 (𝑚𝑜𝑑 29)
Maths dept. Dr. HNNCE, Bengaluru-70
17
2(26!) ≡ 28 (𝑚𝑜𝑑 29). Therefore, the remainder is 28.
3. Find the least positive remainder when 𝟐(𝟐𝟖!) is divided by 31.
By the corollary of Wilson’s theorem,
𝑝−1
If 𝑝 is a prime then (𝑝 − 3)! ≡ (𝑚𝑜𝑑 𝑝)
2
30
Since 31 is a prime, (31 − 3)! ≡ (𝑚𝑜𝑑 31)
2
28! ≡ 15 (𝑚𝑜𝑑 31)
2(28!) ≡ 30 (𝑚𝑜𝑑 31)
Therefore, the remainder is 30.
4. Show that 𝟒(𝟐𝟗!) + 𝟓! is divisible by 31.
By the corollary of Wilson’s theorem,
If 𝑝 is a prime then (𝑝 − 2)! ≡ 1 (𝑚𝑜𝑑 𝑝)
Since 101 is a prime, (31 − 2)! ≡ 1 (𝑚𝑜𝑑 31)
29! ≡ 1 (𝑚𝑜𝑑 31)
Therefore,
4(29!) + 5! ≡ 4(1) + 120 (𝑚𝑜𝑑 31)
≡ 4 + 120 (𝑚𝑜𝑑 31)
≡ 124 (𝑚𝑜𝑑 31)
≡ 0 (𝑚𝑜𝑑 31)
Therefore, 4(29!) + 5! is divisible by 31.
5. Show that 𝟏𝟎! + 𝟏 is divisible by 11.
By the corollary of Wilson’s theorem,
If 𝑝 is a prime then (𝑝 − 1)! ≡ −1 (𝑚𝑜𝑑 𝑝)
Since 11 is a prime, (11 − 1)! ≡ −1 (𝑚𝑜𝑑 11)
10! ≡ −1 (𝑚𝑜𝑑 11)
Therefore,
10! + 1 ≡ −1 + 1 (𝑚𝑜𝑑 11)
≡ 0 (𝑚𝑜𝑑 11)
Therefore, 10! + 1 is divisible by 11.
20 × 19 × 18! ≡ 11 (𝑚𝑜𝑑 23)
Maths dept. Dr. HNNCE, Bengaluru-70
18
6. Show that 𝟔𝟑! ≡ −𝟏 (𝒎𝒐𝒅 𝟕𝟏)
70! ≡ −1 (𝑚𝑜𝑑 71) ---------- (1)
70 × 69 × 68 × 67 × 66 × 65 × 64 × 63! ≡ −1 (𝑚𝑜𝑑 71)
(−1) × (−2) × (−3) × (−4) × (−5) × (−6) × (−7) × 63! ≡ −1 (𝑚𝑜𝑑 71)
(−70) × (−72) × 63! ≡ 1 (𝑚𝑜𝑑 71)
70 × 72 × 63! ≡ 1 (𝑚𝑜𝑑 71)
(−1) × 1 × 63! ≡ 1 (𝑚𝑜𝑑 71)
63! ≡ −1 (𝑚𝑜𝑑 71)
7. Find the remainder when 𝟗𝟕! is divided by 101.
By the corollary of Wilson’s theorem,
If 𝑝 is a prime then (𝑝 − 2)! ≡ 1 (𝑚𝑜𝑑 𝑝)
Since 101 is a prime, (101 − 2)! ≡ 1 (𝑚𝑜𝑑 101)
99! ≡ 1 (𝑚𝑜𝑑 101)
99 × 98 × 97! ≡ 1 (𝑚𝑜𝑑 101)
(−2)(−3)97! ≡ 1 (𝑚𝑜𝑑 101)
6(97!) ≡ 1 (𝑚𝑜𝑑 101) ------- (1)
But 102 ≡ 1(𝑚𝑜𝑑 101)
6(17) ≡ 1 (𝑚𝑜𝑑 101) -------- (2)
By (1) and (2), 97! ≡ 17 (𝑚𝑜𝑑 101)
Therefore, the remainder is 17.
8. Show that 𝟏𝟖! ≡ −𝟏 (𝒎𝒐𝒅 𝟒𝟑𝟕)
437 = 19 × 23
By Wilson’s theorem,
18! ≡ −1 (𝑚𝑜𝑑 19) ---------- (1)
22! ≡ −1 (𝑚𝑜𝑑 23)
22 × 21 × 20 × 19 × 18! ≡ −1 (𝑚𝑜𝑑 23)
(−1) × (−2) × (−3) × (−4) × 18! ≡ −1(𝑚𝑜𝑑 23)
24 × 18! ≡ −1 (𝑚𝑜𝑑 23)
1 × 18! ≡ −1 (𝑚𝑜𝑑 23)
Maths dept. Dr. HNNCE, Bengaluru-70
19
18! ≡ −1(𝑚𝑜𝑑 23) ----------- (2)
Therefore, 18! ≡ −1(𝑚𝑜𝑑 437)
9. Compute 𝟏𝟐. 𝟏𝟑 … . 𝟐𝟏 (𝒎𝒐𝒅 𝟏𝟏)
Let 𝑥 ≡ 12.13 … . 21 (𝑚𝑜𝑑 11)
≡ 1.2 … .10 (𝑚𝑜𝑑 11)
≡ 10! (𝑚𝑜𝑑 11)
≡ −1 (𝑚𝑜𝑑 11) [∵By Wilson' s theorem]
𝟏𝟑𝟎!
10. Simplify (𝒎𝒐𝒅 𝟏𝟑𝟏)
𝟖𝟕
130!
Let 𝑥 ≡ (𝑚𝑜𝑑 131)
87
−1
≡ (𝑚𝑜𝑑 131) [∵By Wilson' s theorem]
87
87𝑥 ≡ −1 (𝑚𝑜𝑑 131)
−44𝑥 ≡ −1 (𝑚𝑜𝑑 131)
44𝑥 ≡ 1 (𝑚𝑜𝑑 131)
By inspection, 𝑥 = 3.
Therefore, 𝑥 ≡ 3 (𝑚𝑜𝑑 131)
4.5 Linear Diophantine equations
Introduction
This is of the form 𝑎𝑥 + 𝑏𝑦 = 𝑐 where 𝑎 ≠ 0, 𝑏 ≠ 0, 𝑐 ∈ 𝑍
Let 𝑔. 𝑐. 𝑑. (𝑎, 𝑏) = 𝑑. If 𝑑|𝑐 then solution exists.
If 𝑔. 𝑐. 𝑑. (𝑎, 𝑏) = 𝑑 ∤ 𝑐 then solution does not exist.
Particular solution is (𝑥0 , 𝑦0 ).
𝑏 𝑎
General solution is (𝑥0 − 𝑡, 𝑦𝑜 + 𝑡).
𝑑 𝑑
1. Solve the linear Diophantine equation 𝟐𝒙 + 𝟒𝒚 = 𝟐𝟏.
(2, 4) = 2 ∤ 21. Therefore, solution does not exist.
2. Solve the linear Diophantine equation 𝟔𝒙 + 𝟓𝟏𝒚 = 𝟐𝟐.
(6, 51) = 3 ∤ 22. Therefore, solution does not exist.
Maths dept. Dr. HNNCE, Bengaluru-70
20
3. Solve the linear Diophantine equation 𝟐𝟎𝒙 + 𝟏𝟔𝒚 = 𝟓𝟎𝟎.
(20, 16) = 4|500. Therefore, solution exists.
𝑞 𝑎 𝑏 𝑟 𝑎 = 𝑏𝑞 + 𝑟 𝑟 = 𝑎 + 𝑏(−𝑞)
1 20 16 4 20 = 16(1) + 4 4 = 20 + 16(−1)
4 16 4 0
Therefore, 4 = 20 + 16(−1)
Multiply by 125 on both sides,
500 = 20(125) + 16(−125).
Particular solution:
(𝑥0 , 𝑦0 ) = (125, −125) .
General solution:
𝑏 𝑎 16 20
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (125 − 𝑡, −125 + 𝑡 ) = (125 − 4𝑡, −125 + 5𝑡).
4 4
4. Solve the linear Diophantine equation 𝟓𝟔𝒙 + 𝟕𝟐𝒚 = 𝟒𝟎.
(56, 72) = 8|40. Therefore, solution exists.
𝑞 𝑏 𝑎 𝑟 𝑏 = 𝑎𝑞 + 𝑟 𝑟 = 𝑏 + 𝑎(−𝑞)
1 72 56 16 72 = 56(1) + 16 16 = 72 + 56(−1)
3 56 16 8 56 = 16(3) + 8 8 = 56 + 16(−3)
2 16 8 0
Therefore, 8 = 56 + [72 + 56(−1)](−3)
= 56(4) + 72(−3)
Multiply by 5 on both sides,
40 = 56(20) + 72(−15)
Particular solution:
(𝑥0 , 𝑦0 ) = (20, −15) .
General solution:
𝑏 𝑎 72 56
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (20 − 𝑡, −15 + 𝑡 ) = (20 − 9𝑡, −15 + 7𝑡).
8 8
Maths dept. Dr. HNNCE, Bengaluru-70
21
5. Solve the linear Diophantine equation 𝟕𝒙 + 𝟏𝟖𝒚 = 𝟐𝟎𝟖.
(7, 18) = 1|208. Therefore, solution exists.
𝑞 𝑏 𝑎 𝑟 𝑎 = 𝑏𝑞 + 𝑟 𝑟 = 𝑎 + 𝑏(−𝑞)
2 18 7 4 18 = 7(2) + 4 4 = 18 + 7(−2)
1 7 4 3 7 = 4(1) + 3 3 = 7 + 4(−1)
1 4 3 1 4 = 3(1) + 1 1 = 4 + 3(−1)
Therefore, 1 = 4 + [7 + 4(−1)](−1)
= 4(2) + 7(−1)
= [18 + 7(−2)](2) + 7(−1)
= 18(2) + 7(−5)
Multiply by 208 on both sides,
208 = 7(−1040) + 18(416)
Particular solution: (𝑥0 , 𝑦0 ) = (−1040, 416) .
General solution:
𝑏 𝑎
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (−1040 − 18𝑡, 416 + 7𝑡 ).
6. Solve the linear Diophantine equation 𝟓𝒙 + 𝟑𝒚 = 𝟒.
(5, 3) = 1|4. Therefore, solution exists.
𝑞 𝑎 𝑏 𝑟 𝑎 = 𝑏𝑞 + 𝑟 𝑟 = 𝑎 + 𝑏(−𝑞)
1 5 3 2 5 = 3(1) + 2 2 = 5 + 3(−1)
1 3 2 1 3 = 2(1) + 1 1 = 3 + 2(−1)
2 2 1 0
Therefore, 1 = 3 + [5 + 3(−1)](−1)
= 3(2) + 5(−1)
= 5(−1) + 3(2)
Multiply by 4 on both sides,
4 = 5(−4) + 3(8)
Particular solution: (𝑥0 , 𝑦0 ) = (−4, 8) .
General solution:
Maths dept. Dr. HNNCE, Bengaluru-70
22
𝑏 𝑎
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (−4 − 3𝑡, 8 + 5𝑡 ).
7. Solve the linear Diophantine equation 𝟑𝟑𝒙 + 𝟏𝟒𝒚 = 𝟏𝟏𝟓.
(33, 14) = 1|115. Therefore, solution exists.
𝑞 𝑎 𝑏 𝑟 𝑎 = 𝑏𝑞 + 𝑟 𝑟 = 𝑎 + 𝑏(−𝑞)
2 33 14 5 33 = 14(2) + 5 5 = 33 + 14(−2)
2 14 5 4 14 = 5(2) + 4 4 = 14 + 5(−2)
1 5 4 1 5 = 4(1) + 1 1 = 5 + 4(−1)
Therefore, 1 = 5 + [14 + 5(−2](−1)
= 14(−1) + 5(3)
= 14(−1) + [33 + 14(−2)](3)
= 33(3) + 14(−7)
Multiply by 115 on both sides,
115 = 33(345) + 14(−805)
Particular solution: (𝑥0 , 𝑦0 ) = (345, −805) .
General solution:
𝑏 𝑎
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (345 − 14𝑡, −805 + 33𝑡 ).
8. Solve the linear Diophantine equation 𝟓𝟒𝒙 + 𝟐𝟏𝒚 = 𝟗𝟎𝟔.
(54, 21) = 3|906. Therefore, solution exists.
𝑞 𝑎 𝑏 𝑟 𝑎 = 𝑏𝑞 + 𝑟 𝑟 = 𝑎 + 𝑏(−𝑞)
2 54 21 12 54 = 21(2) + 12 12 = 54 + 21(−2)
1 21 12 9 21 = 12(1) + 9 9 = 21 + 12(−1)
1 12 9 3 12 = 9(1) + 3 3 = 12 + 9(−1)
Therefore, 3 = 12 + [21 + 12(−1)](−1)
= 12(2) + 21(−1)
= [54 + 21(−2)](2) + 21(−1)
= 54(2) + 21(−5)
Multiply by 302 on both sides,
906 = 54(604) + 21(−1510)
Particular Solution: (𝑥0 , 𝑦0 ) = (604, −1510) .
Maths dept. Dr. HNNCE, Bengaluru-70
23
General solution:
𝑏 𝑎 21 54
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (604 − 𝑡, −1510 + 𝑡 ) = (604 − 7𝑡, −1510 + 18𝑡 ).
3 3
9. Solve the linear Diophantine equation 𝟕𝟎𝒙 + 𝟏𝟏𝟐𝒚 = 𝟏𝟔𝟖.
(112, 70) = 14|168. Therefore, solution exists.
𝑞 𝑏 𝑎 𝑟 𝑏 = 𝑎𝑞 + 𝑟 𝑟 = 𝑏 + 𝑎(−𝑞)
1 112 70 42 112 = 70(1) + 42 42 = 112 + 70(−1)
1 70 42 28 70 = 42(1) + 28 28 = 70 + 42(−1)
1 42 28 14 42 = 28(1) + 14 14 = 42 + 28(−1)
2 28 14 0
Therefore, 14 = 42 + [70 + 42(−1)](−1)
= 42(2) + 70(−1)
= [112 + 70(−1)](2) + 70(−1)
= 112(2) + 70(−3)
= 70(−3) +112(2)
Multiply by 12 on both sides,
168 = 70(−36) + 112(24)
Particular solution:
(𝑥0 , 𝑦0 ) = (−36, 24) .
General solution:
𝑏 𝑎 112 70
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (−36 − 𝑡, 24 + 14 𝑡 ) = (−36 − 8𝑡, 24 + 5𝑡 ).
14
Maths dept. Dr. HNNCE, Bengaluru-70
24
10. Solve the linear Diophantine equation 𝟑𝟗𝒙 − 𝟓𝟔𝒚 = 𝟏𝟏.
(39, 56) = 1|11. Therefore, solution exists.
𝑞 𝑏 𝑎 𝑟 𝑏 = 𝑎𝑞 + 𝑟 𝑟 = 𝑏 + 𝑎(−𝑞)
1 56 39 17 56 = 39(1) + 17 17 = 56 + 39(−1)
2 39 17 5 39 = 17(2) + 5 5 = 39 + 17(−2)
1 17 5 2 17 = 5(3) + 2 2 = 17 + 5(−3)
2 5 2 1 5 = 2(2) + 1 1 = 5 + 2(−2)
Therefore, 1 = 5 + [17 + 5(−3)](−2)
= 5(7) + 17(−2)
= [39 + 17(−2)](7) + 17(−2)
= 39(7) + 17(−16)
= 39(7) + [56 + 39(−1)](−16)
= 39(23) − 56(16)
Multiply by 11 on both sides,
11 = 39(253) − 56(176)
Particular solution:
(𝑥0 , 𝑦0 ) = (253, 176) .
General solution:
𝑏 𝑎
(𝑥0 − 𝑑 𝑡 , 𝑦0 + 𝑑 𝑡) = (253 − 56𝑡, 176 + 39𝑡 ).
Maths dept. Dr. HNNCE, Bengaluru-70
25
Basic properties of congruences
1. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) ⟹ 𝑚|(𝑎 − 𝑏)
2. 𝑎 ≡ 𝑎 (𝑚𝑜𝑑 𝑚)
3. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) ⟹ 𝑏 ≡ 𝑎 (𝑚𝑜𝑑 𝑚)
4. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚), 𝑏 ≡ 𝑐 (𝑚𝑜𝑑 𝑚) ⟹ 𝑎 ≡ 𝑐 (𝑚𝑜𝑑 𝑚)
5. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚), 𝑐 ≡ 𝑑 (𝑚𝑜𝑑 𝑚) ⟹ 𝑎 + 𝑐 ≡ 𝑏 + 𝑑 (𝑚𝑜𝑑 𝑚)
6. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚), 𝑐 ≡ 𝑑 (𝑚𝑜𝑑 𝑚) ⟹ 𝑎 − 𝑐 ≡ 𝑏 − 𝑑 (𝑚𝑜𝑑 𝑚)
7. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚), 𝑐 ≡ 𝑑 (𝑚𝑜𝑑 𝑚) ⟹ 𝑎𝑐 ≡ 𝑏𝑑 (𝑚𝑜𝑑 𝑚)
8. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) ⟹ 𝑎𝑘 ≡ 𝑏𝑘 (𝑚𝑜𝑑 𝑚), 𝑘 ≥ 1 .
9. 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚), 𝑛|𝑚 ⟹ 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑛)
10.𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚), 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑛), (𝑚, 𝑛) = 1 ⟹ 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚𝑛)
11.𝑐𝑎 ≡ 𝑐𝑏 (𝑚𝑜𝑑 𝑚), (𝑐, 𝑚) = 1 ⟹ 𝑎 ≡ 𝑏 (𝑚𝑜𝑑 𝑚)
12.𝑎𝑏 ≡ 0 (𝑚𝑜𝑑 𝑝) ⟹ 𝑎 ≡ 0 (𝑚𝑜𝑑 𝑝) 𝑜𝑟 𝑏 ≡ 0 (𝑚𝑜𝑑 𝑝)
4.6 Linear congruence
Introduction
Consider a linear congruence 𝑎𝑥 ≡ 𝑏 (𝑚𝑜𝑑 𝑚) with (𝑎, 𝑚) = 𝐺𝐶𝐷(𝑎, 𝑚). It has
(i) If (𝑎, 𝑚) = 1, there is a unique solution 𝑥0 .
𝑚 2𝑚 (𝑛−1)𝑚
(ii) If (𝑎, 𝑚) = 𝑑, there are exactly d solutions 𝑥0 , 𝑥0 + , 𝑥0 + , … , 𝑥0 +
𝑑 𝑑 𝑑
(iii) No solution if (𝑎, 𝑚) ∤ 𝑏.
1. Solve: 𝟑𝒙 ≡ 𝟓 (𝒎𝒐𝒅 𝟔)
(𝑎, 𝑚) = (3, 6) = 3 ∤ 5.
Therefore, solution does not exist.
2. Solve: 𝟏𝟏𝒙 ≡ 𝟒 (𝒎𝒐𝒅 𝟐𝟓)
(𝑎, 𝑚) = (11, 25) = 1. There is a unique solution.
−14𝑥 ≡ −21 (𝑚𝑜𝑑 25)
2𝑥 ≡ 3 (𝑚𝑜𝑑 25)
2𝑥 ≡ −22 (𝑚𝑜𝑑 25)
Maths dept. Dr. HNNCE, Bengaluru-70
26
𝑥 ≡ −11 (𝑚𝑜𝑑 25)
Therefore, the solution is 𝑥 ≡ 14 (𝑚𝑜𝑑 25) .
3. Solve: 𝟑𝒙 ≡ 𝟐 (𝒎𝒐𝒅 𝟒)
(𝑎, 𝑚) = (3, 4) = 1. There is a unique solution.
−𝑥 ≡ −2 (𝑚𝑜𝑑 4)
Therefore, the solution is 𝑥 ≡ 2 (𝑚𝑜𝑑 4) .
4. Solve: 𝟐𝒙 ≡ 𝟑 (𝒎𝒐𝒅 𝟓)
(𝑎, 𝑚) = (2, 5) = 1. There is a unique solution.
2𝑥 ≡ 3 (𝑚𝑜𝑑 5)
2𝑥 ≡ −2 (𝑚𝑜𝑑 5)
𝑥 ≡ −1 (𝑚𝑜𝑑 5)
Therefore, the solution is 𝑥 ≡ 4 (𝑚𝑜𝑑 5).
5. Solve: 𝟑𝒙 ≡ 𝟐 (𝒎𝒐𝒅 𝟏𝟕)
(𝑎, 𝑚) = (3, 17) = 1. There is a unique solution.
3𝑥 ≡ 2 (𝑚𝑜𝑑 17)
3𝑥 ≡ −15 (𝑚𝑜𝑑 17)
𝑥 ≡ −5 (𝑚𝑜𝑑 17)
Therefore, the solution is 𝑥 ≡ 12 (𝑚𝑜𝑑 7) .
6. Solve: 𝟏𝟒𝒙 ≡ 𝟏𝟐 (𝒎𝒐𝒅 𝟏𝟖)
(𝑎, 𝑚) = (14, 18) = 2|𝑏 . There are 2 solutions.
𝑚
They are 𝑥0 , 𝑥1 = 𝑥0 + .
𝑑
𝑚 18
Where = = 9.
𝑑 2
14𝑥 ≡ 12 (𝑚𝑜𝑑 18)
−4𝑥 ≡ −6 (𝑚𝑜𝑑 18)
2𝑥 ≡ 3 (𝑚𝑜𝑑 9)
2𝑥 ≡ −6 (𝑚𝑜𝑑 9)
𝑥 ≡ −3 (𝑚𝑜𝑑 9)
𝑥 ≡ 6 (𝑚𝑜𝑑 9)
𝑥0 = 6
𝑚
𝑥1 = 𝑥0 + = 6 + 9 = 15
𝑑
Maths dept. Dr. HNNCE, Bengaluru-70
27
Therefore, two congruent solutions are
𝑥 ≡ 6 (𝑚𝑜𝑑 18) and 𝑥 ≡ 15 (𝑚𝑜𝑑 18) .
7. Solve: 𝟗𝒙 ≡ 𝟐𝟏 (𝒎𝒐𝒅 𝟑𝟎)
(𝑎, 𝑚) = (9, 30) = 3|21 . There are 3 solutions.
𝑚 2𝑚
They are 𝑥0 , 𝑥1 = 𝑥0 + , 𝑥2 = 𝑥0 + .
𝑑 𝑑
𝑚 30
Where = = 10.
𝑑 3
9𝑥 ≡ 21 (𝑚𝑜𝑑 30)
3𝑥 ≡ 7 (𝑚𝑜𝑑 10)
3𝑥 ≡ −3 (𝑚𝑜𝑑 10)
𝑥 ≡ −1 (𝑚𝑜𝑑 10)
𝑥 ≡ 9 (𝑚𝑜𝑑 10)
𝑥0 = 9
𝑥1 = 𝑥0 + 10 = 9 + 10 = 19
𝑥2 = 𝑥0 + 20 = 9 + 10 = 29
Therefore, three congruent solutions are
𝑥 ≡ 9 (𝑚𝑜𝑑 30) , 𝑥 ≡ 19 (𝑚𝑜𝑑 30) and 𝑥 ≡ 29 (𝑚𝑜𝑑 30)
8. Solve: 𝟏𝟖𝒙 ≡ 𝟑𝟎 (𝒎𝒐𝒅 𝟒𝟐)
(𝑎, 𝑚) = (18, 42) = 6|30. There are 6 solutions.
𝑚 2𝑚 3𝑚 4𝑚 5𝑚
They are 𝑥0 , 𝑥0 + , 𝑥0 + , 𝑥0 + , 𝑥0 + , 𝑥0 +
𝑑 𝑑 𝑑 𝑑 𝑑
𝑚 42
Where = = 7.
𝑑 6
18𝑥 ≡ 30 (𝑚𝑜𝑑 42)
3𝑥 ≡ 5 (𝑚𝑜𝑑 7)
−4𝑥 ≡ −2 (𝑚𝑜𝑑 7)
2𝑥 ≡ 1 (𝑚𝑜𝑑 7)
2𝑥 ≡ −6 (𝑚𝑜𝑑 7)
𝑥 ≡ −3 (𝑚𝑜𝑑 7)
𝑥 ≡ 4 (𝑚𝑜𝑑 7)
𝑥0 = 4
𝑥1 = 11, 𝑥2 = 18, 𝑥3 = 25, 𝑥4 = 32, 𝑥5 = 39.
Therefore, 6 congruent solutions are
𝑥 ≡ 4 (𝑚𝑜𝑑 42) , 𝑥 ≡ 11 (𝑚𝑜𝑑 42), 𝑥 ≡ 18 (𝑚𝑜𝑑 42 ), 𝑥 ≡ 25 (𝑚𝑜𝑑 42),
Maths dept. Dr. HNNCE, Bengaluru-70
28
𝑥 ≡ 32 (𝑚𝑜𝑑 42) and 𝑥 ≡ 25 (𝑚𝑜𝑑 42).
9. Solve: 𝟑𝟔𝒙 + 𝟏𝟐 ≡ 𝟎 (𝒎𝒐𝒅 𝟏𝟓)
36𝑥 ≡ −12(𝑚𝑜𝑑 15).
(𝑎, 𝑚) = (36, 15) = 3| − 12. There are 3 solutions.
𝑚 2𝑚
They are 𝑥0 , 𝑥0 + , 𝑥0 +
𝑑 𝑑
𝑚 15
Where = =5
𝑑 3
36𝑥 ≡ −12 (𝑚𝑜𝑑 15)
12𝑥 ≡ −4 (𝑚𝑜𝑑 5)
2𝑥 ≡ −4 (𝑚𝑜𝑑 5)
𝑥 ≡ −2 (𝑚𝑜𝑑 5)
𝑥 ≡ 3 (𝑚𝑜𝑑 5)
Therefore,
𝑥0 = 3
𝑥1 = 3 + 5 = 8
𝑥2 = 3 + 10 = 13
Therefore, three congruent solutions are
𝑥 ≡ 3 (𝑚𝑜𝑑 15) , 𝑥 ≡ 8 (𝑚𝑜𝑑 15) and 𝑥 ≡ 13 (𝑚𝑜𝑑 15)
10. Solve: 𝟐𝟏𝟓𝒙 ≡ 𝟖𝟔 (𝒎𝒐𝒅 𝟑𝟎𝟏)
(𝑎, 𝑚) = (215, 301) = 43|86. There are 43 solutions.
𝑚 301
= =7
𝑑 43
215𝑥 ≡ 86 (𝑚𝑜𝑑 301)
5𝑥 ≡ 2 (𝑚𝑜𝑑 7)
−2𝑥 ≡ 2 (𝑚𝑜𝑑 7)
𝑥 ≡ −1 (𝑚𝑜𝑑 7)
𝑚 301
𝑥0 = 6 and = =7
𝑑 43
𝑥1 = 6 + 7 = 13, 𝑥2 = 20, … , 𝑥42 = 300
Therefore, 43 congruent solutions are
𝑥 ≡ 6 (𝑚𝑜𝑑 301) , 𝑥 ≡ 13 (𝑚𝑜𝑑 301) , 𝑥 ≡ 20 (𝑚𝑜𝑑 301) , … ,
𝑥 ≡ 300 (𝑚𝑜𝑑 301).
Maths dept. Dr. HNNCE, Bengaluru-70
29
4.7 System of linear congruences in two variables
1. Solve the system of linear congruences
𝟕𝒙 + 𝟑𝒚 ≡ 𝟏𝟎 (𝒎𝒐𝒅 𝟏𝟔), 𝟐𝒙 + 𝟓𝒚 ≡ 𝟗 (𝒎𝒐𝒅 𝟏𝟔)
7𝑥 + 3𝑦 ≡ 10 (𝑚𝑜𝑑 16) ---- (1)
2𝑥 + 5𝑦 ≡ 9 (𝑚𝑜𝑑 16) ---- (2)
(1) × 5 ⟹ 35𝑥 + 15𝑦 ≡ 50 (𝑚𝑜𝑑 16)
(2) × 3 ⟹ 6𝑥 + 15𝑦 ≡ 27 (𝑚𝑜𝑑 16)
By subtracting, Substitute in (1),
29𝑥 ≡ 23 (𝑚𝑜𝑑 16) 7(3) + 3𝑦 ≡ 10 (𝑚𝑜𝑑 16)
13𝑥 ≡ 7 (𝑚𝑜𝑑 16) 3𝑦 ≡ −11 (𝑚𝑜𝑑 16)
−3𝑥 ≡ −9 (𝑚𝑜𝑑 16) 3𝑦 = 16𝑘 − 11
𝑥 ≡ 3 (𝑚𝑜𝑑 16) 16𝑘−11
𝑦= = 7 , 𝑓𝑜𝑟 𝑘 = 2.
3
Therefore, the solution is 𝑥 ≡ 3 (𝑚𝑜𝑑 16), 𝑦 ≡ 7 (𝑚𝑜𝑑 16).
2. Solve the system of linear congruences
𝟓𝒙 + 𝟔𝒚 ≡ 𝟏𝟎 (𝒎𝒐𝒅 𝟏𝟑), 𝟔𝒙 − 𝟕𝒚 ≡ 𝟐 (𝒎𝒐𝒅 𝟏𝟑)
5𝑥 + 6𝑦 ≡ 10 (𝑚𝑜𝑑 13) ---- (1)
6𝑥 − 7𝑦 ≡ 2 (𝑚𝑜𝑑 13) ---- (2)
(1) × 7 ⟹ 35𝑥 + 42𝑦 ≡ 70 (𝑚𝑜𝑑 13)
(2) × 6 ⟹ 36𝑥 − 42𝑦 ≡ 12 (𝑚𝑜𝑑 13)
By adding, Substitute in (1),
71𝑥 ≡ 82(𝑚𝑜𝑑 13) 5(5) + 6𝑦 ≡ 10 (𝑚𝑜𝑑 13)
6𝑥 ≡ 4 (𝑚𝑜𝑑 13) 6𝑦 ≡ −15 (𝑚𝑜𝑑 13)
3𝑥 ≡ 2 (𝑚𝑜𝑑 13) 2𝑦 ≡ −5 (𝑚𝑜𝑑 13)
13𝑘+2 2𝑦 ≡ 8 (𝑚𝑜𝑑 13)
𝑥= = 5, 𝑓𝑜𝑟 𝑘 = 1
3
𝑦 ≡ 4 (𝑚𝑜𝑑 13)
𝑥 ≡ 5 (𝑚𝑜𝑑 13)
Therefore, the solution is 𝑥 ≡ 5 (𝑚𝑜𝑑 13), 𝑦 ≡ 4 (𝑚𝑜𝑑 13).
Maths dept. Dr. HNNCE, Bengaluru-70
30
3. Solve the system of linear congruences
𝟓𝒙 + 𝟑𝒚 ≡ 𝟐 (𝒎𝒐𝒅 𝟏𝟒), −𝟑𝒙 + 𝟒𝒚 ≡ 𝟕 (𝒎𝒐𝒅 𝟏𝟒)
5𝑥 + 3𝑦 ≡ 2(𝑚𝑜𝑑 14) ---- (1)
−3𝑥 + 4𝑦 ≡ 7 (𝑚𝑜𝑑 14) ---- (2)
(1) × 4 ⟹ 20𝑥 + 12𝑦 ≡ 8 (𝑚𝑜𝑑 14)
(2) × 3 ⟹ −9𝑥 + 12𝑦 ≡ 24 (𝑚𝑜𝑑 14)
By subtracting, Substitute in (1),
29𝑥 ≡ 32 (𝑚𝑜𝑑 14) 5(4) + 3𝑦 ≡ 2 (𝑚𝑜𝑑 14)
𝑥 ≡ 4 (𝑚𝑜𝑑 14) 3𝑦 ≡ −18 (𝑚𝑜𝑑 14)
𝑦 ≡ −6 (𝑚𝑜𝑑 14)
𝑦 ≡ 8 (𝑚𝑜𝑑 14)
Therefore, the solution is 𝑥 ≡ 4 (𝑚𝑜𝑑 14), 𝑦 ≡ 8 (𝑚𝑜𝑑 14).
Maths dept. Dr. HNNCE, Bengaluru-70
31
4. Solve the system of linear congruences
𝟐𝒙 + 𝟔𝒚 ≡ 𝟏 (𝒎𝒐𝒅 𝟕), 𝟒𝒙 + 𝟑𝒚 ≡ 𝟐 (𝒎𝒐𝒅 𝟕)
2𝑥 + 6𝑦 ≡ 1 (𝑚𝑜𝑑 7) ---- (1)
4𝑥 + 3𝑦 ≡ 2 (𝑚𝑜𝑑 7) ---- (2)
(2) × 2 ⟹ 8𝑥 + 6𝑦 ≡ 4 (𝑚𝑜𝑑 7)
(1) ⟹ 2𝑥 + 6𝑦 ≡ 1 (𝑚𝑜𝑑 7)
By subtracting, Substitute in (1),
6𝑥 ≡ 3 (𝑚𝑜𝑑 7) 2(4) + 6𝑦 ≡ 1 (𝑚𝑜𝑑 7)
2𝑥 ≡ 1 (𝑚𝑜𝑑 7) 6𝑦 ≡ −7 (𝑚𝑜𝑑 7)
2𝑥 ≡ −6 (𝑚𝑜𝑑 7) 6𝑦 ≡ 0 (𝑚𝑜𝑑 7)
𝑥 ≡ −3 (𝑚𝑜𝑑 7) 𝑦 ≡ 0 (𝑚𝑜𝑑 7)
𝑥 ≡ 4 (𝑚𝑜𝑑 7)
Therefore, the solution is 𝑥 ≡ 4 (𝑚𝑜𝑑 7), 𝑦 ≡ 0 (𝑚𝑜𝑑 7).
4.8 Polynomial congruences
1. Find the roots of 𝒙𝟐 + 𝟐𝒙 − 𝟑 ≡ 𝟎 (𝒎𝒐𝒅 𝟓).
Let 𝑓(𝑥) = 𝑥 2 + 2𝑥 − 3. Roots belong to {0, ±1, ±2}
𝑓(0) ≡ −3 (𝑚𝑜𝑑 5),
𝑓(−1) ≡ −4 (𝑚𝑜𝑑 5), 𝒇(𝟏) ≡ 𝟎 (𝒎𝒐𝒅 𝟓),
𝑓(−2) ≡ −3 (𝑚𝑜𝑑 5), 𝒇(𝟐) ≡ 𝟎 (𝒎𝒐𝒅 𝟓).
Roots of the given polynomial congruence are
𝑥 ≡ 1(𝑚𝑜𝑑 5), 𝑥 ≡ 2(𝑚𝑜𝑑 5),
2. Find the roots of 𝒙𝟐 + 𝒙 + 𝟏 ≡ 𝟎 (𝒎𝒐𝒅 𝟏𝟓).
Let 𝑓(𝑥) = 𝑥 2 + 𝑥 + 1. Largest prime factor of 15 is 5.
Roots belong to {0, ±1, ±2, ±3, ±4, ±5, ±6, ±7}
𝑓(0) ≡ 1 (𝑚𝑜𝑑 15),
𝑓(−1) ≡ 1 (𝑚𝑜𝑑 15), 𝑓(1) ≡ 3 (𝑚𝑜𝑑 15),
𝑓(−2) ≡ 3(𝑚𝑜𝑑 15), … , 𝑓(7) ≡ −3 (𝑚𝑜𝑑 15).
The given polynomial congruence has no solution.
Maths dept. Dr. HNNCE, Bengaluru-70 32
3. Find the roots of 𝒙𝟓 − 𝟑𝒙𝟐 + 𝟐 ≡ 𝟎 (𝒎𝒐𝒅 𝟕).
Let 𝑓(𝑥) = 𝑥 5 − 3𝑥 2 + 2. Roots belong to {0, ±1, ±2, ±3}
𝑓(0) ≡ 2 (𝑚𝑜𝑑 7),
𝑓(−1) ≡ −2 (𝑚𝑜𝑑 7), 𝒇(𝟏) ≡ 𝟎 (𝒎𝒐𝒅 𝟕),
𝒇(−𝟐) ≡ −𝟒𝟐 (𝒎𝒐𝒅 𝟕) ≡ 𝟎 (𝒎𝒐𝒅 𝟕),
𝑓(2) ≡ 22 (𝑚𝑜𝑑 7) ≡ 1 (𝑚𝑜𝑑 7),
𝑓(−3) ≡ 218(𝑚𝑜𝑑 7) ≡ 1 (𝑚𝑜𝑑 7),
𝑓(3) ≡ −268 (𝑚𝑜𝑑 7) ≡ −2 (𝑚𝑜𝑑 7).
Roots of the given polynomial congruence are
𝑥 ≡ 1(𝑚𝑜𝑑 7), 𝑥 ≡ −2(𝑚𝑜𝑑 7),
(or)
𝑥 ≡ 1(𝑚𝑜𝑑 7), 𝑥 ≡ 5 (𝑚𝑜𝑑 7).
4. Find the roots of 𝒙𝟑 + 𝟐𝒙 − 𝟑 ≡ 𝟎 (𝒎𝒐𝒅 𝟗)
Let 𝑓(𝑥) = 𝑥 3 + 2𝑥 − 3. Roots belong to {0, ±1, ±2, ±3, ±4}
𝑓(0) ≡ −3 (𝑚𝑜𝑑 9)
𝑓(−1) ≡ −6 (𝑚𝑜𝑑 9)
𝒇(𝟏) ≡ 𝟎 (𝒎𝒐𝒅 𝟗)
𝑓(−2) ≡ −15 (𝑚𝑜𝑑 9) ≡ −6 (𝑚𝑜𝑑 9)
𝒇(𝟐) ≡ 𝟗 (𝒎𝒐𝒅 𝟗) ≡ 𝟎 (𝒎𝒐𝒅 𝟗)
𝒇(−𝟑) ≡ −𝟑𝟔 (𝒎𝒐𝒅 𝟗) ≡ 𝟎 (𝒎𝒐𝒅 𝟗)
𝑓(3) ≡ 30 (𝑚𝑜𝑑 9) ≡ 3 (𝑚𝑜𝑑 9)
Roots of the given polynomial congruence are
𝑥 ≡ 1(𝑚𝑜𝑑 9), 𝑥 ≡ 2(𝑚𝑜𝑑 9), 𝑥 ≡ −3(𝑚𝑜𝑑 9)
(or)
𝑥 ≡ 1(𝑚𝑜𝑑 9), 𝑥 ≡ 2(𝑚𝑜𝑑 9), 𝑥 ≡ 6 (𝑚𝑜𝑑 9)
Maths dept. Dr. HNNCE, Bengaluru-70 33
4.9 Chinese remainder theorem
Introduction
The system of linear equations 𝑥 ≡ 𝑎1 (𝑚𝑜𝑑 𝑚1 ), 𝑥 ≡ 𝑎2 (𝑚𝑜𝑑 𝑚2 ), … ,
𝑥 ≡ 𝑎𝑛 (𝑚𝑜𝑑 𝑚𝑛 ) has a solution 𝑥 ≡ 𝑎 (𝑚𝑜𝑑 𝑀).
Where 𝑎 = 𝑎1 𝑀1 𝑀1−1 + 𝑎2 𝑀2 𝑀2−1 + ⋯ + 𝑎𝑛 𝑀𝑛 𝑀𝑛−1,
𝑀
𝑀 = 𝑚1 𝑚2 … 𝑚𝑛 , 𝑀𝑖 = 𝑚 𝑎𝑛𝑑 𝑀𝑖 𝑀𝑖−1 ≡ 1 (𝑚𝑜𝑑 𝑀).
𝑖
1. Solve the following system of linear congruences using CRT
𝒙 ≡ 𝟐 (𝒎𝒐𝒅 𝟑), 𝒙 ≡ 𝟑 (𝒎𝒐𝒅 𝟓), 𝒙 ≡ 𝟐 (𝒎𝒐𝒅 𝟕).
Find 𝑴𝒊
𝑀 = 𝑚1 𝑚2 𝑚3 = 3.5.7 = 105
3.5.7 3.5.7 3.5.7
𝑀1 = = 35, 𝑀2 = = 21, 𝑀3 = = 15 .
3 5 7
Find 𝑴−𝟏
𝒊
𝑀1 𝑀1−1 ≡ 1 (𝑚𝑜𝑑 𝑚1 ) 𝑀2 𝑀2−1 ≡ 1 (𝑚𝑜𝑑 𝑚2 ) 𝑀3 𝑀3−1 ≡ 1 (𝑚𝑜𝑑 𝑚3 )
35𝑀1−1 ≡ 1 (𝑚𝑜𝑑 3) 21𝑀2−1 ≡ 1 (𝑚𝑜𝑑 5) 15𝑀3−1 ≡ 1 (𝑚𝑜𝑑 7)
2𝑀1−1 ≡ 1 (𝑚𝑜𝑑 3) 𝑀2−1 ≡ 1 (𝑚𝑜𝑑 5) 𝑀3−1 ≡ 1 (𝑚𝑜𝑑 7)
−𝑀1−1 ≡ 1 (𝑚𝑜𝑑 3)
𝑀1−1 ≡ −1 (𝑚𝑜𝑑 3)
𝑀1−1 ≡ 2 (𝑚𝑜𝑑 3)
Find 𝒂
𝑎𝑖 𝑀𝑖 𝑀𝑖−1 𝑎𝑖 𝑀𝑖 𝑀𝑖−1
2 35 2 140
3 21 1 63
2 15 1 30
- - - 𝑎 = 233
𝑎 = 𝑎1 𝑀1 𝑀−1 −1 −1
1 + 𝑎2 𝑀2 𝑀2 + ⋯ + 𝑎𝑛 𝑀𝑛 𝑀𝑛 = 233.
Conclusion
Solution is 𝑥 ≡ 𝑎 (𝑚𝑜𝑑 𝑀).
𝑥 ≡ 233 (𝑚𝑜𝑑 105) ≡ 23 (𝑚𝑜𝑑 105).
Maths dept. Dr. HNNCE, Bengaluru-70 34
2. Solve the following system of linear congruences using CRT
𝒙 ≡ 𝟑 (𝒎𝒐𝒅 𝟖), 𝒙 ≡ 𝟓 (𝒎𝒐𝒅 𝟗), 𝒙 ≡ 𝟔 (𝒎𝒐𝒅 𝟕).
Find 𝑴𝒊
𝑀 = 𝑚1 𝑚2 𝑚3 = 8.9.7 = 504
8.9.7 8.9.7 8.9.7
𝑀1 = = 63, 𝑀2 = = 56, 𝑀3 = = 72 .
8 9 7
Find 𝑴−𝟏
𝒊
𝑀1 𝑀1−1 ≡ 1 (𝑚𝑜𝑑 𝑚1 ) 𝑀2 𝑀2−1 ≡ 1 (𝑚𝑜𝑑 𝑚2 ) 𝑀3 𝑀3−1 ≡ 1 (𝑚𝑜𝑑 𝑚3 )
63𝑀1−1 ≡ 1 (𝑚𝑜𝑑 8) 56𝑀2−1 ≡ 1 (𝑚𝑜𝑑 9) 72𝑀3−1 ≡ 1 (𝑚𝑜𝑑 7)
7𝑀1−1 ≡ 1 (𝑚𝑜𝑑 8) 2𝑀2−1 ≡ 1 (𝑚𝑜𝑑 9) 2𝑀3−1 ≡ 1 (𝑚𝑜𝑑 7)
−𝑀1−1 ≡ 1 (𝑚𝑜𝑑 8) 2𝑀2−1 ≡ −8 (𝑚𝑜𝑑 9) 2𝑀3−1 ≡ −6 (𝑚𝑜𝑑 7)
𝑀1−1 ≡ −1 (𝑚𝑜𝑑 8) 𝑀2−1 ≡ −4 (𝑚𝑜𝑑 9) 𝑀3−1 ≡ −3 (𝑚𝑜𝑑 7)
𝑀1−1 ≡ 7 (𝑚𝑜𝑑 8) 𝑀2−1 ≡ 5 (𝑚𝑜𝑑 9) 𝑀3−1 ≡ 4 (𝑚𝑜𝑑 7)
Find 𝒂
𝑎𝑖 𝑀𝑖 𝑀𝑖−1 𝑎𝑖 𝑀𝑖 𝑀𝑖−1
3 63 7 1323
5 56 5 1400
6 72 4 1728
- - - 𝑎 = 4451
𝑎 = 𝑎1 𝑀1 𝑀−1 −1 −1
1 + 𝑎2 𝑀2 𝑀2 + 𝑎3 𝑀3 𝑀3 = 4451.
Conclusion
Solution is 𝑥 ≡ 𝑎 (𝑚𝑜𝑑 𝑀).
𝑥 ≡ 4451 (𝑚𝑜𝑑 504) ≡ 419 (𝑚𝑜𝑑 504).
Maths dept. Dr. HNNCE, Bengaluru-70 35
3. Solve the following system of linear congruences using CRT
𝒙 ≡ 𝟓 (𝒎𝒐𝒅 𝟑), 𝒙 ≡ 𝟐 (𝒎𝒐𝒅 𝟓), 𝒙 ≡ 𝟏 (𝒎𝒐𝒅 𝟏𝟏).
Find 𝑴𝒊
𝑀 = 𝑚1 𝑚2 𝑚3 = 3.5.11 = 165
3.5.11 3.5.11 3.5.11
𝑀1 = = 55, 𝑀2 = = 33, 𝑀3 = = 15 .
3 5 11
Find 𝑴−𝟏
𝒊
𝑀1 𝑀1−1 ≡ 1 (𝑚𝑜𝑑 𝑚1 ) 𝑀2 𝑀2−1 ≡ 1 (𝑚𝑜𝑑 𝑚2 ) 𝑀3 𝑀3−1 ≡ 1 (𝑚𝑜𝑑 𝑚3 )
55𝑀1−1 ≡ 1 (𝑚𝑜𝑑 3) 33𝑀2−1 ≡ 1 (𝑚𝑜𝑑 5) 15𝑀3−1 ≡ 1 (𝑚𝑜𝑑 11)
𝑀1−1 ≡ 1 (𝑚𝑜𝑑 3) 3𝑀2−1 ≡ 1 (𝑚𝑜𝑑 5) 4𝑀3−1 ≡ −10 (𝑚𝑜𝑑 11)
−2𝑀2−1 ≡ −4 (𝑚𝑜𝑑 5) 2𝑀3−1 ≡ −5 (𝑚𝑜𝑑 11)
𝑀1−1 ≡ 2 (𝑚𝑜𝑑 5) 2𝑀3−1 ≡ 6 (𝑚𝑜𝑑 11)
𝑀3−1 ≡ 3 (𝑚𝑜𝑑 11)
Find 𝒂
𝑎𝑖 𝑀𝑖 𝑀𝑖−1 𝑎𝑖 𝑀𝑖 𝑀𝑖−1
5 55 1 275
2 33 2 132
1 15 3 45
𝑎 = 452
𝑎 = 𝑎1 𝑀1 𝑀−1 −1 −1
1 + 𝑎2 𝑀2 𝑀2 + ⋯ + 𝑎𝑛 𝑀𝑛 𝑀𝑛 = 452.
Conclusion
Solution is 𝑥 ≡ 𝑎 (𝑚𝑜𝑑 𝑀).
𝑥 ≡ 452 (𝑚𝑜𝑑 165) ≡ 122 (𝑚𝑜𝑑 165).
Maths dept. Dr. HNNCE, Bengaluru-70 36
4. Solve the following system of linear congruences using CRT
𝟒𝒙 ≡ 𝟓 (𝒎𝒐𝒅 𝟗), 𝟐𝒙 ≡ 𝟔 (𝒎𝒐𝒅 𝟐𝟎).
By data,
4𝑥 ≡ 5 (𝑚𝑜𝑑 9) 2𝑥 ≡ 6 (𝑚𝑜𝑑 20)
4𝑥 ≡ −4 (𝑚𝑜𝑑 9) 𝑥 ≡ 3 (𝑚𝑜𝑑 10)
𝑥 ≡ −1 (𝑚𝑜𝑑 9)
𝑥 ≡ 8 (𝑚𝑜𝑑 9)
That is enough to solve 𝑥 ≡ 8 (𝑚𝑜𝑑 9), 𝑥 ≡ 3 (𝑚𝑜𝑑 10).
Find 𝑴𝒊
𝑀 = 𝑚1 𝑚2 = 9.10 = 90
9.10 9.10
𝑀1 = = 10, 𝑀2 = = 9.
9 10
Find 𝑴−𝟏
𝒊
𝑀1 𝑀1−1 ≡ 1 (𝑚𝑜𝑑 𝑚1 ) 𝑀2 𝑀2−1 ≡ 1 (𝑚𝑜𝑑 𝑚2 )
10𝑀1−1 ≡ 1 (𝑚𝑜𝑑 9) 9𝑀2−1 ≡ 1 (𝑚𝑜𝑑 10)
𝑀1−1 ≡ 1 (𝑚𝑜𝑑 9) −𝑀2−1 ≡ −9 (𝑚𝑜𝑑 10)
𝑀2−1 ≡ 9 (𝑚𝑜𝑑 10)
Find 𝒂
𝑎𝑖 𝑀𝑖 𝑀𝑖−1 𝑎𝑖 𝑀𝑖 𝑀𝑖−1
8 10 1 80
3 9 9 243
- - - 𝑎 = 323
𝑎 = 𝑎1 𝑀1 𝑀−1 −1
1 + 𝑎2 𝑀2 𝑀2 = 323.
Conclusion
Solution is 𝑥 ≡ 𝑎 (𝑚𝑜𝑑 𝑀).
𝑥 ≡ 323 (𝑚𝑜𝑑 90) ≡ 53 (𝑚𝑜𝑑 90).
Maths dept. Dr. HNNCE, Bengaluru-70 37
4.10 RSA Algorithm
Select 2 large prime numbers ′𝑝′ and ′𝑞′
Find 𝑛 = 𝑝 × 𝑞
Find 𝜙(𝑛) = (𝑝 − 1)(𝑞 − 1)
Choose 𝑒 such that 1 < 𝑒 < 𝜙(𝑛) and (𝜙(𝑛), 𝑒) = 1
Find 𝑑 such that 𝑑𝑒 ≡ 1 (𝑚𝑜𝑑 𝜙(𝑛))
Public key= {𝑒, 𝑛}
Private key= {𝑑, 𝑛}
Encryption: 𝑐 ≡ 𝑀𝑒 (𝑚𝑜𝑑 𝑛)
Decryption: 𝑀 ≡ 𝑐 𝑑 (𝑚𝑜𝑑 𝑛)
1. Using RSA algorithm find public key and private key with respect to 𝒑 = 𝟑, 𝒒 =
𝟏𝟏 and 𝑴 = 𝟑𝟏.
𝑛 = 𝑝𝑞 = (3)(11) = 33.
𝜙(𝑛) = (𝑝 − 1)(𝑞 − 1) = (2)(10) = 20.
Choose 𝑒 = 7 such that 1 < 7 < 20 and (20, 7) = 1.
Find 𝑑 such that 𝑑𝑒 ≡ 1 (𝑚𝑜𝑑 20)
7𝑑 ≡ 1 (𝑚𝑜𝑑 20)
20𝑘+1
𝑑= = 3 𝑓𝑜𝑟 𝑘 = 1.
7
Public key= {𝑒, 𝑛} = {7, 33}
Private key= {𝑑, 𝑛} = {3, 33}
2. In RSA algorithm if 𝒑 = 𝟕, 𝒒 = 𝟏𝟏 and 𝒆 = 𝟏𝟑 then what will be the value of 𝒅?
𝑛 = 𝑝𝑞 = 7(11) = 77.
𝜙(𝑛) = (𝑝 − 1)(𝑞 − 1) = 6(10) = 60.
Find 𝑑 such that 𝑑𝑒 ≡ 1 (𝑚𝑜𝑑 60)
13𝑑 ≡ 1 (𝑚𝑜𝑑 60)
13𝑑 = 60𝑘 + 1.
60𝑘+1
𝑑= = 37 for 𝑘 = 8.
13
Maths dept. Dr. HNNCE, Bengaluru-70 38
3. Encode STOP using RSA algorithm with key (𝟐𝟓𝟑𝟕, 𝟏𝟑) and 𝒑 = 𝟒𝟑, 𝒒 = 𝟓𝟗.
By data, 𝑛 = 2537, 𝑒 = 13.
𝜙(𝑛) = (𝑝 − 1)(𝑞 − 1) = (42)(58) = 2436.
𝑀 = 𝑆𝑇𝑂𝑃 = 1819 1415
Let 𝑀1 = 1819, 𝑀2 = 1415.
Encryption: 𝑐1 ≡ 𝑀1𝑒 (𝑚𝑜𝑑 𝑛)
≡ 181913 (𝑚𝑜𝑑 2537)
≡ 20684 × 1819 (𝑚𝑜𝑑 2537)
≡ 17792 × 1819(𝑚𝑜𝑑 2537)
≡ 1202 × 1819 (𝑚𝑜𝑑 2537)
≡ 2081 (𝑚𝑜𝑑 2537)
𝑐2 ≡ 𝑀2𝑒 (𝑚𝑜𝑑 𝑛)
≡ 141513 (𝑚𝑜𝑑 2537)
≡ 18284 × 1415 (𝑚𝑜𝑑 2537)
≡ 3552 × 1415(𝑚𝑜𝑑 2537)
≡ 1712 × 1415 (𝑚𝑜𝑑 2537)
≡ 2182 (𝑚𝑜𝑑 2537)
Therefore, 𝑐 = 𝑐1 𝑐2 = 20 8 1 21 8 2 = 𝑈𝐼𝐵𝑉𝐼𝐶
Maths dept. Dr. HNNCE, Bengaluru-70 39
4. If 𝒑 = 𝟑, 𝒒 = 𝟏𝟏 and private key 𝒅 = 𝟕 find the private key using RSA algorithm
and hence encrypt the number 19.
𝑛 = 𝑝𝑞 = 3(11) = 33
𝜙(𝑛) = (𝑝 − 1)(𝑞 − 1) = 2(10) = 20.
Find 𝑒 such that 𝑑𝑒 ≡ 1 (𝑚𝑜𝑑 𝜙(𝑛))
7𝑒 ≡ 1 (𝑚𝑜𝑑 20)
20𝑘+1
𝑒= = 3 for 𝑘 = 1
7
By data, 𝑀 = 19 = 𝐵𝐽
Encryption: 𝑐 ≡ 𝑀𝑒 (𝑚𝑜𝑑 𝑛)
≡ 193 (𝑚𝑜𝑑 33)
≡ 6859 (𝑚𝑜𝑑 33) ≡ 28 (𝑚𝑜𝑑 33)
Therefore, 𝑐 = 28 = 𝐶𝐼
Maths dept. Dr. HNNCE, Bengaluru-70 40
5. Using RSA algorithm decrypt 09810461 using 𝒅 = 𝟗𝟑𝟕 and 𝒑 = 𝟒𝟑, 𝒒 = 𝟓𝟗.
𝑛 = 𝑝𝑞 = (43)(59) = 2537
𝜙(𝑛) = (𝑝 − 1)(𝑞 − 1) = (42)(58) = 2436.
By data, 𝑐 = 0981 0461
𝑀1 ≡ 𝐶1𝑑 (𝑚𝑜𝑑 𝑛)
𝑀1 ≡ 981937 (𝑚𝑜𝑑 2537)
≡ 90312 × 981 (𝑚𝑜𝑑 2537)
≡ 64378 × 981 (𝑚𝑜𝑑 2537)
≡ 55126 × 981 (𝑚𝑜𝑑 2537)
≡ 169813 × 981 (𝑚𝑜𝑑 2537)
≡ 11726 × 1698 × 981 (𝑚𝑜𝑑 2537)
≡ 10673 × 1698 × 981 (𝑚𝑜𝑑 2537)
≡ 1423 × 1698 × 981 (𝑚𝑜𝑑 2537)
≡ 0704 (𝑚𝑜𝑑 2537)
𝑀2 ≡ 𝐶2𝑑 (𝑚𝑜𝑑 𝑛)
𝑀2 ≡ 461937 (𝑚𝑜𝑑 2537)
≡ 852312 (𝑚𝑜𝑑 2537)
≡ 220478 × 461 (𝑚𝑜𝑑 2537)
≡ 253526 × 461 (𝑚𝑜𝑑 2537)
≡ 413 × 461 (𝑚𝑜𝑑 2537)
≡ 140 × 461 (𝑚𝑜𝑑 2537)
≡ 1115 (𝑚𝑜𝑑 2537)
Therefore, 𝑀 = 07 04 11 15 = 𝐻𝐸𝐿𝑃
Maths dept. Dr. HNNCE, Bengaluru-70 41