mat 320 spring 2008 section 1.2. start with two integers for which you want to find the gcd. apply...

11
MAT 320 Spring 2008 Section 1.2

Upload: imogen-henderson

Post on 05-Jan-2016

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

MAT 320 Spring 2008Section 1.2

Page 2: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number into the larger.

Example: a = 320, b = 296.

320 = 296 · 1 + 24

The first quotient is q0 and the first remainder is r0.

Page 3: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

If you get a remainder of 0, stop. If not, the divisor from the previous step becomes the dividend of the next step. The remainder from the previous step becomes the divisor of the previous step.

320 = 296 · 1 + 24 296 = 24 · 12 + 8

Continue until you get a remainder of 0.

Page 4: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

320 = 296 · 1 + 24 296 = 24 · 12 + 8 24 = 8 · 3 + 0

We get a remainder of 0, so we stop. The last nonzero remainder is the GCD, so (320, 296) is equal to 8.

Page 5: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

Compute (346, 592).

592 = 346 · 1 + 246 346 = 246 · 1 + 100 246 = 100 · 2 + 46 100 = 46 · 2 + 8 46 = 8 · 5 + 6 8 = 6 · 1 + 2 6 = 2 · 3 + 0

So (346, 592) = 2.

Page 6: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

We can use the Euclidean Algorithm to find the integers U and V from Bézout’s Theorem.

As an example, let’s use the Euclidean Algorithm to show that (324, 148) = 4.

324 = 148 · 2 + 28 148 = 28 · 5 + 8 28 = 8 · 3 + 4 8 = 4 · 2 + 0

Page 7: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

We want to find integers U and V such that 4 = 324U + 148V.

Take all of the equations (except the last one) and solve for the remainder.

28 = 324 – 148 · 2 8 = 148 – 28 · 5 4 = 28 – 8 · 3

Page 8: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

Notice that the last equation expresses 4 as a linear combination of 28 and 8.

4 = 28 · 1 + 8 · (-3)

This is not what we want, however. So we use the previous equation (which has been solved for 8) to substitute.

Page 9: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

4 = 28 · 1 + (148 – 28 · 5) · (-3)

Now we want to rearrange this so that 4 is expressed as a linear combination of 28 and 148 (still not quite what we want, but getting closer)

We get 4 = 28 · 16 + 148 · (-3)

Page 10: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

Now use the previous equation (which has been solved for 28) to substitute.

We get 4 = (324 – 148 · 2) · 16 + 148 · (-3)

Once again, multiply out and rearrange until we get 4 expressed as a linear combination of 324 and 148.

4 = 324 · 16 + 148 · (-35)

Page 11: MAT 320 Spring 2008 Section 1.2.  Start with two integers for which you want to find the GCD. Apply the division algorithm, dividing the smaller number

Use the Euclidean Algorithm to show that(15, 36) = 3.

Use back-substitution to find integers U and V so that 3 = 15U + 36V.