2.5: Linear Diophantine Equations
 Page ID
 8828
In this section, we discuss equations in two variables called diophantine equations. These kinds of equations require integer solutions. The goal of this section is to present the set of points that determine the solution to this kind of equations. Geometrically speaking, the diophantine equation represent the equation of a straight line. We need to find the points whose coordinates are integers and through which the straight line passes.
A linear equation of the form \(ax+by=c\) where \(a,b\) and \(c\) are integers is known as a linear diophantine equation.
Note that a solution to the linear diophantine equation \((x_0,y_0)\) requires \(x_0\) and \(y_0\) to be integers. The following theorem describes the case in which the diophantine equation has a solution and what are the solutions of such equations.
The equation \(ax+by=c\) has integer solutions if and only if \(d\mid c\) where \(d=(a,b)\). If the equation has one solution \(x=x_0\), \(y=y_0\), then there are infinitely many solutions and the solutions are given by \[x=x_0+(b/d)t \ \ \ \ \ y=y_0(a/d)t\] where \(t\) is an arbitrary integer.
Suppose that the equation \(ax+by=c\) has integer solution \(x\) and \(y\). Thus since \(d\mid a\) and \(d\mid b\), then \[d\mid (ax+by)=c.\] Now we have to prove that if \(d\mid c\), then the equation has integral solution. Assume that \(d\mid c\). By theorem 9, there exist integers \(m\) and \(n\) such that \[d=am+bn.\] And also there exists integer \(k\) such that \[c=dk\] Now since \(c=ax+by\), we have \[c=dk=(ma+nb)k=a(km)+b(nk).\] Hence a solution for the equation \(ax+by=c\) is \[x_0=km \ \ \mbox{and} \ \ y_0=kn.\] What is left to prove is that we have infinitely many solutions. Let \[x=x_0+(b/d)t \ \ \mbox{and} \ \ y=y_0(a/d)t.\] We have to prove now that \(x\) and \(y\) are solutions for all integers \(t\). Notice that \[ax+by=a(x_0+(b/d)t)+b(y_0(a/d)t)=ax_0+by_0=c.\] We now show that every solution for the equation \(ax+by=c\) is of the form \[x=x_0+(b/d)t \mbox{and} \ \ y=y_0(a/d)t.\] Notice that since \(ax_0+by_0=c\), we have \[a(xx_0)+b(yy_0)=0.\] Hence \[a(xx_0)=b(yy_0).\] Dividing both sides by \(d\), we get \[a/d(xx_0)=b/d(yy_0).\] Notice that \((a/d,b/d)=1\) and thus we get by Lemma 4 that \(a/d\mid yy_0\). As a result, there exists an integer \(t\) such that \(y=y_0(a/d)t\). Now substituting \(yy_0\) in the equation \[a(xx_0)=b(yy_0).\] We get \[x=x_0+(b/d)t.\]
The equation \(3x+6y=7\) has no integer solution because \((3,6)=3\) does not divide \(7\).
There are infinitely many integer solutions for the equation \(4x+6y=8\) because \((4,6)=2 \mid 8\). We use the Euclidean algorithm to determine \(m\) and \(n\) where \(4m+6n=2\). It turns out that \(4(1)+6(1)=2\). And also \(8=2.4\). Thus \(x_0=4.(1)=4\) and \(y_0=4.1=4\) is a particular solution. The solutions are given by \[x=4+3t \ \ \ \ \ y=42t\] for all integers \(t\).
Exercises

Either find all solutions or prove that there are no solutions for the diophantine equation \(21x+7y=147.\)

Either find all solutions or prove that there are no solutions for the diophantine equation \(2x+13y=31.\)

Either find all solutions or prove that there are no solutions for the diophantine equation \(2x+14y=17.\)

A grocer orders apples and bananas at a total cost of $8.4. If the apples cost 25 cents each and the bananas 5 cents each, how many of each type of fruit did he order.
Contributors
Dr. Wissam Raji, Ph.D., of the American University in Beirut. His work was selected by the Saylor Foundation’s Open Textbook Challenge for public release under a Creative Commons Attribution (CC BY) license.