Example of Extended Euclidean
Algorithm
Recall that gcd(84
,
33) = gcd(33
,
18) = gcd(18
,
15) =
gcd(15
,
3) = gcd(3
,
0) = 3
We work backwards to write 3 as a linear combination of
84 and 33:
3 = 18

15
[Now 3 is a linear combination of 18 and 15]
= 18

(33

18)
= 2(18)

33
[Now 3 is a linear combination of 18 and 33]
= 2(84

2
×
33))

33
= 2
×
84

5
×
33
[Now 3 is a linear combination of 84 and 33]
1
Some Consequences
Corollary 2:
If
a
and
b
are relatively prime, then there
exist
s
and
t
such that
as
+
bt
= 1.
Corollary 3:
If gcd(
a,b
) = 1 and
a

bc
, then
a

c
.
Proof:
•
Exist
s, t
∈
Z
such that
sa
+
tb
= 1
•
Multiply both sides by
c
:
sac
+
tbc
=
c
•
Since
a

bc
,
a

sac
+
tbc
, so
a

c
Corollary 4:
If
p
is prime and
p

Π
n
i
=1
a
i
, then
p

a
i
for some 1
≤
i
≤
n
.
Proof:
By induction on
n
:
•
If
n
= 1: trivial.
Suppose the result holds for
n
and
p

Π
n
+1
i
=1
a
i
.
•
note that
p

Π
n
+1
i
=1
a
i
= (Π
n
i
=1
a
i
)
a
n
+1
.
•
If
p

a
n
+1
we are done.
•
If not, gcd(
p,a
n
+1
) = 1.
•
By Corollary 3,
p

Π
n
i
=1
a
i
•
By the IH,
p

a
i
for some 1
≤
i
≤
n
.
2
The Fundamental Theorem of
Arithmetic, II
Theorem 3:
Every
n >
1 can be represented uniquely
as a product of primes, written in nondecreasing size.
Proof:
Still need to prove uniqueness. We do it by strong
induction.
•
Base case: Obvious if
n
= 2.
Inductive step. Suppose OK for
n
p
< n
.
•
Suppose that
n
= Π
s
i
=1
p
i
= Π
r
j
=1
q
j
.
•
p
1

Π
r
j
=1
q
j
, so by Corollary 4,
p
1

q
j
for some
j
.
•
But then
p
1
=
q
j
, since both
p
1
and
q
j
are prime.
•
But then
n/p
1
=
p
2
···
p
s
=
q
1
···
q
j

1
q
j
+1
···
q
r
•
Result now follows from I.H.
3
Characterizing the GCD and LCM
Theorem 6:
Suppose
a
= Π
n
i
=1
p
α
i
i
and
b
= Π
n
i
=1
p
β
i
i
,
where
p
i
are primes and
α
i
, β
i
∈
N
.
•
Some
α
i
’s,
β
i
’s could be 0.
Then
gcd(
a,b
) = Π
n
i
=1
p
min(
α
i
,β
i
)
i
lcm(
a,b
) = Π
n
i
=1
p
max(
α
i
,β
i
)
i
Proof:
For gcd, let
c
= Π
n
i
=1
p
min(
α
i
,β
i
)
i
.
Clearly
c

a
and
c

b
.
•
Thus,
c
is a common divisor, so
c
≤
gcd(
a,b
).
If
q
γ

gcd(
a,b
),
•
must have
q
∈ {
p
1
, .. ., p
n
}
◦
Otherwise
q
n 
a
so
q
n 
gcd(
a,b
) (likewise
b
)
If
q
=
p
i
,
q
γ

gcd(
a,b
), must have
γ
≤
min(
α
i
, β
i
)
◦
E.g., if
γ > α
i
, then
p
γ
i
n 
a
•
Thus,
c
≥
gcd(
a,b
).
Conclusion:
c
= gcd(
a,b
).
4
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentFor lcm, let
d
= Π
n
i
=1
p
max(
α
i
,β
i
)
i
.
•
Clearly
a

d
,
b

d
, so
d
is a common multiple.
•
Thus,
d
≥
lcm(
a,b
).
Suppose lcm(
a,b
) = Π
n
i
=1
p
γ
i
i
.
•
Must have
α
i
≤
γ
i
, since
p
α
i
i

a
and
a

lcm(
a,b
).
•
Similarly, must have
β
i
≤
γ
i
.
•
Thus, max(
α
i
,β
i
)
≤
γ
i
.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '05
 KLEINBERG
 Number Theory, Prime number

Click to edit the document details