Next: Numbers Do Factor
Up: Greatest Common Divisors
Previous: Greatest Common Divisors
Can we easily compute something like
? Yep.
Watch closely:
Notice that if a number
divides both
and
, then it
automatically divides
, and of course
divides
. Also, if a number
divides both
and
, then it has got to divide
as well!
So we have made progress:
Let's try again:
so
.
Just keep at it:
Thus
, which is
because
, so
Cool. Aside from tedious arithmetic, that was
quick and very mechanical.
The Algorithm:
That was an illustration of Euclid's algorithm.
You just ``Divide and switch.''
More formally, fix
with
.
Using ``divide with quotient and remainder'',
write
, with
.
Then, just as above,
Let
,
, and repeat until
.
Soon enough we have computed
.
Here's are two more examples:
Example 2.2
Set
![$ a=15$](img77.png)
and
![$ b=6$](img78.png)
.
We can just as easily do an example that is ``
times as hard'':
Example 2.3
Set
![$ a=150$](img85.png)
and
![$ b=60$](img86.png)
.
With Euclid's algorithm in hand, we can prove that if a prime divides the
product of two numbers, then it has got to divide one of them. This
result is the key to proving that prime factorization
is unique.
Proof.
If
![$ p\mid a$](img92.png)
we are done. If
![$ p\nmid a$](img95.png)
then
![$ \gcd(p,a)=1$](img96.png)
, since
only
![$ 1$](img16.png)
and
![$ p$](img17.png)
divide
![$ p$](img17.png)
. Stepping through the Euclidean algorithm
from above, we see that
![$ \gcd(pb,ab) = b.$](img97.png)
At each step, we simply
multiply the equation through by
![$ b$](img9.png)
. Since
![$ p\mid pb$](img98.png)
and,
by hypothesis,
![$ p\mid ab$](img91.png)
, it follows that
![$ p\mid \gcd(pb,ab) = b$](img99.png)
.
Next: Numbers Do Factor
Up: Greatest Common Divisors
Previous: Greatest Common Divisors
William A Stein
2001-09-14