UNIT - II (Part 1)
UNIT - II (Part 1)
a=q×n+r
Examples
17 mod 5 = 2 7 mod 11 = 7
20 mod 3 = 2 11 mod 11 = 0
-3 mod 11 = 8 -1 mod 11 = 10
25 mod 5 = 0 -11 mod 11 = 0
Solution
Solution:
(0, 0), (1, 9), (2, 8), (3, 7), (4, 6), and (5, 5).
⇒ gcd (a,n) = 1.
Faculty Name : Dr. Amrita 18
Example
Find the multiplicative inverse of 8 in Z10.
Solution:
There is no multiplicative inverse because gcd (10, 8) =
2 ≠ 1. In other words, we cannot find any number
between 0 and 9 such that when multiplied by 8, the
result is congruent to 1.
Solution :
(1, 1), (2, 6), (3, 4), (5, 9), (7, 8), (9, 9), and
(10, 10).
gcd (a, b) = 1,
Then,
Solution : gcd( 8, 17 ):
= gcd( 17, 8 )
= gcd( 8, 17 mod 8 ) = gcd( 8, 1 )
= gcd( 1, 8 mod 1 ) = gcd( 1, 0 )
Therefore, gcd( 8, 17 ) = 1
When the smaller of the two numbers is 1 (which
happens when the two starting numbers are relatively
prime), there is no need to go to the last step in which
the smaller of the two numbers is 0.
Faculty Name : Dr. Amrita 30
Extended Euclidean Algorithm
Given two integers a and b, we often need to find
other two integers, s and t, such that
gcd (n, b) = 1.
t = t1 – q x t2 ; (Updating t’s)
t1 = t 2 ; t2 = t;
}
If ( r1 = 1 ) then b-1 = t1;
Faculty Name : Dr. Amrita 39
Extended Euclidean Process to find
multiplicative inverse
q = r1 / r2 r = r1 – q x r 2 ; t = t1 – q x t2
1. ϕ(1)=1
2. ϕ(p)=p−1 if p is prime
3. ϕ(n)=ϕ(pq)= ϕ(p)ϕ(q)=(p−1)(q−1) if p and
q are relatively prime and n=pq.
4. ϕ(pa)= pa − pa-1 if p is a prime and a is a
positive integer
ap − 1 ≡ 1 mod p
Second Version : This version removes the condition on
a. If p is prime and a is an integer, then
ap ≡ a mod p
aφ(n) ≡ 1 (mod n)
Second Version : It removes the condition that
a and n are coprime. If n=p*q, a < n, and k is
an integer, then
a k × φ(n) + 1 ≡ a (mod n)
The second version of Euler’s theorem is used in the
RSA cryptosystem
Faculty Name : Dr. Amrita 60
Example
Find the result of 624 mod 35.
Solution φ(35)= φ(7 X 5) = φ(7) X φ(5) =6 X 4=24
We have 624 mod 35 = 6φ(35) mod 35 = 1.
Example
Find the result of 2062 mod 77.
Solution : φ(77)= φ(11 X 7) = φ(7) X φ(11) =6 X 10=60
If we let k = 1 on the second version, we have
2062 mod 77
= (20 mod 77) (20φ(77) + 1 mod 77) mod 77
= (20)(20) mod 77 = 15.
Faculty Name : Dr. Amrita 61
Multiplicative Inverses
Euler’s theorem can be used to find multiplicative
inverses modulo a composite.
(First Version)