Processing math: 100%
Skip to main content

Section 3.1 Linear Diophantine Equations

The first goal for this chapter is to completely solve all linear diophantine equations (of two variables). This is the question of finding solutions x,y∈Z of equations of the generic form

ax+by=c for given a,b,c∈Z.
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!

There are several main cases involved in the solution, as we see in the following theorem.

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!f

Subsection 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:

x=x0+bdn,y=y0βˆ’adn for n∈Z!

There are three comments to make to finish the proof.

  • 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βˆ’abnd

    and 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+by0

    and 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

x=1+42n,y=βˆ’1βˆ’62n

which we may rewrite as

x=1+2n,y=βˆ’1βˆ’3n,n∈Z.

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βˆ’adn

    It 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?