Section 3.1 Linear Diophantine Equations
ΒΆRemark 3.1.1.
They have been studied since the late Roman era, most notably by the (Greek speaking) mathematician Diophantus, from whom we derive their name, though we know little else about him. It turns out that a general solution for equations like 6x+4y=2 was already known in the early medieval days by Indian mathematicians like Aryabhata. When, shortly after 1600, Bachet de MΓ©ziriac (see Remark 3.5.2) came up with the same answer, he was only the next in a long line of people coming up with a solution again and again. And that is the solution we are doing in this section!
Theorem 3.1.2. Solutions of Linear Diophantine Equations.
Given integers a,b,c, we wish to find all integer solutions x,y to ax+by=c.
Let d=gcd(a,b), unless a=b=0 in which case let d=0. We will consider cases by ease of generating solutions.
When c is not a multiple of d (including if cβ d=0), there is no solution.
When a or b is zero (but not both) and the nonzero one divides c, there are infinitely many solutions that require little work to obtain.
When a,bβ 0 and c=d, there are infinitely many solutions, but you will need to first obtain one solution in order to generate the others.
When a,bβ 0 and c is a nontrivial multiple of d, there are infinitely many solutions that are easiest to generate by means of a solution to ax+by=d.
Proof.
The details are in the following subsections.
When \(c\) is not a multiple of \(d\text{:}\) Subsection 3.1.1
When \(a\) or \(b\) is zero: Subsection 3.1.2
When \(c=d\text{:}\) Subsection 3.1.3
When \(c\) is a nontrivial multiple of \(d\text{:}\) Subsection 3.1.4
You should definitely follow the steps with specific simple numbers to see how each proof works. Examples 3.1.3 and 3.1.4 are good models.
Subsection 3.1.1 If c is not a multiple of gcd(a,b)
ΒΆWhen dβ 0, our previous theorems say that solving ax+by=c is impossible. Can you see why? For instance, try it out with a=6, b=9, and c=5. Reading the statement of Theorem 3.1.2 carefully shows that this case includes the situation where a=0=b but cβ 0. It is also an easy exercise to show this is impossible. You can provide full details of all these things in Exercise 3.6.8. Don't forget the division algorithm!fSubsection 3.1.2 If a or b is zero
ΒΆSuppose b=0 β in which case gcd(a,b)=a. (Try a=55 as an example.) Then we are just solving ax=c, so the equation is true because we already assumed that d=aβ£c. All pairs (ca,y) with integer y are solutions. If a=0 the answer is analogous; write it down for yourself as practice!Subsection 3.1.3 If c=gcd(a,b)
ΒΆSuppose a,bβ 0 and c actually is the gcd of a and bβ¦ then there is some work to do. Follow along with a=60, b=42, and c=6 if you wish. Your first step should be to get that gcd d via the Euclidean algorithm. Then you will be able to go backwards (i.e. using the Bezout identity 2.4.1) to get one solution (x0,y0). That is important, since now at least one ax0+by0=c is known. The next step is the last one; write down the entire solution set:First, look at the structure of the solutions. The constants a and b have switched their βaffiliationβ from x and y to y and x. Also note that x and y have Β± involved. It doesn't really matter which is which (switch βn for n to see why), but if they have the same sign it is wrong. (When in doubt, try something and then check to see if the answers are right.)
-
It's easy to check that any particular solution works.
a(x0+bdn)+b(y0βadn)=ax0+abnd+by0βabndand ax0+by0=c by hypothesis.
-
Why does this give all solutions? First note that since the only common divisors of a and b are divisors of d, the integers bd and ad must be relatively prime.
Now pick another solution x=xβ²,y=yβ², and let's show it has the desired form. Start with
axβ²+byβ²=c=ax0+by0and gather terms so that
ad(xβ²βx0)=βbd(yβ²βy0).Since bd divides the right side, it divides the left side as well. Now we use Proposition 2.4.9 and the observation in the previous paragraph to see bd must divide the xβ²βx0 factor of the left-hand side, so that there exists an integer k such that
xβ²βx0=kbd, which means xβ²=x0+kbd,which is exactly what we just said was the form of all solutions.
Example 3.1.3. An easy example: 6x+4y=2.
Trial and error tells us that 6x+4y=2 can be solved with x0=1,y0=β1. Thus the full answer is
which we may rewrite as
Subsection 3.1.4 If c is a nontrivial multiple of the gcd
ΒΆFinally, what if c is not the greatest common divisor but we still have solutions because dβ£c? (Follow along in Example 3.1.4 if you wish.)First, we can write c=dm, where again d is the greatest common divisor.
In Subsection 3.1.3 we just saw that there must be a solution for ax+by=d. Take any solution (x0,y0) to this equation.
-
By hypothesis, d=ax0+by0. Now multiply this by m to obtain
c=dm=ax0m+by0m=a(x0m)+b(y0m)which shows x=x0m,y=y0m is a solution to the original equation ax+by=c.
-
Finally, the surprise is that the full solution has the same form as in Subsection 3.1.3:
x=x0m+bdn,y=y0mβadnIt is easy to check and the proof is very similar to the case c=d (see Exercise 3.6.9). Intuitively, the reason you don't need the m in the fractions is because they will just cancel anyway.
Example 3.1.4.
Try to do 15xβ21y=6, a slightly harder one. (Hint: d=3; what are c and d?