The Euclidean Algorithm Worksheet, Study notes of Algorithms and Programming

A worksheet on the Euclidean Algorithm. It defines the greatest common divisor (gcd) of two integers and presents a theorem on the existence of non-unique integers r and s that satisfy ra+sb=gcd(a,b). The document also presents warm-up exercises, proofs, and an example of the Euclidean algorithm applied to two integers. The worksheet is useful for students studying number theory, algebra, or discrete mathematics.

Typology: Study notes

2022/2023

Uploaded on 05/11/2023

ekobar
ekobar 🇺🇸

4.3

(33)

261 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 412. Worksheet on The Euclidean Algorithm.
Professor Karen E. Smith
DEFI NI TI ON : Let aand bbe integers, not both zero. The greatest common divisor or gcd of
a, b is the largest integer dsuch that d|aand d|b. We write gcd(a, b), or sometimes just (a, b),
for the gcd of aand b.
THE OR EM : Let aand bbe integers, not both zero. Then there exist (non-unique!) r, s Zsuch
that ra +sb =gcd(a, b).
DEFI NI TI ON : An expression of the form ra +sb with r, s Zis a called a Z-linear combina-
tion of aand b.
The Euclidean algorithm is a method to find the gcd of two integers, as well as a specific pair
of integers r, s such that ra +sb =gcd(a, b).
A. WARMU P:
(1) List all factors of 18? List all divisors of 24. Find gcd(18,24).
(2) For aZ, what is (a, a)? What is (a, 7a)? If a > 0, what is the gcd of aand 0?
(3) What happens if we try to define gcd(0,0)?
B. Suppose we had two integers aand b, with b > 0, and we did the division algorithm to get
a=bq +rfor some q, r Z.
(1) Show that if dis the greatest common divisor of band r, then dis acommon divisor of
aand b. Now explain why this means that (b, r)(a, b).
(2) Show that if dis the greatest common divisor of aand b, then dis acommon divisor of
band r. Now explain why this means that (a, b)(b, r).
(3) Prove that gcd(a, b) = gcd(b, r).
(4) How might (3) make the computation of (a, b)easier?
C. Your team is tasked with computing the greatest common divisor of 524 and 148. Your
teammate does the following computation, which you can assume is accurate:
524 = 148 ·3+80 080 <148(i)
148 =80 ·1+68 068 <80(ii)
80 =68 ·1+12 012 <68(iii)
68 =12 ·5+808<12(iv)
12 =8·1 + 4 0 4<8(v)
8= 4 ·2+0(vi)
(1) What is going on on each individual line?
(2) How does each line relate to the previous one?
(3) Prove that
(524,148) = (148,80) = (80,68) = (68,12) = (12,8) = (8,4) = (4,0) = 4.
D. The computation above is an example of the Euclidean algorithm applied to 524 and 148.
(1) Articulate with your teammates, perhaps by drawing a flow-chart, how the Euclidean
algorithm is carried out to compute the gcd of two positive integers aand b.
(2) Use the Euclidean algorithm to find (1003,456).
pf2

Partial preview of the text

Download The Euclidean Algorithm Worksheet and more Study notes Algorithms and Programming in PDF only on Docsity!

Math 412. Worksheet on The Euclidean Algorithm.

Professor Karen E. Smith

DEFINITION: Let a and b be integers, not both zero. The greatest common divisor or gcd of a, b is the largest integer d such that d|a and d|b. We write gcd(a, b), or sometimes just (a, b), for the gcd of a and b.

THEOREM: Let a and b be integers, not both zero. Then there exist (non-unique!) r, s ∈ Z such that ra + sb = gcd(a, b).

DEFINITION: An expression of the form ra + sb with r, s ∈ Z is a called a Z-linear combina- tion of a and b.

The Euclidean algorithm is a method to find the gcd of two integers, as well as a specific pair of integers r, s such that ra + sb = gcd(a, b).

A. WARMUP:

(1) List all factors of 18? List all divisors of 24. Find gcd(18, 24). (2) For a ∈ Z, what is (a, a)? What is (a, 7 a)? If a > 0 , what is the gcd of a and 0? (3) What happens if we try to define gcd(0, 0)?

B. Suppose we had two integers a and b, with b > 0 , and we did the division algorithm to get a = bq + r for some q, r ∈ Z.

(1) Show that if d is the greatest common divisor of b and r, then d is a common divisor of a and b. Now explain why this means that (b, r) ≤ (a, b). (2) Show that if d is the greatest common divisor of a and b, then d is a common divisor of b and r. Now explain why this means that (a, b) ≤ (b, r). (3) Prove that gcd(a, b) = gcd(b, r). (4) How might (3) make the computation of (a, b) easier?

C. Your team is tasked with computing the greatest common divisor of 524 and 148. Your teammate does the following computation, which you can assume is accurate:

(i) 524 = 148 · 3 + 80 0 ≤ 80 < 148

(ii) 148 = 80 · 1 + 68 0 ≤ 68 < 80

(iii) 80 = 68 · 1 + 12 0 ≤ 12 < 68

(iv) 68 = 12 · 5 + 8 0 ≤ 8 < 12

(v) 12 = 8 · 1 + 4 0 ≤ 4 < 8

(vi) 8 = 4 · 2 + 0

(1) What is going on on each individual line? (2) How does each line relate to the previous one? (3) Prove that (524, 148) = (148, 80) = (80, 68) = (68, 12) = (12, 8) = (8, 4) = (4, 0) = 4.

D. The computation above is an example of the Euclidean algorithm applied to 524 and 148.

(1) Articulate with your teammates, perhaps by drawing a flow-chart, how the Euclidean algorithm is carried out to compute the gcd of two positive integers a and b. (2) Use the Euclidean algorithm to find (1003, 456).

E. Let’s return to the computation in Part C.

(1) Use equation (i) to express 80 as a linear combination of 524 and 148. (2) Use equation (ii) to express 68 as a linear combination of 148 and 80. Use this and the previous part to express 68 as a linear combination of 524 and 148. (3) Express 12 as a linear combination of 524 and 148. (4) Express 4 = (524, 148) as a linear combination of 524 and 148.

F. Express (1003, 456) as a linear combination of 1003 and 456.

G. Prove the following strengthened form of the Theorem: For integers a and b, gcd(a, b) is the smallest positive Z-linear combination of a and b. [Hint: Start by defining S to be the set of positive integers that are Z- linear combinations of a and b. Use the Well-ordering Axiom.]