Lecture 6

Math236
Discrete Maths with Applications
P. Ittmann
UKZN, Pietermaritzburg
Semester 1, 2012
Ittmann (UKZN PMB)
Math236
2012
1 / 13
The GCD
Let
a, b
∈Z
We call an integer
d
a
greatest common divisor (GCD) of a and b
is the largest integer which divides both
We write this as
We call
d
a
and
if
d
b
= gcd(a, b)
a, b relatively prime,
if gcd
(a , b ) = 1
Example
The greatest common denominator of 15 and 12 is 3. i.e.,
3
= gcd(15, 12)
The greatest common denominator of 10 and 160 is
2
not
2. i.e.,
6= gcd(10, 160)
Ittmann
(UKZN
16 and
49PMB)
are relatively prime Math236
2012
2 / 13
The Division Algorithm
The question arises, how do we determine the GCD of integers
There exist unique
0
≤r <a
q
and
r
a, b ?
such that
and
b = aq + r
We call
q
Note that
the
r
quotient
=0
Ittmann (UKZN PMB)
and
r
if and only if
the
remainder
a|b
Math236
2012
3 / 13
The Division Algorithm (cont.)
Let
a, b
be two integers with 0
<a<b
The following algorithm computes gcd
1
Start with
2
If
q
1
2
3
i
p0 = b , q0 = a
p , then
does divide
and
(a , b ):
i =0
i
gcd(a, b ) = q
Stop
i
Otherwise,
1
2
3
4
Let r be the remainder when p is divided by q
Let p +1 = q and q +1 = r
Add 1 to i
Go to Step 2
i
Ittmann (UKZN PMB)
i
i
i
i
i
i
Math236
2012
4 / 13
The Division Algorithm (cont.)
Example
(
,
We now compute gcd 112 268
Set
p0
= 268,
Now, 269
We set
r0
q0
= 112
and
= 112 · 2 + 44.
= 44
and let
Since, 112
We let
So,
p1
We now repeat this with
i
)
=0
q0
does not divide
= 112,
p1
and
= 2 · 44 + 24, q1
r1 = 24, p2 = 44
and
q1
= 44
and
i
p0
=1
q1 :
does not divide
p1
q2 = 24
And so on...
Ittmann (UKZN PMB)
Math236
2012
5 / 13
The Division Algorithm (cont.)
Example
The process continues as illustrated by the following table:
Since
q4
divides
Ittmann (UKZN PMB)
p4 ,
i
pi
qi
ri
0
268
112
44
1
112
44
24
2
44
24
20
3
24
20
4
4
20
4
0
(
,
the algorithm stops and gcd 112 268
Math236
) = q4 = 4
2012
6 / 13
The Well-Ordering Axiom
Every non-empty set of integers has a smallest element
Ittmann (UKZN PMB)
Math236
2012
7 / 13
Closure & Binary Operations
Let
S
be a set
If an operation
◦
on
S
is such that for all
a
then
S
is
closed
under
◦
and
◦
a, b
∈ S,
◦ b ∈ S,
is called a
binary operation
Example
The set of integers
Z
is closed under:
Addition
Subtraction
Multiplication
Is
Z
closed under division?
Ittmann (UKZN PMB)
Math236
2012
8 / 13
Closure & Binary Operations (cont.)
Example
The set of natural number
N
is closed under:
Addition
Multiplication
Is
N
closed under subtraction or division?
Ittmann (UKZN PMB)
Math236
2012
9 / 13
Closure & Binary Operations (cont.)
Theorem
Let S be a non-empty set of integers that is closed under addition and
subtraction. Then exactly one of the following statements is true:
1
S
= {0}
2
S
= {0. ± d , ±2d , ±3d , . . .}
where d is the smallest positive integer in
S
Proof.
Clearly
{0}
Thus, is
S
is closed under addition and subtraction
= {0},
Ittmann (UKZN PMB)
then the result follows
Math236
2012
10 / 13
Closure & Binary Operations (cont.)
Proof.
Suppose that
S
6= {0}
S
contains an element
Since
S
is closed under subtraction,
Exactly one of
a
and
−a
a
6= 0
Then
S
S
contains
−a
is positive
By the Well-Ordering Axiom,
Since
S
S
contains a smallest positive integer
d
is closed under addition and subtraction,
⊇ {0, ±d , ±2d , ±3d , . . .}
Ittmann (UKZN PMB)
Math236
2012
11 / 13
Closure & Binary Operations (cont.)
Proof.
We need to show that
Let
z
S
⊆ {0, ±d , ±2d , ±3d , . . .}
∈S
By the Division Algorithm,
Thus,
r
z
= qd + r
where
q, d
∈Z
and 0
≤r <d
= z − qd
Ittmann (UKZN PMB)
Math236
2012
12 / 13
Closure & Binary Operations (cont.)
Proof.
Since
Now
S
r
is closed under addition and subtraction,
∈S
is a non-negative integer less than
By the minimality of
Thus,
z
= qd
and hence
This implies that
Ittmann (UKZN PMB)
d, r
S
r
∈S
d
=0
z
∈ {0, ±d , ±2d , ±3d , . . .}
⊆ {0, ±d , ±2d , ±3d , . . .}
Math236
2012
13 / 13