Preamble: If
divides
, then
divides
. We may as well assume that
and that
. Note that 0 is divisible by any integer, so saying that
divides both
and 0 is equivalent to saying that
divides
. It makes sense to restrict ourselves to positive integers
only. Then defining
to be the greatest integer that
divides both
and
makes sense for
, since at
least one integer,
, divides both
and
and the possibilities
are finite since
.
Simple things: If
divides
, then
. If
is a prime number and
, then
.
When
, we say that
and
are relatively prime.
In class, I showed how the greatest common divisor of any two positive
integers could be computed in a systematic way. I also alluded to the
fact that the computations could also be used to solve a certain
equation. That is, if
, then there are integers,
and
such that
. Note that
is
also a solution for all
.
To make the notation work out nicely, we rename
and
as
and
, and assume that
. We define
to be the
greatest integer
, and
to be the
remainder. That is:
Now define a sequence of integers,
, for
as
follows.
and
. For
, let
Note that
. That is,
for
. It turns out that this is true for all
between 0 and
, so that
How can this be proved? The easiest way is to use
matrices to avoid messy calculations. Let
and
. For
, let
. Note that
and that
. Finally, let
for
. Note
that
, and for
, it is easy
to compute
This means that
, giving
. Also,
.
Thus
. If
is even,
and if
is odd,
.
The methods described above solve the problem of computing the
greatest common divisor,
, of two positive integers and of
expressing
as a ``linear combination'' of these two integers.
Example: Compute gcd(2147483647,4372893)
Solution:
2147483647 = 491 * 4372893 + 393184
4372893 = 11 * 393184 + 47869
393184 = 8 * 47869 + 10232
47869 = 4 * 10232 + 6941
10232 = 1 * 6941 + 3291
6941 = 2 * 3291 + 359
3291 = 9 * 359 + 60
359 = 5 * 60 + 59
60 = 1 * 59 + 1
59 = 59 * 1 + 0
n = 10 and the gcd of 2147483647 and 4372893 is 1, the last
non-zero remainder.
Values of b(k)
k b(k-1) = m(k) * b(k) + b(k+1)
10 1 = 59 * 0 + 1
9 1 = 1 * 1 + 0
8 6 = 5 * 1 + 1
7 55 = 9 * 6 + 1
6 116 = 2 * 55 + 6
5 171 = 1 * 116 + 55
4 800 = 4 * 171 + 116
3 6571 = 8 * 800 + 171
2 73081 = 11 * 6571 + 800
1 35889342 = 491 * 73081 + 6571
Finally:
2147483647 * 73081 + 4372893 * -35889342 = 1
![]() | Michael Zuker Professor of Mathematical Sciences Rensselaer Polytechnic Institute 2008-02-29 |