chinese remainder theorem crt chinese remainder theorem
play

Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n r - PowerPoint PPT Presentation

Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n r 1 (mod m 1 ) gcd(m i , m j ) = 1 r (mod m ) r 2 (mod m 2 ) r k (mod m k ) 1 Chinese Remainder


  1. Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n  r 1 (mod m 1 ) gcd(m i , m j ) = 1   r (mod m )  r 2 (mod m 2 )  • • •  r k (mod m k )          1

  2. Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n  r 1 (mod m 1 ) gcd(m i , m j ) = 1  solution:  r (mod m )  r 2 (mod m 2 ) m = m 1 m 2 ꞏ ꞏ ꞏ m k • • •  r k (mod m k ) z i = m / m i -1  1 (mod m i ) (since gcd(z i , m i ) = 1) *  z i -1  Z mi s.t. z i ꞏ z i k k n   z i ꞏ z i -1 ꞏ r i (mod m) i=1        1

  3. Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n  r 1 (mod m 1 ) gcd(m i , m j ) = 1  solution:  r (mod m )  r 2 (mod m 2 ) m = m 1 m 2 ꞏ ꞏ ꞏ m k • • •  r k (mod m k ) z i = m / m i -1  1 (mod m i ) (since gcd(z i , m i ) = 1) *  z i -1  Z mi s.t. z i ꞏ z i k k n   z i ꞏ z i -1 ꞏ r i (mod m) i=1  ex: r 1 =1, r 2 =2, r 3 =3 1 2 3  m 1 =3, m 2 =5, m 3 =7 m = 3 ꞏ 5 ꞏ 7     1

  4. Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n  r 1 (mod m 1 ) gcd(m i , m j ) = 1  solution:  r (mod m )  r 2 (mod m 2 ) m = m 1 m 2 ꞏ ꞏ ꞏ m k • • •  r k (mod m k ) z i = m / m i -1  1 (mod m i ) (since gcd(z i , m i ) = 1) *  z i -1  Z mi s.t. z i ꞏ z i k k n   z i ꞏ z i -1 ꞏ r i (mod m) i=1  ex: r 1 =1, r 2 =2, r 3 =3 1 2 3  m 1 =3, m 2 =5, m 3 =7 m = 3 ꞏ 5 ꞏ 7 z 1 =35, z 2 =21, z 3 =15    1

  5. Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n  r 1 (mod m 1 ) gcd(m i , m j ) = 1  solution:  r (mod m )  r 2 (mod m 2 ) m = m 1 m 2 ꞏ ꞏ ꞏ m k • • •  r k (mod m k ) z i = m / m i -1  1 (mod m i ) (since gcd(z i , m i ) = 1) *  z i -1  Z mi s.t. z i ꞏ z i k k n   z i ꞏ z i -1 ꞏ r i (mod m) i=1  ex: r 1 =1, r 2 =2, r 3 =3 1 2 3  m 1 =3, m 2 =5, m 3 =7 m = 3 ꞏ 5 ꞏ 7 z 1 =35, z 2 =21, z 3 =15 35 ꞏ 2 + 3 (-23) = 1 35 2 + 3 ( 23) 1 z -1 =2 z -1 =1 z -1 =1 z 1 2, z 2 1, z 3 1  1

  6. Chinese Remainder Theorem (CRT) Chinese Remainder Theorem (CRT) n  r 1 (mod m 1 ) gcd(m i , m j ) = 1  solution:  r (mod m )  r 2 (mod m 2 ) m = m 1 m 2 ꞏ ꞏ ꞏ m k • • •  r k (mod m k ) z i = m / m i -1  1 (mod m i ) (since gcd(z i , m i ) = 1) *  z i -1  Z mi s.t. z i ꞏ z i k k n   z i ꞏ z i -1 ꞏ r i (mod m) i=1  ex: r 1 =1, r 2 =2, r 3 =3 1 2 3  m 1 =3, m 2 =5, m 3 =7 m = 3 ꞏ 5 ꞏ 7 z 1 =35, z 2 =21, z 3 =15 z -1 =2 z -1 =1 z -1 =1 z 1 2, z 2 1, z 3 1 n  35ꞏ2ꞏ1 + 21ꞏ1ꞏ2 + 15ꞏ1ꞏ3  157  52 (mod 105) 1

  7. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 ) 2

  8. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 2

  9. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2 2

  10. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2 (mod m 2 ) 2

  11. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2 (mod m 2 ) (mod m 1 ) 2

  12. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) 2

  13. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) 2

  14. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) Verification 2

  15. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) n mod m 1 = 1 Verification 2

  16. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) n mod m 1 = 1 Verification n mod m 2 = 2

  17. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2 mod m 1  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) n mod m 1 = r 1 1 1 Verification 2

  18. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) n mod m 1 = r 1 0 1 1 Verification + 2

  19. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2 mod m 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) n mod m 1 = r 1 0 1 1 Verification + n mod m 2 = r 2 2

  20. CRT, gcd(m 1 , m 2 )=1 , g ( 1 , 2 )  n  r 1 (mod m 1 )  n r 1 (mod m 1 ) gcd(m 1 , m 2 ) 1 gcd(m 1 , m 2 ) = 1  r 2 (mod m 2 )   s, t such that m 1 s + m 2 t = 1 -1 + m 2 m 2 -1 = 1 i.e. m 1 m 1 1 1 2 2  n  r 1 (m 2 m 2 -1 ) + r 2 (m 1 m 1 -1 ) (mod m 1 m 2 ) n mod m 1 = r 1 0 1 1 Verification + n mod m 2 = 0 r 2 2

  21. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3)  2 (mod 5)  3 (mod 7)  3 (mod 7) 21

  22. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3)  2 (mod 5)  3 (mod 7)  3 (mod 7) satisfying the 1 st eq ^  n 1  1 (mod 3)  n 1  1 (mod 3) … satisfying the 1 eq. r 1 22

  23. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3) n  1 (mod 3)  2 (mod 5)  2 (mod 5)  3 (mod 7)  3 (mod 7) satisfying the 1 st eq ^  n 1  1 (mod 3)  n 1  1 (mod 3) … satisfying the 1 eq. 23

  24. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3) n  1 (mod 3)  2 (mod 5)  2 (mod 5)  3 (mod 7)  3 (mod 7) satisfying the 1 st eq ^  n 1  1 (mod 3)  n 1  1 (mod 3) … satisfying the 1 eq.  3 ꞏ (-3) + 5 ꞏ 2 = 1 24

  25. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3) n  1 (mod 3)  2 (mod 5)  2 (mod 5)  3 (mod 7)  3 (mod 7) satisfying the 1 st eq ^  n 1  1 (mod 3)  n 1  1 (mod 3) … satisfying the 1 eq. inverse of 3 (mod 5)  3 ꞏ (-3) + 5 ꞏ 2 = 1 25

  26. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3) n  1 (mod 3)  2 (mod 5)  2 (mod 5)  3 (mod 7)  3 (mod 7) satisfying the 1 st eq ^  n 1  1 (mod 3)  n 1  1 (mod 3) … satisfying the 1 eq. inverse of 3 (mod 5)  3 ꞏ (-3) + 5 ꞏ 2 = 1 inverse of 5 (mod 3) 26

  27. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3) n  1 (mod 3)  2 (mod 5)  2 (mod 5)  3 (mod 7)  3 (mod 7) satisfying the 1 st eq ^  n 1  1 (mod 3)  n 1  1 (mod 3) … satisfying the 1 eq. inverse of 3 (mod 5)  3 ꞏ (-3) + 5 ꞏ 2 = 1 inverse of 5 (mod 3) ^  n 2  2 ꞏ 3 ꞏ (-3) + 1 ꞏ 5 ꞏ 2 ^ n 1 27

  28. Manually Incremental Calculation Manually Incremental Calculation n  1 (mod 3) n  1 (mod 3)  2 (mod 5)  2 (mod 5)  3 (mod 7)  3 (mod 7) satisfying the 1 st eq ^  n 1  1 (mod 3)  n 1  1 (mod 3) … satisfying the 1 eq. inverse of 3 (mod 5)  3 ꞏ (-3) + 5 ꞏ 2 = 1 inverse of 5 (mod 3) ^  n 2  2 ꞏ 3 ꞏ (-3) + 1 ꞏ 5 ꞏ 2 ^ r 2 n 1 28

Recommend


More recommend