06.01.2015 Views

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.3. MULTIPLICATIVE INVERSES 61<br />

(2) Compute gcd(12, 45) and find a solution to 12x ≡ gcd (mod 45).<br />

From 45 ÷ 12,<br />

From 12 ÷ 9,<br />

From 9 ÷ 3,<br />

{<br />

q = 3, r = 9, and<br />

0 − (3 × 1) = −3 :<br />

{<br />

q = 1, r = 3, and<br />

1 − (1 × −3) = 4 :<br />

{<br />

q = 3, r = 0, and<br />

−3 − (3 × 4) = −15 :<br />

Setup:<br />

q<br />

r<br />

c<br />

q<br />

r<br />

c<br />

q<br />

r<br />

c<br />

q<br />

r<br />

c<br />

45<br />

0<br />

45<br />

0<br />

45<br />

0<br />

45<br />

0<br />

12<br />

1<br />

3<br />

12<br />

1<br />

3<br />

12<br />

1<br />

3<br />

12<br />

1<br />

9<br />

-3<br />

1<br />

9<br />

−3<br />

1<br />

9<br />

−3<br />

3<br />

4<br />

3<br />

3<br />

4<br />

0<br />

So gcd(12, 45) = 3 and x = 4 is a solution to 12x ≡ gcd (mod 45), which<br />

we can check by seeing that (12 × 4)%45 = 3%45. (The entry in the<br />

coefficient row under the final remainder <strong>of</strong> 0 is ignored, so we didn’t<br />

bother to enter it.)<br />

(3) Compute gcd(27, 50) and find a solution to 27x ≡ gcd (mod 50).<br />

q<br />

r<br />

c<br />

50<br />

0<br />

1<br />

27<br />

1<br />

1<br />

23<br />

−1<br />

5<br />

4<br />

2<br />

1<br />

3<br />

−11<br />

3<br />

1<br />

13<br />

0<br />

So gcd(27, 50) = 1. Since −11 ≡ 39 (mod 50), we have 27 × 39 ≡ 1<br />

(mod 50).<br />

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄<br />

As we’ve seen, gcd(a, n) always divides (ab)%n, for any choice <strong>of</strong> integer b.<br />

That is, (ab)%n is always a multiple <strong>of</strong> gcd(a, n). So for there to be a solution<br />

x to ax%n = 1 we must have gcd(a, n) = 1. And if so, then the solution x is<br />

found in the coefficient line.<br />

These concepts are important enough that they have names. If two numbers<br />

have a gcd <strong>of</strong> 1, they are said to be relatively prime. And when two numbers<br />

a and n are relatively prime then they each have a multiplicative inverse<br />

with respect to the other – there are solutions x and y to (ax)%n = 1 and<br />

(ny)%a = 1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!