Module_5 Math
Module_5 Math
Modular Arithmetic
Notations:
𝑍 = {0, ± 1, ± 2, ± 3 … }
𝑁 = {1, 2, 3, … }
Let 𝑎, 𝑏 ∈ 𝑍, we say that, a divides b if there exist 𝑞 ∈ 𝑍 such that 𝑏 = 𝑞𝑎, 𝑤ℎ𝑒𝑟𝑒 𝑎 ≠ 0 and
is denoted by 𝑎 𝑏
gcd: If a & b are two numbers, gcd of a & b is found by successive division
Ex: gcd(625, 1000)=125
Prime number: A number 𝑝 > 1(∈ 𝑁) is called a prime number if 1 & p are the only divisors
of p and Non-Prime numbers are called Composite numbers.
Relatively prime numbers: If 𝑎, 𝑏 ∈ 𝑁, & 𝑔𝑐𝑑(𝑎, 𝑏) = 1, then a & b are said to be relatively
prime or co-prime to each other.
Congruences: If 𝑎, 𝑏, 𝑚 ∈ 𝑍, 𝑚 ≠ 0, we say that a is congruent to b modulo m if m divides (a-
b) and the same is represented as 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚)
i.e. 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚) 𝑚 (𝑎 − 𝑏)
Linear congruences: A congruence of the form 𝑎𝑥 ≡ 𝑏(𝑚𝑜𝑑 𝑚) where 𝑎 ≠ 0 is called a
linear congruence.
Note:
• Every linear congruence need not have a solution.
• A linear congruence has a solution iff gcd(a, m) divides b.
• If gcd(a, m)=d and 𝑑 𝑏, then the linear congruence has exactly d solutions given by
𝑚
𝑥 = 𝑥0 + 𝑘 ( 𝑑 ) , 𝑘 = 0, 1, 2, 3 … (𝑑 − 1) 𝑤ℎ𝑒𝑟𝑒 𝑥0 is a solution of 𝑎𝑥 ≡ 𝑏(𝑚𝑜𝑑 𝑚)
Problems:
1. Find the least positive value of x such that 𝟖𝟗 ≡ (𝒙 + 𝟑)(𝒎𝒐𝒅 𝟒) is satisfied.
Solution: 89 ≡ (𝑥 + 3)(𝑚𝑜𝑑 4)
89 − (𝑥 + 3) 𝑖𝑠 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 4
So 𝑥 = 2 is the value that satisfies the congruence.
2. If 𝟑𝒙 ≡ 𝟐(𝒎𝒐𝒅 𝟕) find x such that 𝟗 ≤ 𝒙 ≤ 𝟑𝟎
Solution: 3𝑥 ≡ 2(𝑚𝑜𝑑 7)
2 + 7𝑘
𝑥=
3
For 𝑘 = 4, 7, 10 𝑥 = 10, 17, 24
3. Find any four values of x satisfying 𝟐𝟔 ≡ 𝟏𝟐(𝒎𝒐𝒅 𝒙)
Solution: 26 ≡ 12(𝑚𝑜𝑑 𝑥)
26 − 12 = 52 which is divisible by x
∴ 𝑇ℎ𝑒 𝑣𝑎𝑙𝑢𝑒𝑠 𝑎𝑟𝑒 𝑥 = 2, 4, 13 , 26
4. Find the remainder when 13514673 is divided by 7.
Solution: 135 ≡ 2(𝑚𝑜𝑑 7)
74 ≡ 4(𝑚𝑜𝑑 7)
48 ≡ 6(𝑚𝑜𝑑 7)
13514673 ≡ 2 × 4 × 6(𝑚𝑜𝑑 7)
5. Find the remainder when 𝟒𝟖 is divided by 23.
Solution: 44 ≡ 3(𝑚𝑜𝑑 23)
48 ≡ 9(𝑚𝑜𝑑 23)
Note: If n is any number, such that 𝑛 ≡ 𝑥(𝑚𝑜𝑑 10), then x is the last digit(unit digit) in the
number n.
6. Find the last digit of 𝟕𝟐𝟎𝟏𝟑
Solution: 72 ≡ 9(𝑚𝑜𝑑 10)
74 ≡ 1(𝑚𝑜𝑑 10)
(74 )502 ≡ 1(𝑚𝑜𝑑 10)
72008 ≡ 1(𝑚𝑜𝑑 10)
72 ≡ 9(𝑚𝑜𝑑 10)
73 ≡ 3(𝑚𝑜𝑑 10)
72013 ≡ 7(𝑚𝑜𝑑 10)
7. Examine whether the following congruences possess a solution. If so find the
number of solutions.
i. 𝟑𝒙 ≡ 𝟓(𝒎𝒐𝒅 𝟕)
Solution: 3𝑥 ≡ 5(𝑚𝑜𝑑 7)
gcd(3, 7) = 1
The congruence has one solution
ii. 𝟏𝟎𝒙 ≡ 𝟏𝟓(𝒎𝒐𝒅 𝟑𝟓)
Solution: gcd(10, 35) = 5
The congruence has five solutions
iii. 𝟏𝟐𝒙 ≡ 𝟕(𝒎𝒐𝒅 𝟐𝟏)
Solution:
gcd(12, 21) = 3
The congruence has no solution
Note: If 𝑎 ≡ 𝑏(𝑚𝑜𝑑 𝑚) and 𝑐 ≡ 𝑑(𝑚𝑜𝑑 𝑚) then (𝑎 ± 𝑐) ≡ (𝑏 ± 𝑑)(𝑚𝑜𝑑 𝑚)
8. Solve the following linear congruences
i. 𝟕𝒙 ≡ 𝟒(𝒎𝒐𝒅 𝟏𝟎)
Solution: 7𝑥 ≡ 4(𝑚𝑜𝑑 10) ------(1)
gcd(7, 10) = 1
Multiple of 10 to which 4 is added is divisible by 7 is 10
So 0 ≡ 10(mod 10)-----(2)
7x ≡ 14(mod 10)
x ≡ 2(mod 10)
ii. 𝟓𝟏𝒙 ≡ 𝟑𝟐(𝒎𝒐𝒅 𝟕)
Solution:
gcd(51, 7) = 1
Multiple of 7 to which 32 is added is divisible by 51 is 70
So 0 ≡ 70(mod 7)-----(2)
51x ≡ 102(mod 7)
x ≡ 2(mod 7)
iii. 15𝑥 ≡ 12(𝑚𝑜𝑑 21)
9. Find all the solutions of the following
i. 𝟏𝟓𝒙 ≡ 𝟏𝟐(𝒎𝒐𝒅 𝟐𝟏)
Solution:
15𝑥 ≡ 12(𝑚𝑜𝑑 21)
Conguence of degree n:
Let 𝑓(𝑥) = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2 + ⋯ 𝑎𝑛 𝑥 𝑛 be a polynomial of degree n with integral coefficients
and n be a positive integer
If m does not divide 𝑎𝑛 , then 𝑓(𝑥) ≡ 0(𝑚𝑜𝑑 𝑚) is called a polynomial congruence of degree
n.
An integer k is said to be a solution of the polynomial congruence iff 𝑓(𝑘) ≡ 0(𝑚𝑜𝑑 𝑚)
Lagrange’s theorem: 𝑓(𝑥) ≡ 0(𝑚𝑜𝑑 𝑚) of degree 𝑛 ≥ 1 has at most n solutions.
Solve the following:
i. 𝒙𝟐 + 𝟑𝒙 − 𝟒 = 𝟎(𝒎𝒐𝒅 𝟑)
Solution:
ii. 2𝑥 2 − 3𝑥 + 1 = 0(𝑚𝑜𝑑 5)
iii. 𝑥 2 + 2𝑥 − 3 = 0(𝑚𝑜𝑑 9)
iv. 𝑥 2 + 𝑥 + 11 = 0(𝑚𝑜𝑑 15)
v. 𝑥 2 + 7𝑥 + 10 = 0(𝑚𝑜𝑑 11)
vi. 5𝑥 2 − 6𝑥 + 2 = 0(𝑚𝑜𝑑 13)
Linear Diophantine equation(LDE): The equation ax+by=c where a, b, c are all integers is
called a Linear Diophantine equation.
The integers x, y satisfying ax+by=c constitutes a solution of LDE
NoteL LDE has a solution iff gcd(a, b) =d & d divides c
If a & b are relatively prime and x=x0, y=y0 is a solution of LDE, then all the solutions are
given by x=x0+kb, y=y0-ka for all integral values of k
1. Find the solution of the following LDE
i. 𝟏𝟓𝒙 + 𝟕𝒚 = 𝟏𝟏𝟏
Solution:
ii. 𝟏𝟖𝒙 + 𝟓𝒚 = 𝟒𝟖
Solution:
iii. 𝟓𝒙 + 𝟏𝟏𝒚 = 𝟗𝟐
Solution:
System of linear congruences: The System of linear congruences
𝑎𝑥 + 𝑏𝑦 ≡ 𝑝(𝑚𝑜𝑑𝑚)
𝑐𝑥 + 𝑑𝑦 ≡ 𝑞(𝑚𝑜𝑑𝑚)
Possess a unique solution modulo m, where gcd(ad-bc, m)=1
The solution is obtained by eliminating x & y independently
Solve the following system of linear congruences
i. 𝟐𝒙 + 𝟔𝒚 ≡ 𝟏(𝒎𝒐𝒅𝟕)
𝟒𝒙 + 𝟑𝒚 ≡ 𝟐(𝒎𝒐𝒅𝟕)
Solution:
i. 𝟕𝒙 + 𝟑𝒚 ≡ 𝟏𝟎(𝒎𝒐𝒅𝟏𝟔)
𝟐𝒙 + 𝟓𝒚 ≡ 𝟗(𝒎𝒐𝒅𝟏𝟔)
Solution:
Euler’s function:
The number of integers less than n and co-prime to n is called Euler’s function denoted by
(n)
Properties:
• If n is a prime number, ∅(𝑛) = 𝑛 − 1
• If a and b are relatively prime then ∅(𝑎𝑏) = ∅(𝑎) ∅(𝑏)
1
• If 𝑝1 , 𝑝2 , … 𝑝𝑘 are distinct prime factors of an integer n, then ∅(𝑛) = 𝑛 (1 − 𝑝 ) (1 −
1
1 1 1
) (1 − 𝑝 ) … (1 − 𝑝 )
𝑝2 3 𝑘
For every user there is one private key kept secretly and one public key known to al l
the users. The private key is used to decrypt the messages from other user and the public key
is used by everyone else to encrypt messages for that user.
Encryption uses an algorithm and a key to transform an input (plain text) into an encrypted
output(cipher text)
RSA is an algorithm in which plain text and cipher texts are integers between 0 and (n-1) for
some n.
A B C D E … Z
0 1 2 3 4 25
RSA Algorithm:
Given a plain text M(say)
• Select two large prime numbers say p & q
• Compute n=pq
• Compute ∅(𝑛) = (𝑝 − 1)(𝑞 − 1)
• Choose e such that 1<e< ∅(𝑛) such that gcd(∅(𝑛), 𝑒) = 1
• Find d such that 𝑒𝑑 ≡ 1(𝑚𝑜𝑑 ∅(𝑛))
• Public key ={e, n} and private key={d, n}
• Encryption is 𝐶 ≡ 𝑀𝑒 (𝑚𝑜𝑑 𝑛), 𝑀 < 𝑛
Decryption is 𝑀 ≡ 𝐶 𝑑 (𝑚𝑜𝑑 𝑛) where M is the plain text and C is Cipher text
1. In a RSA algorithm, given p=7, q=11 & e=13, determine the value of d, public
key & private keys
Solution:
2. In a RSA algorithm, given p=3, q=11, find the public key when d=7. Also encrypt
the number 19
Solution:
3. In a RSA crypto system, a participant uses two prime numbers p =13, q=17 to
generate public and private keys. If the public key of A is 35, then what is the
private key of A.