DTTFNB 479 Dszquphsbqiz Day 10 Announcements n n
DTTF/NB 479: Dszquphsbqiz Day 10 Announcements: n n n Homework 2 due now Quiz this Friday on concepts from chapter 2 Practical quiz next week on breaking codes from chapter 2 Questions? Today: n n n Congruences Chinese Remainder Theorem Modular Exponents
How to find x and y? x and y swapped from book, which assumes that a < b on p. 69 To find x, take x 0 = 1, x 1 = 0, xj = xj-2 – qj-1 xj-1 To find y, take y 0 = 0, y 1 = 1, yj = yj-2 – qj-1 yj-1 Use to calculate xk and yk (the desired result) Example: gcd(5862, 1856)=2 Yields x = -101, y = 319 Assume a > b Let qi and ri be the series of quotients and remainders, respectively, found along the way. a = q 1 b + r 1 b = q 2 r 1 + r 2 r 1 = q 3 r 2 + r 3. . . ri-2 = qiri-1 + ri rk-2 = qkrk-1 + rk rk-1 = qk+1 rk Check: 5862(-101) + 1856(319) = 2?
Congruence Properties
Solving Congruences Solve. Check with a partner.
Solving ax=b(mod n) when gcd(a, n)~=1 Let gcd(a, n)=d If d doesn’t divide b then Example: 10 x=4(mod 10) no solution Else divide everything by d and solve (a/d)x=(b/d)(mod (n/d)) Other examples: Get solution x 0 Multiple solutions: x 0, x 0+n/d, x 0+2 n/d, …x 0+(d-1)n/d This is an easy program to code once you have Euclid…
Can we write x = 16 (mod 35) as a system of congruences?
Chinese Remainder Theorem Equivalence between a single congruence mod a composite number and a system of congruences mod its factors Two-factor form n Given gcd(m, n)=1. For integers a and b, there exists exactly 1 solution (mod mn) to the system:
Chinese Remainder Theorem Solve: How many solutions? n Find them.
Chinese Remainder Theorem n-factor form n Let m 1, m 2, … mk be integers such that gcd(mi, mj )=1 when i ~= j. For integers a 1, … ak, there exists exactly 1 solution (mod m 1 m 2…mk) to the system:
Modular Exponentiation Compute last digit of 3^2000 Compute 3^2000 (mod 152) Technique: n n Repeatedly square 3, but take mod at each step. Matlab’s powermod()
- Slides: 10