Professional Documents
Culture Documents
Lecture # 25
Lecture # 25
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.
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 = 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 = 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 = 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?
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.
12
EUCLIDEAN ALGORITHM
Use the Euclidean algorithm to find gcd(330, 156)
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.