number theory
play

Number Theory A bit more depth. . . modular arithmetic primes - PowerPoint PPT Presentation

1 Number Theory A bit more depth. . . modular arithmetic primes Euclids algorithm Chinese remainder theorem Eulers totient function Eulers theorem 2 Modular Arithmetic m; n integers, n > 0


  1. 1 Number Theory A bit more depth. . . � modular arithmetic � primes � Euclid’s algorithm � Chinese remainder theorem � Euler’s totient function � Euler’s theorem

  2. 2 Modular Arithmetic � m; n integers, n > 0 � remainder of m=n : smallest non-negative integer that differs from m by a multiple n : m = a � n + r of � C: -7 % 10 = -7 � example: 3, 13, -7, 23 have remainder 3 (/10) � equivalent if same remainder � usually use smallest positive to represent � addition: ( a + k n ) + ( b + l n ) = ( a + b ) + ( k + l ) n = a + b � multiplication: ( a + k n )( b + l n ) = ab + ( al + k b + k l n ) n

  3. 3 Primes � divisible only by itself and 1 � infinite number � if finite: multiply them together, add 1 � not divisible by any of them! � thin out 1 = ln

  4. 4 Euclid’s Algorithm � find gcd, multiplicative inverses mo d n � gcd of two integers = largest integer that divides both � relatively prime if g d( x; y ) is 1 � g d(12 ; 8) = 4 ; g d (12 ; 25) = 1 ; g d(12 ; 24) = 12 � g d(0 ; x ) = x � Euclid: replace x; y with smaller numbers until x or y = 0

  5. 5 Euclid’s Algorithm � g d( x; y ) = g d( x � y ; y ) (also divisors) y ➠ d ➠ � if d divides x; y = k d; x = j x � y = j d � k d = ( j � k ) d y ➠ d ➠ � if d divides x; x � y = k d; x � y = l x = ( k + l ) d x ➠ replace with remainder divided by � subtract ny < y � switch x; y if x < y : h x; y i ! h y ; x % y i x=y quotient remainder 595/408 1 187 � example: g d(408 ; 595) 408/187 2 34 187/34 5 17 34/17 2 0 ➠ g d(408 ; 595) = 17

  6. 6 Euclid’s Algorithm � also: g d( x; y ) = ux + v y (e.g., g d(408 ; 595) = 17 = � 16 � 408 + 11 � 595 n ➠ multiple of gcd (since � if u 0 = u + x is) � thus, x; y rp iff 9 u; v : ux + v y = 1( pmodn )

  7. 7 Euclid’s Algorithm n q r u v n n n n � 2 x 1 0 � 1 y 0 1 n b r =r r % r u � q u v � q v n � 2 n � 1 n � 2 n � 1 n � 2 n � 1 n � 2 n � 1 n n r = r � q r ; r = x � q y n n � 2 n n � 1 0 0 = u x � v y � q ( u x + v y ) n � 2 n � 2 n n � 1 n � 1 = ( u � q u ) x + ( v � q v ) y n � 2 n n � 1 n � 2 n n � 1 = u x + v y n n

  8. 8 Euclid’s Algorithm n q r u v n n n n � 2 408 1 0 � 1 595 0 1 0 0 408 1 0 1 1 187 � 1 1 2 2 34 3 � 2 3 5 17 � 16 11 4 2 0 35 � 24

  9. 9 Finding Multiplicative Inverses n ➠ � multiplicative inverse of m mo d um = 1 (mo d n ) � or um + v n = 1 for some v � use Euclid’s algorithm for g d( m; n ) to find u; v x ➠ � unique u : assume another xm = 1 (mo d n ) n ) ➠ � xmu = u (mo d x = u mo d n

  10. 10 Chinese Remainder Theorem z ; z ; : : : ; z y = x mo d z 8 k , then one can compute Theorem 1 If k are rp, and if 1 2 k k y mo d z � � � z y = x mo d z � � � z y mo d z k . If k , one can compute 1 , etc. 1 1 ➠ two representations x mo d z � � � z standard: 1 k h x mo d z ; : : : i decomposed: 1 1 ( x mo d p; x mo d q ) ! standard x mo d pq decomposed 1 2 � find u; v such that up + v q = 1 (Euclid) � x = x + k p , x = x + l q 1 2 x ➠ � x = upx + v q x mo d pq = ( x + l q ) up + ( x + k p ) v q mo d pq 2 1 � x = x up + x v q mo d pq 2 1

  11. 11 CRT Example � p = 7 ; q = 9 � 50 mo d pq = 50 mo d 63 = (1 mo d 7 ; 5 mo d 9) � find u; v for up + v q = 1 � here: 4 � 7 + ( � 3) � 9 = 1 � x = x up + x bq = 5 � 4 � 7 + 1( � 3)9 = 113 = 50 mo d 63 2 1

  12. 12 Z � n � Z n n integers mod � Z � n n = relatively prime to � Z � = f 1 ; 3 ; 7 ; 9 g 10 Z � mo d n . Theorem 2 n is closed under multiplication Proof: n ➠ � if a; b 2 Z � 9 u ; v ; u ; v u a + v n = 1 and u b + v n = 1 b such that a a b a a b b � ( u u ) ab + ( u v a + v u b + v v n ) n = 1 a b a b a b a b � ➠ ab 2 Z � n

  13. 13 Euler’s Totient Function � � ( n ) = number of elements in Z � n � � � ( p ) , with p prime, � > 0 � p are not rp to p – only multiples of – ➠ every p th number � � 1 not qualified – ➠ p � � 1 � � 1 – ➠ � � � ( p ) = p � p = ( p � 1) p ) ➠ Chinese Remainder Theorem � � ( pq

  14. 14 Euler’s Theorem � ( n ) 8 a 2 Z � ; a = 1 mo d n Theorem 3 n Proof: � multiply all � ( n ) elements of Z � ! x 2 Z � n n � 1 � x has inverse x � ( n ) a ➠ � product of all elements � a x � multiplication by a = rearrangement of entries � ( n ) � ( n ) rearrangements ➠ � a x = x � 1 ➠ result � multiply by x

  15. 15 Euler’s Theorem, Variant � ( n )+1 k 8 a 2 Z � a = a mo d n Theorem 4 n , Proof: k � ( n )+1 k � ( n ) � ( n ) k k a = a a = a a = 1 a = a n ➠ message k � 0 true also for a not rp a for n = p � q if

Recommend


More recommend