FERMAT AND
EULER THEOREM
~ S. Janani, AP/CSE
KCET
Contents
• Fermats Theorem
• Proof
• Eulers Totient Function
• Eulers Theorem
• Proof
• Applications
• Example
Fermats Theorem


Proof
 Consider a set of positive integers less than ‘p’ :
• {1,2,3,…..,(p-1)} and multiply each element by ‘a’ and
‘modulo p’ , to get the set
• X = {a mod p, 2a mod p,…, (p-1)a mod p}
 No elements of X is zero and equal, since p doesn’t
divide a.
 Multiplying the numbers in both sets (p and X) and
taking the result mod p yields
Proof (Contd.,)
• Multiplying the numbers in both sets (p and X) and taking
the result mod p yields
• a * 2a *…* (p-1)a  [1 * 2 * 3 *…* (p-1)] (mod p)
• a p  1
( p  1 ) !  ( p  1) ! ( mod p)
• Thus on equating (p-1)! term from both the sides, since it
is relatively prime to p, result becomes,
An alternative form of Fermat’s Theorem is given as
 1 ( m o d p)
a p
 a ( m o d p )
a p  1
EULER TOTIENT FUNCTION : φ (n)
  (n) : How many numbers there are between 1 and n-
1 that are relatively prime to n.
  (4) = 2 (1, 3 are relatively prime to 4).
  (5) = 4 (1, 2, 3, 4 are relatively prime to 5).
  (6) = 2 (1, 5 are relatively prime to 6).
  (7) = 6 (1, 2, 3, 4, 5, 6 are relatively prime to 7).
EULER TOTIENT FUNCTION : φ (n)
 From  (5) and  (7), (n) will be n-1
whenever n is a prime number.
 This implies that  (n) will be easy to calculate when n
has exactly two different prime factors:
(P * Q) = (P-1)*(Q-1)
if P and Q are prime.
Eulers Theorem
a n  1mod n
Above equation is true if n is prime because then,
and Fermat’s theorem holds.
Consider the set of such integers, labeled as,
Here each element xi of R is unique positive integer less than n
with GCD( xi ,n ) = 1.
n  ( n 1)
Proof
• Multiply each element by a, modulo n :
The set S is permutation of R :
• Because a and xi is relatively prime to n, so multiplication
is also be relatively prime to n. Thus the elements of S are
integers that are less than n and that are relatively prime
to n.
• There are no duplicates in S.
Proof
Applications
Example
• Solve 3 ^ 21 mod 11
Quiz
• Who am I
• I can scramble the text
• One key is not enough for me
• Its more secure if you exploit me
Asymmetric Key Encryption / Public key
encryption
• Who am I
• I was designed by 3 people
• Fermats theorem is my basis
• I can perform encryption
• I need more than one key for my operation
RSA Algorithm
Quiz
• Who am I
• I was designed by 2 people
• One key is not enough for me to do my operation
• Discrete Logarithm is my basis
• I am just used to share the personal data
• I can’t hold the identity
Diffie Hellman Key Exchange Algorithm
Quiz

Fermat and euler theorem

  • 1.
    FERMAT AND EULER THEOREM ~S. Janani, AP/CSE KCET
  • 2.
    Contents • Fermats Theorem •Proof • Eulers Totient Function • Eulers Theorem • Proof • Applications • Example
  • 3.
  • 4.
    Proof  Consider aset of positive integers less than ‘p’ : • {1,2,3,…..,(p-1)} and multiply each element by ‘a’ and ‘modulo p’ , to get the set • X = {a mod p, 2a mod p,…, (p-1)a mod p}  No elements of X is zero and equal, since p doesn’t divide a.  Multiplying the numbers in both sets (p and X) and taking the result mod p yields
  • 5.
    Proof (Contd.,) • Multiplyingthe numbers in both sets (p and X) and taking the result mod p yields • a * 2a *…* (p-1)a  [1 * 2 * 3 *…* (p-1)] (mod p) • a p  1 ( p  1 ) !  ( p  1) ! ( mod p) • Thus on equating (p-1)! term from both the sides, since it is relatively prime to p, result becomes, An alternative form of Fermat’s Theorem is given as  1 ( m o d p) a p  a ( m o d p ) a p  1
  • 6.
    EULER TOTIENT FUNCTION: φ (n)   (n) : How many numbers there are between 1 and n- 1 that are relatively prime to n.   (4) = 2 (1, 3 are relatively prime to 4).   (5) = 4 (1, 2, 3, 4 are relatively prime to 5).   (6) = 2 (1, 5 are relatively prime to 6).   (7) = 6 (1, 2, 3, 4, 5, 6 are relatively prime to 7).
  • 7.
    EULER TOTIENT FUNCTION: φ (n)  From  (5) and  (7), (n) will be n-1 whenever n is a prime number.  This implies that  (n) will be easy to calculate when n has exactly two different prime factors: (P * Q) = (P-1)*(Q-1) if P and Q are prime.
  • 8.
    Eulers Theorem a n 1mod n
  • 9.
    Above equation istrue if n is prime because then, and Fermat’s theorem holds. Consider the set of such integers, labeled as, Here each element xi of R is unique positive integer less than n with GCD( xi ,n ) = 1. n  ( n 1)
  • 10.
    Proof • Multiply eachelement by a, modulo n : The set S is permutation of R : • Because a and xi is relatively prime to n, so multiplication is also be relatively prime to n. Thus the elements of S are integers that are less than n and that are relatively prime to n. • There are no duplicates in S.
  • 11.
  • 12.
  • 13.
  • 18.
    Quiz • Who amI • I can scramble the text • One key is not enough for me • Its more secure if you exploit me Asymmetric Key Encryption / Public key encryption
  • 19.
    • Who amI • I was designed by 3 people • Fermats theorem is my basis • I can perform encryption • I need more than one key for my operation RSA Algorithm Quiz
  • 20.
    • Who amI • I was designed by 2 people • One key is not enough for me to do my operation • Discrete Logarithm is my basis • I am just used to share the personal data • I can’t hold the identity Diffie Hellman Key Exchange Algorithm Quiz