Linear Diophantine Equations
Linear Diophantine Equations
However, this equation has no nonzero integer solutions. This is a special case of Fermat’s Last
Theorem.
On the other hand, the following equation has infinitely many integer solutions:
9x + 100y = 1.
ax + by = c.
b a
x = x0 + t, y = y0 − t.
d d
(x0 , y0 ) is a particular solution to ax + by = c. Their sum gives a general solution to the given (nonho-
mogeneous) equation.
Before I give the proof, I’ll give some examples, and also discuss the three variable equation ax+by+cz =
d.
Since (6, 9) = 3 | 21, there are infinitely many solutions. Divide the equation by 3 to get
2x + 3y = 7.
x = 2 + 3t, y = 1 − 2t.
1
In general, you may not be able to see a particular solution by inspection. In that case, you can use the
Extended Euclidean algorithm to generate one. We’ll see how to do this in examples that follow.
Example. Solve 6x + 9y = 5.
Example. Find all the solutions (x, y) to the following Diophantine equation for which x and y are both
positive.
11x + 13y = 369.
(11, 13) = 1 | 369, so there are solutions.
It is too hard to guess a particular solution, so I’ll use the Extended Euclidean algorithm:
13 - 6
11 1 5
2 5 1
1 2 0
11 · 6 + 13 · (−5) = 1
11 · 2214 + 13 · (−1845) = 369
Matching this with the given equation 11x + 13y = 369, I see that (x, y) = (2214, −1845) is a particular
solution. The general solution is
The solutions are (x, y) = (4, 25), (17, 14), and (20, 3).
The requirement that the solutions be positive can come up in real-world problems.
Example. Phoebe buys large shirts for $18 each and small shirts for $11 each. The shirts cost a total of
$1188. What is the smallest total number of shirts she could have bought?
2
Let x be the number of large shirts and let y be the number of small shirts. Then
18 - 5
11 1 3
7 1 2
4 1 1
3 1 1
1 3 0
18 · (−3) + 11 · 5 = 1
18 · (−3564) + 11 · 5940 = 1188
x = −3564 and y = 5940 is a particular solution. The general solution is
3564
x ≥ 0 gives − 3564 + 11t ≥ 0 so t ≥ = 324.
11
5940
y ≥ 0 gives 5940 − 18t ≥ 0 so t ≤ = 330.
18
Thus, 324 ≤ t ≤ 330.
The total number of shirts is
x = 66, y = 0, x + y = 66.
8x + 14y + 5z = 11.
3
2(4x + 7y) + 5z = 11.
Let w = 4x + 7y.
2w + 5z = 11.
w = −22 and z = 11 is a particular solution. So
Then
4x + 7y = w = −22 + 5s.
x = −44 + 10s and y = 22 − 5s is a particular solution. The general solution is
x = −44 + 10s + 7t
y = 22 − 5s − 4t
z = 11 − 2s
a1 x1 + · · · an xn = c.
There are solutions if (a1 , . . . an ) | c. If there is a solution, it will in general have n − 1 parameters —
exactly as you’d expect from linear algebra.
ax + by = c.
(a, b) | ax + by = c.
Case 2. Suppose (a, b) | c. Write c = k(a, b) for k ∈ Z. There are integers m and n such that
am + bn = (a, b).
Then
amk + bnk = (a, b)k = c.
Hence, x = km, y = kn, is a solution.
Suppose x = x0 , y = y0 , is a particular solution. Then
b a ab ab
a x0 + t + b y0 − t = t − t + (ax0 + by0 ) = 0 + c = c.
d d d d
b a
This proves that x = x0 + t, y = y0 − t is a solution for every t ∈ Z.
d d
Finally, I want to show that every solution has this form. Suppose then that (x, y) is a solution. Then
ax + by = c and ax0 + by0 = c imply
a(x − x0 ) + b(y − y0 ) = c − c = 0.
4
Therefore,
a b
(x − x0 ) + (y − y0 ) = 0,
(a, b) (a, b)
b a
(y − y0 ) = − (x − x0 ).
(a, b) (a, b)
b a b
Now divides the left side, so it divides the right side. However, , = 1. Therefore,
(a, b) (a, b) (a, b)
b b
x − x0 , or x − x0 = t · for some t ∈ Z.
(a, b) (a, b)
Thus,
b
x = x0 + t · .
(a, b)
b
Substitute x − x0 = t · back into the last x-y equation above:
(a, b)
b a
(y − y0 ) = − (x − x0 )
(a, b) (a, b)
b a b
(y − y0 ) = − t·
(a, b) (a, b) (a, b)
a
y − y0 = t ·
(a, b)
a
y = y0 − t ·
(a, b)
Thus,
b a
x = x0 + t · and y = y0 − t · .
(a, b) (a, b)
c 2019 by Bruce Ikenaga 5