0% found this document useful (0 votes)
15 views17 pages

Lecture # 25

The document discusses the division algorithm and the Euclidean algorithm to find the greatest common divisor (GCD) of two integers. It defines the quotient and remainder when dividing one integer by another. The Euclidean algorithm uses successive division to reduce two integers until reaching the GCD, which is the last non-zero remainder. Several examples are provided to demonstrate finding the GCD of integers using both the definition and Euclidean algorithm methods.

Uploaded by

Umar Bhatti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views17 pages

Lecture # 25

The document discusses the division algorithm and the Euclidean algorithm to find the greatest common divisor (GCD) of two integers. It defines the quotient and remainder when dividing one integer by another. The Euclidean algorithm uses successive division to reduce two integers until reaching the GCD, which is the last non-zero remainder. Several examples are provided to demonstrate finding the GCD of integers using both the definition and Euclidean algorithm methods.

Uploaded by

Umar Bhatti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

NUMBER THEORY

Lecture # 25

1
DIVISION ALGORITHM
 The quotient remainder theorem states that when an
integer is divided by an integer we get one remainder and
quotient.

 The value of remainder will either be 0 or less than to


number we are divided with.

2
THEOREM (Quotient-Remainder Theorem)
 Given any integer n and a positive integer d, there exist
unique integers q and r such that

n = d· q + r
where
0 ≤ r < d.

3
EXAMPLE
 What is the quotient and remainder when 54 is divided
by 4?

 n = 54 and we divide it with 4 i.e. d = 4

n = d· q + r
54 = 4· 13 + 2;

Hence,
Quotient = 13 and Remainder = 2

4
EXAMPLE
 What is the quotient and remainder when – 11 is divided
by 3?

 n = – 11 and we divide it with 1 i.e. d = 3

n = d· q + r
– 11 = 3· (– 4) + 1;

Hence,
Quotient = – 4 and Remainder = 1

5
EXAMPLE
 What is the quotient and remainder when – 54 is divided
by 4?

 n = – 54 and we divide it with 4 i.e. d = 4

n = d· q + r
– 54 = 4· (– 14) + 2;

Hence,
Quotient = – 14 and Remainder = 2

6
EXAMPLE
 What is the quotient and remainder when 54 is divided
by 70?

 If we take n = 54 and we divide it with 70 i.e. d = 70


Here,
divisor > number
n = d· q + r
54 = 70· (0) + 54;

Hence,
Quotient = 0 and Remainder = 54
7
GREATEST COMMON DIVISORS
 Let a and b be integers, not both zero. The largest integer
d such that d | a and d | b is called the greatest common
divisor of a and b.

 Notation:
The greatest common divisor of a and b is denoted by
gcd(a, b).

8
EXAMPLE
 Find gcd(330, 156)
 Solution:
2 8
156 330 18 156
312 144
18 12
1 2
12 18 6 12
12 12
6 0
 Hence the gcd(330, 156) = 6

9
EXAMPLE
 What is the greatest common divisor of 24 and 36?

 Solution:

24 : 1, 2, 3, 4, 6, 8, 12, 24
36 : 1, 2, 3, 4, 6, 9, 12, 18, 36

Common Divisors : 1, 2, 3, 4, 6, 12
Greatest : 12
gcd(24, 36) = 12

10
THE EUCLIDEAN ALGORITHM
 Suppose that a and b are positive integers with a ≥ b.
Let r0 = a and r1 = b. When we successively apply the
division algorithm, we obtain

r0 = r1 q 1 + r2 0 ≤ r2 < r1 ,
r1 = r2 q 2 + r3 0 ≤ r3 < r2 ,



rn-2 = rn-1qn-1 + rn 0 ≤ rn < rn-1,
rn-1 = rnqn
11
 Eventually a remainder of zero occurs in this sequence of
successive divisions, because the sequence of remainders a
= r0 > r1 > r2 > ・ ・ ・ ≥ 0 cannot contain more than a
terms.

 Furthermore, it follows from Lemma 1 that


gcd(a, b) = gcd(r0, r1) = gcd(r1 , r2) = ・ ・ ・ = gcd(rn-2, rn-
1) = gcd(rn-1, rn) = gcd(rn, 0) = rn.

12
EUCLIDEAN ALGORITHM
 Use the Euclidean algorithm to find gcd(330, 156)

 Divide 330 by 156: (By Quotient-Remainder Theorem)


This gives 330 = 156· 2 + 18
 Divide 156 by 18:
This gives 156 = 18· 8 + 12
 Divide 18 by 12:
This gives 18 = 12· 1 + 6
 Divide 12 by 6:
This gives 12 = 6· 2 + 0

Hence gcd(330, 156) = 6 because 6 is last nonzero remainder


13
STEPS INVOLVING IN FINDING OUT
gcd(330, 156)
 Note that:
Step 1: we divide 330 by 156
Step 2: we divide 156 by 18
Step 3: we divide 18 by 12
Step 4: we divide 12 by 6

14
LEMMA
 If a and b are any integers with b ≠ 0 and q and r are
nonnegative integers such that

a=q·d+r
then

gcd(a, b) = gcd(b, r)

15
EXAMPLE
 Find the greatest common divisor of 414 and 662 using
the Euclidean algorithm.

Successive uses of the division algorithm give:


662 = 414· 1 + 248
414 = 248· 1 + 166
248 = 166· 1 + 82
166 = 82· 2 + 2
82 = 2· 41 + 0
 Hence, gcd(414, 662) = 2, because 2 is last nonzero
remainder
16
EXAMPLE
 Find the greatest common divisor of 252 and 198 using
the Euclidean algorithm.

Successive uses of the division algorithm give:


252 = 198· 1 + 54
198 = 54· 3 + 36
54 = 36· 1 + 18
36 = 18· 2 + 0

 Hence, gcd(252, 198) = 18, because 18 is last nonzero


remainder
17

You might also like