CIS 5371 Cryptography 6*. An Introduction to Number Theory 1 Congruence and Residue classes Arithmetic modulo n, Zn Solving linear equations The Chinese Remainder Theorem Euler’s phi function The theorems of Fermat and Euler Quadratic residues Legendre & Jacobi symbols 2 3 Solving linear equations 4 The Chinese Remainder Theorem Let m1 , , mn be positive integers with gcd( mi , m j ) 1, and let M m1m 2 mr . Then the congruence x c1 (mod m1 ) x c2 (mod m2 ) x cr (mod mr ) has a unique solution z Z M . 5 The Chinese Remainder Theorem Let ( M / mi ). yi 1 (mod mi ). Then for zi ( M / mi ). yi it is easy to see that z i 1 zi ci (mod M ) r is a solution. 6 Example Solve the modular conguence : x 2 (mod 3) x 3 (mod 5) x 4 (mod 7) We have : M 105, y1 35 1 (mod 3) 2 (mod 3) y 2 211 (mod 5) 1 (mod 5) y3 15 1 (mod 7) 1 (mod 7) Then z 2 35 2 3 21 1 4 15 1 263 mod 105 53 mod 105 7 Example Solve the modular conguence : x 1 (mod 2) x 2 (mod 5) x 3 (mod 7) 8 Euler’s phi function (n) is the number of positive integers k for which gcd( k,n) 1. We have (1) 1 ( p) p 1, p a prime, ( pq) ( p-1)( q-1), for p,q primes, ( p ) p p e e e 1 1 p (1 ), p a prime, e 1. p e It follows that if n p1 1 p1 2 p1 1 , is the prime e e e factorizat ion of n, then 1 1 1 (n) n (1 ) (1 ) (1 ). p1 p2 pk 9 The theorems of Fermat and Euler 10 Legendre & Jacobi symbols Let QR p be the set of quadratic residues mod p and let QNR p Z p \ QR p be the set of quadratic nonresidue s. For x Z p , p prime, the Legendre symbol of x mod p is : 1 if x QR p x p 1 if x QNR p Let n p1 p2 pk be the prime factorizat ion of n. For x Z n , the Jacobi symbol of n mod p is : x n x x x p1 p2 pk 11 Legendre & Jacobi symbols It is easy to see that x x ( p1) / 2 (mod p ), for p prime. p 12 Legendre & Jacobi symbols We have : 1 xy x y 1, and n n n n x x x mn m n x y If x y (mod n) then n n For m, n odd : 1 (n -1)/2 (-1) n 2 (n 2 -1)/8 (-1) n m n If gcd( m,n) 1 and m, n 2 then (-1)(m-1)(n -1)/4 n m 13 Example 4 7 Compute and 15 15 14