0% found this document useful (0 votes)
2 views21 pages

Euclidean Algorithm

The document explains the division algorithm for integers, which states that for two positive integers a and b, there exist unique integers q and r such that a = qb + r, where 0 ≤ r < |b|. It also details the Euclidean algorithm for finding the greatest common divisor (gcd) of two integers, and introduces Bezout's identity, which expresses the gcd as a linear combination of the two integers. Additionally, it discusses the relationship between gcd and least common multiple (lcm), providing examples to illustrate these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views21 pages

Euclidean Algorithm

The document explains the division algorithm for integers, which states that for two positive integers a and b, there exist unique integers q and r such that a = qb + r, where 0 ≤ r < |b|. It also details the Euclidean algorithm for finding the greatest common divisor (gcd) of two integers, and introduces Bezout's identity, which expresses the gcd as a linear combination of the two integers. Additionally, it discusses the relationship between gcd and least common multiple (lcm), providing examples to illustrate these concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

DIVISION

ALGORITHM
AND
EUCLIDEAN
ALGORITHM
The division algorithm for integers says the following: Given
two positive integers a and b, with b≠ 0, there exists unique
integers q and r such that

a = qb + r
where 0 ≤ r < |b|.
This may appear to be confusing at first, but it is literally just
saying that you can divide an integer a by a nonzero integer b
and get a remainder which is less than the number we are
dividing by.
Example: Given a = 18 and b = 4, we can
write 18 = 4 · 4 + 2. This is just dividing 18
by 4 which we expect to have remainder 2.
THE EUCLIDEAN ALGORITHM
The Euclidean Algorithm Here is an example to illustrate how the
Euclidean algorithm is performed on the two integers a = 91 and
𝑏1 = 17.
Step 1: 91 = 5 · 17 + 6 (i.e. write a = q1b1 + r1 using the division algorithm)
Step 2: 17 = 2 · 6 + 5 (i.e. write b1 = q2r1 + r2 using the division algorithm)
Step 3: 6 = 1 · 5 + 1 (i.e. write r1 = q3r2 + r3 using the division algorithm)
Step 4: 5 = 5 · 1 + 0 (i.e. write r2 = q4r3 + r4 using the division algoirhtm)
The general algorithm is as follows:
Given two integers a and b
Step 1: Write a = q0b + r0
Step 2: Write b = q1r0 + r1
Step i (i ≥ 2): Write ri−2 = qiri−1 + ri .
The algorithm terminates at the step j where we get rj = 0.
When the Euclidean algorithm is over, that is, when we
get rj = 0, then rj−1 = gcd(a, b). Said differently, gcd(a, b) is
the last nonzero remainder in the Euclidean algorithm.
BEZOUT’S IDENTITY
AND THE EXTENDED
EUCLIDEAN
ALGORITHM
A very useful fact is Bezout’s identity
Bezout’s Identity:
Let a and b be nonzero integers and let d be their GCD.
Then we can write d as a linear combination of a and b; that is,
there exist integers s and t such that

d = sa + tb.
Furthermore,
i. d is the smallest positive integer that can be written in the form
sa + tb,
ii. ii. every other integer of the form sa + tb is a multiple of d.
EXAMPLE:
a. Above we computed that gcd(25, 24) = 1. We
can write
1 = 1 · 25 − 1 · 24.
a. b. Consider d = gcd(1245, 998) from above.
We can check using the Euclidean algorithm
that d = 1. We can write
1 = 299 · 1245 − 373 · 998.
Seeing the GCD from example (b) above
written in the form of Bezout’s identity can
easily cause one to wonder how anyone
would ever come up with that. This is fairly
easy to do by using the Extended Euclidean
Algorihtm
EXAMPLE:
EXTENDED EUCLIDEAN ALGORITHM
Let’s compute gcd(232, 108) = 4 and then write the gcd in the
form of Bezout’s identity
Step A: Use the Euclidean algorithm to compute gcd(232, 108)
Step A1: 232 = 2 · 108 + 16
Step A2: 108 = 6 · 16 + 12 Step
A3: 16 = 1 · 12 + 4
Step A4: 12 = 4 · 3 + 0
The last nonzero remainder in the Euclidean algorithm is 4 so
gcd(232, 108) = 4.
Step B: Use the Extended Euclidean Algorithm to write the GCD in the
form of Bezout’s identity
We want to find integers s and t such that 4 = s · 232 + t · 108.
Step B1: From step A3 notice that you can write 4 = 16 − 1 · 12.
4 = 16 − 1 · 12.
4= (232 -2 · 108 ) − 1 · (108 − 6 · 16)
4= 232-3(108) + 6 · 16
4= 232-3(108) + 6 · (232−2 · 108)
4= 7(232)- 15 (108) since 4 = s · 232 + t · 108.
meaning s =7 and t= -15
A useful consequence of Bezout’s identity is Euclid’s Lemma:
Euclid’s Lemma: Let p be a prime number; let a and b be integers. Then if p|ab then
p|a or p|b.
Proof. Assume p is prime and that p|ab so that there exists an integer n such that
ab = np. Furthermore assume that p - a. We show that that under this assumption it
is necessary that p|b. Since p is prime, and p - a, it follows that gcd(a, p) = 1. Thus
by Bezout’s identity there exist integers s and t such that
1 = sp + ta.
Multiplying both sides of (1) by b yields
b = bsp + bta
Thus we have b = bsp + npt = p(bs + nt); so p|b.
Related to the GCD of two positive integers is the least common multiple of two
positive integers.
Definition:
An integer m is a multiple of the integer a if a is a
factor of m. An integer m is a common multiple of the
integers a and b if m is a multiple of both a and b. The
smallest positive common multiple of a and b is the least
common multiple of a and b denoted by lcm(a,b). Given two
fractions a/b and c/d, the least common denominator of the
fractions is lcm(b,d).
EXAMPLE :
Let a = 35 and b = 21.
Some multiples of a (there are infinitely many of them) are
a = 35,70,105,140,175,...
and some multiples of b are
b = 21,42,63,84,105,126,...
We can now see that lcm(35,21) = 105. It is easy to see that
gcf(35,21) = 7, and we note the curious fact that
gcf(a,b)lcm(a,b) = 7 · 105 = 735 = ab.
For any positive integers a and b, gcf(a,b)lcm(a,b) =
ab

To find the least common multiple of two


integers a and b, we use the Euclidean
algorithm to find gcf(a,b) and then compute
lcm(a,b) = a·b gcf(a,b) .
Example:

You might also like