1
Chapter 6: Linear Equations and the Greatest Common Divisor
Practice HW p. 43 # 1, 2, Additional Web Exercises, p. 53 # 1, 2
In this chapter, we look at how to produce gcd( a, b) using a and b .
Definition: Given two positive integers a and b , the quantity ax by , where x and y are
integers, is called a linear combination of a and b .
Given a 540 and b 360 , the following are examples linear combinations of a and
b . Note that gcd( 540, 360) 180 .
x 2, y 1
x 3, y 2
x 1, y 1
Claim: The smallest positive value of ax by is the gcd( a, b) .
Proof of Claim: To prove the claim, we must first show a solution ( x, y ) exists to
ax by gcd( a, b) . This can be done by showing all remainders produced by the
Euclidean Algorithm can be written as ax by (recall the last non-zero remainder gives
the gcd). We will prove this by using the principle of mathematical induction. To show
that it is true for the first remainder produced by the Euclidean Algorithm, we have
a q1b r1
Hence
r1 a q1b a(1) b(q1 )
which shows the result holds for the first remainder. Suppose now the result holds for all
remainders produced in the Euclidean Algorithm before the remainder rn . By the
Euclidean Algorithm, we know
rn 2 qn rn 1 rn
Continued on Next Page
2
or
rn rn 2 qn rn 1
By the induction hypothesis, the will exist x1, y1 and x2 , y2 where
rn 2 ax2 by2 and rn 1 ax1 by1 .
Hence,
rn rn 2 qn rn 1 (ax2 by2 ) qn (ax1 by1 ) a( x2 qn x1 ) b( y2 qn y1 )
Hence, the result holds for the remainder rn , and by the principle of mathematical
induction, any subsequent remainders (including the one that produces the gcd).
Last, we must show that gcd( a, b) Smallest P ositive Value Produced by ax by . Let
g gcd( a, b) . Since g | a and g | b , it follows that g | ax by . Hence, for all cases
where ax by is positive, g | ax by . Thus, g ax by and hence will be the smallest
positive value produced by ax by . This completes the proof.
█
3
Example 1: Find a solution in the integers to the equation 52598 x 2541 y gcd( 52598, 2541) .
Solution:
█
4
Example 2: Find a solution in the integers to the equation
1095939 x 3854682 y gcd(1095939, 3854682) .
Solution:
█
5
Maple Command for Finding Gcd and x and y where ax + by = gcd(a,b)
Solve 52598 x 2541 y gcd( 52598, 2541)
> igcdex(52598, 2541, 'x', 'y');
> x;
> y;
Solve 1095939 x 3854682 y gcd(1095939, 3854682)
> igcdex(1095939, 3854682, 'x', 'y');
> x;
> y;
6
Finding Other Solutions to ax+by = gcd(a, b)
How do we classify other solutions for x and y to ax by gcd( a, b) beyond what the
solving for the remainder process in the Euclidean Algorithm?
To see how other solutions can be produced, consider the case where gcd( a, b) 1 , that
is, solve
ax by 1
Suppose ( x1, y1 ) is a solution to this equation. Then
ax1 by1 1
To produce other solutions, we introduce the term kab to this equation, where k is an
integer. This will give
ax1 kab by1 kab 1
a( x1 kb) b( y1 ka) 1
Hence, x1 kb, y1 ka is a solution, where k is any arbitrary integer.
The next question we want to ask is this. Are there other ways to produce solutions to
ax by 1 ? The next claim answers this question.
Claim: Given a solution x1, y1 to ax by 1 , then all other solutions, say x2 , y2 can
be found by computing
x2 x1 kb,
y2 y1 ka , where k is any arbitrary integer
Proof of Claim: Suppose x1, y1 and x2 , y2 are solutions to ax by 1 . Then this
gives us the following equations, which we label as equations 1 and 2.
(1)
(2)
ax1 by1 1
ax2 by2 1
We first Equation 1 by y2 and Equation 2 by y1 and subtract.
Continued on Next Page
7
ax1 y2 by1 y2 y2
( Multiply E quation 1 by y2 )
( Multiply E quation 2 by y1 ) ax2 y1 by1 y2 y1
----------------a ( x1 y2 x2 y1 ) y2 y1
(*)
Now, multiply Equation 2 by x1 and Equation 1 by x2 and subtract.
ax1 x2 bx2 y1 x2
( Multiply E quation 1 by x2 )
( Multiply E quation 2 by x1 ) ax1 x2 bx1 y2 x1
----------------b( x2 y1 x1 y2 ) x2 x1
(**)
Taking * and ** gives
a( x1 y2 x2 y1 ) y2 y1
and
b( x2 y1 x1 y2 ) x2 x1
If we set k x2 y1 x1 y2 (note that k x1 y2 x2 y1 ), we obtain
ka y2 y1
and
kb x2 x1
Solving for x2 and y2 gives
x2 x1 kb and
y2 y1 ka
This proves the claim.
█
The last thing we want to ask is how we generate additional solutions if g gcd( a, b) 1 ?
Let x1, y1 be a solution to ax by g . Then
ax1 by1 g
a
b
x1 y1 1
g
g
If we replace a by
following theorem.
(Divide both sides by g )
a
b
and b by
in the above claim proof, we obtain the results of the
g
g
8
Theorem: Linear Equation Theorem. Let a and b be positive integers and g gcd( a, b)
The equation
ax by g
always has a solution x1, y1 (this solution can be found using the Euclidean Algorithm
process). Other solutions can be found by substituting arbitrary solutions for k into the
formula
b
a
x1 k , y1 k
g
g
Example 3: Find a formula for generating an infinite number of solutions to the equation
52598 x 2541 y gcd( 52598, 2541) 7 .
Solution:
█
9
Example 4: Find a formula for generating an infinite number of solutions to the equation
1095939 x 3854682 y gcd(1095939, 3854682) 37791
Solution:
█
Note: We can use the fact that ax by gcd( a, b) to prove other important facts.
Fact: Prove that if gcd( a, b) 1 and that a | bc , then a | c .
Proof of Fact:
█