Presentation is loading. Please wait.

Presentation is loading. Please wait.

Announcements: Homework 2 due now Homework 2 due now Quiz this Friday on concepts from chapter 2 Quiz this Friday on concepts from chapter 2 Practical.

Similar presentations


Presentation on theme: "Announcements: Homework 2 due now Homework 2 due now Quiz this Friday on concepts from chapter 2 Quiz this Friday on concepts from chapter 2 Practical."— Presentation transcript:

1 Announcements: Homework 2 due now Homework 2 due now Quiz this Friday on concepts from chapter 2 Quiz this Friday on concepts from chapter 2 Practical quiz next week on breaking codes from chapter 2 Practical quiz next week on breaking codes from chapter 2Questions?Today: Congruences Congruences Chinese Remainder Theorem Chinese Remainder Theorem Modular Exponents Modular Exponents DTTF/NB479: DszquphsbqizDay 10

2 How to find x and y? To find x, take x 0 = 1, x 1 = 0, x j = x j-2 – q j-1 x j-1 To find y, take y 0 = 0, y 1 = 1, y j = y j-2 – q j-1 y j-1 Use to calculate x k and y k (the desired result) Example:gcd(5862,1856)=2 Yields x = -101, y = 319 Assume a > b Let q i and r i 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... r i-2 = q i r i-1 + r i r k-2 = q k r k-1 + r k r k-1 = q k+1 r k x and y swapped from book, which assumes that a < b on p. 69 Check: 5862(-101) + 1856(319) = 2?

3 Congruence Properties Properties

4 Solving Congruences Solve. Check with a partner.

5 Solving ax=b(mod n) when gcd(a,n)~=1 Let gcd(a,n)=d If d doesn’t divide b then no solution Else divide everything by d and solve (a/d)x=(b/d)(mod (n/d)) Get solution x 0 Multiple solutions: x 0, x 0 +n/d,x 0 +2n/d,…x 0 +(d-1)n/d This is an easy program to code once you have Euclid…  Example: 10x=4(mod 10) Other examples:

6 Can we write x = 16 (mod 35) as a system of congruences?

7 Chinese Remainder Theorem Equivalence between a single congruence mod a composite number and a system of congruences mod its factors Two-factor form Given gcd(m,n)=1. For integers a and b, there exists exactly 1 solution (mod mn) to the system: Given gcd(m,n)=1. For integers a and b, there exists exactly 1 solution (mod mn) to the system:

8 Chinese Remainder Theorem Solve: How many solutions? Find them. Find them.

9 Chinese Remainder Theorem n-factor form Let m 1, m 2,… m k be integers such that gcd(m i, m j )=1 when i ~= j. For integers a 1, … a k, there exists exactly 1 solution (mod m 1 m 2 …m k ) to the system: Let m 1, m 2,… m k be integers such that gcd(m i, m j )=1 when i ~= j. For integers a 1, … a k, there exists exactly 1 solution (mod m 1 m 2 …m k ) to the system:

10 Modular Exponentiation Compute last digit of 3^2000 Compute 3^2000 (mod 152) Technique: Repeatedly square 3, but take mod at each step. Repeatedly square 3, but take mod at each step. Matlab’s powermod() Matlab’s powermod()


Download ppt "Announcements: Homework 2 due now Homework 2 due now Quiz this Friday on concepts from chapter 2 Quiz this Friday on concepts from chapter 2 Practical."

Similar presentations


Ads by Google