Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computing k th Roots Quickly (4/4) Via the Fast Exp algorithm, we know we can quickly compute large powers of large numbers modulo large numbers. What.

Similar presentations


Presentation on theme: "Computing k th Roots Quickly (4/4) Via the Fast Exp algorithm, we know we can quickly compute large powers of large numbers modulo large numbers. What."— Presentation transcript:

1 Computing k th Roots Quickly (4/4) Via the Fast Exp algorithm, we know we can quickly compute large powers of large numbers modulo large numbers. What about finding roots rather than powers? Specifically, can we quickly solve the congruence x k  b (mod m) ? Said another way, can we quickly find the k th root of b modulo m, that is, can we find a positive number u such that (b u ) k  b (mod m) ? The answer is (sort of) yes, and the technique is a beautiful application of the Euler-Fermat Theorem and the Extended Euclidean Algorithm (which we already know is fast) applied to k and  (m).

2 How It Works Recall: Theorem (Euler-Fermat). If GCD(b, m) = 1, then b  (m)  1 (mod m). Recall: If GCD(k,  (m)) = 1, then using the Extended Euclidean Algorithm, we can write 1 as a linear combination of k and  (m), i.e., we can find u and v such that u k + v  (m) = 1, and moreover, by adding or subtracting multiples of  (m), we can assure that 1  u <  (m). But now, combining these two ideas, and provided that GCD(b, m) = 1 and GCD(k,  (m)) = 1, we get b = b u k + v  (m) = (b u ) k (b  (m) ) v  (b u ) k (1) v = (b u ) k (mod m), i.e., b u is the k th root of b modulo m.

3 An Example What is the 7 th root of 5 modulo 77? We first check the two necessary conditions: Are 5 and 77 relatively prime? Yes, so we can apply E-F. Also, are 7 and  (77) = 60 relatively prime? Yes. Running the EEA, we get (-17)(7) + (2)(60) = 1, i.e, u = -17 + 60 = 43. Hence the 7 th root of 5 (mod 77) is 5 43 (mod 77), which by Fast Exp is 26. Let’s check. By Fast Exp, 26 7 (mod 77) = 5, as desired. Filling in the sequence of steps: 5 = 5 (-17)(7)+(2)(60) = 5 (43)(7)+(-5)(60) = (5 43 ) 7 (5 60 ) -5  (5 43 ) 7 (1) -5 = (5 43 ) 7  26 7 (mod 77).

4 Will It Work on Large Numbers? The answer is: “Sort of”, and the snag is in a place you might not at first expect it. Let’s look back at the algorithm and see if we can spot the trouble point. This snag may seem unfortunate, but it turns out that it is exactly this snag which makes “RSA encryption” work. Assignment for Monday: 1. Read Chapter 17, 2. By hand compute the 5 th root of 2 mod 19, 3. Do Exercise 17.2. I strongly suggest you fire up Mathematica and make use of the functions PowerMod, GCD, ExtendedGCD, and/or FactorInteger. If you’re clever, they can be solved by applying a single line of code. Answers are (I think): a. 37 b. 559


Download ppt "Computing k th Roots Quickly (4/4) Via the Fast Exp algorithm, we know we can quickly compute large powers of large numbers modulo large numbers. What."

Similar presentations


Ads by Google