Loading [MathJax]/jax/output/HTML-CSS/jax.js
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

5.1: Linear Diophantine Equations

( \newcommand{\kernel}{\mathrm{null}\,}\)

Thinking out loud

Mary went to a park and saw vehicles with 2 wheels and 4 wheels. She counted the wheels. When she came home she told her mom that the vehicles she had seen had a total of 28 wheels. Her mom asked how many vehicles had 2 wheels and how many vehicles had 4 wheels. What was Mary's response?

Diophantine Equation

A Diophantine equation is a polynomial equation with 2 or more integer unknowns.

A Linear Diophantine equation (LDE) is an equation with 2 or more integer unknowns and the integer unknowns are each to at most degree of 1.

Linear Diophantine equation in two variables takes the form of ax+by=c, where x,yZ and a, b, c are integer constants. x and y are unknown variables.

A Homogeneous Linear Diophantine equation (HLDE) is ax+by=0,x,yZ. Note that x=0 and y=0 is a solution, called the trivial solution for this equation.

Example 5.1.1:

Example of a homogeneous linear diophantine equation:

5x3y=0,x,yZ.

In this case x=3, y=5 is a solution as is x=6, y=10.
Hence x=3k and y=5k,kZ represent all the solutions.
Check: 5(3k)3(5k)=15k15k=0.

**** NOTE**** In a homogeneous linear diophantine equation, the minute the equation is an addition, one of the variable is required to be negative.
In the case of 5x+3y=0,x,yZ, x=3k and y=5k,kZ are solutions.

THEOREM: Homogeneous Linear Diophantine Equation

Let ax+by=0,x,yZ be a homogeneous linear Diophantine equation.
If gcd(a,b)=d, then the complete family of solutions to the above equation is
x=bdk, and y=adk,kZ.

Example 5.1.2: Solve the Homogeneous linear Diophantine equation

6x+9y=0,x,yZ.

Solution:
Note that GCD of 6 and 9 is 3. Hence the solutions are
x=9k3=3k and y=6k3=2k with kZ.

Use the following steps to solve a non-homogeneous linear Diophantine equation.

Solve the linear Diophantine Equations: ax+by=c,x,yZ.

Use the following steps to solve a non-homogeneous linear Diophantine equation.

Step 1: Determine the GCD of a and b. Let suppose gcd(a,b)=d.
Step 2: Check that the GCD of a and b divides c. NOTE: If YES, continue on to step 3. If NO, STOP as there are no solutions.
Step 3: Find a particular solution to ax+by=c by first finding x0,y0 such that ax+by=d. Suppose x=cdx0 and y=cdy0.
Step 4: Use a change of variables: Let u=xcdx0 and v=ycdy0, then we will see that au+bv=0 (important to check your result).
Step 5: Solve au+bv=0. That is: u=bdm and v=adm,mZ.
Step 6: Substitute for u and v. Thus the general solutions are xcdx0=bdm and ycdy0=adm,mZ.

Example 5.1.3: Die hard Jug Problem

Solve the linear Diophantine Equations: 5x+3y=4,x,yZ.

Solution:
Step 1: Determine the GCD of 5 and 3 (a and b). Since 5(2)+3(3)=1, gcd(5,3)=1.
Step 2: Since 14, we will continue on to Step 3.
Step 3: Find a particular solution to 5x+3y=4,x,yZ.
Since 5(5)+3(7)=4,x=5 and y=7 is a particular solution.
Step 4: Let u=x5 and v=y+7. Note: The opposite integer of Step 4, so if it's positive in step 4 it will be negative in step 5 and vice versa.
Then 5u+3v=5(x5)+3(y+7)
=5x25+3y+21
=5x+3y4
=44 (because the equation is 5x+3y=4)
=0.
Step 5: Solve 5u+3v=0
The general solutions are u=3m and v=5m,mZ.
Step 6: x5=3m and y+7=5m,mZ.
Hence the general solutions are x=3m+5,y=5m7,mZ.

Example 5.1.4:

Solve the linear Diophantine Equations: 2x+4y=21,x,yZ.

Solution:
Since gcd(2,4)=2 and 2 does not divide 21, 2x+4y=21 has no solution.

Example 5.1.5:

Solve the linear Diophantine Equation 20x+16y=500,x,yZ+.

Solution

Both x,y0.500=20(x)+16(y).

Step 1: gcd(20,16)=4. Since 4|500, we expect a solution.

Step 2: A solution is 4125=20(1)(125)+16(1)(125).

500=20(125)+16(125)

Hence, x=125 and y=125 is a solution to 500=20x+16y.

Step 3: Let u = x - 125 and v = y + 125.

Consider that 20u + 16v =20x - (20)(125) + 16y +(16)(125)

=20x +16y -[(20)(125) -(16)(125)]

=20x + 16y -500.

Thus, 20u + 16v = 0.

Step 4: In general, the solution to ax + by = 0 is x=bdk and y=-adk, kZ \ {0}, d=gcd(a,b). Recall, gcd(20, 16) = 4.

Thus u = 16k/4 = 4k and v = -20k/4 = -5k, k ∈ ℤ.

Step 5: Replace u and v.

Consider 4k = x - 125 and -5k = y + 125.

Hence, x = 4k + 125 and y = -5k - 125.

Step 6: Both x and y ≥ 0. x ≤ 25 and y ≤ 31 since total is 500.

4k + 125 ≥ 0, k ≥ -125/4, ∴ k ≥ -31.25.

4k + 125 ≤ 25, 4k ≤ -100, ∴ k ≤ -25.

Thus, the possible solutions are:

Let k = -25 then x = 25, y = 0.

Let k = -26 then x = 21, y = 5.

Let k = -27 then x = 17, y = 10.

Let k = -28 then x = 13, y = 15.

Let k = -29 then x = 9, y = 20.

Let k = -30 then x = 5, y = 25.

Let k = -31 then x = 1, y = 30.

Thus the options of (x,y that satisfy the given equation are:

{ (25,0), (21,5), (17,10), (13, 15), (9, 20), (5, 25), (1,30)}

The following problem can be found in puzzle books.

Example 5.1.6:

Solution

Let x be the number of dollars Mrs Brown should have received and y be the number of cents she should have received.

Then 2(100x + y) = 100y + x - 5

Note double original amount without spending a nickel.

200x + 2y = 100y + x - 5

199x - 98y = -5.

5 = - 199x + 98y

 

Step 1: gcd(199,98) = 1. Since 1 | 5, we can continue.

Step 2: A solution is 51=-199(-33)(5) + (98)(-67)(5)

5 = -199(-165) + 98(-335).

Hence x = -165 and y = -335 is a solution to 5 = 98y - 199x.

Step 3: Let u = x + 165 and v = y + 335.

Consider that -199u + 98v = -199(x + 165) + 98(y + 335)

= -199x + 98y - [(199)(165) + (98)(335)]

Thus -199u + 98v = -199x + 98y - 5 = 0.

Step 4: In general, the solution to ax + by = 0 is x=bdk and y=-adk, kZ \ {0}, d=gcd(a,b).

Recall, gcd(199, 98) = 1.

Thus, u = 98k and v = 199k, k ∈ ℤ.

Step 5: Replace u and v.

x + 165 = 98k and y + 335 = 199k, k ∈ ℤ.

Hence x = -165 + 98k and y = -335 + 199k.

Step 6: Both x & y ≥ 0 and both x, y < 100

-165 + 98k ≥ 0, so k ≥ 1.68

-335 + 199k ≥ 0, so k ≥ 1.68

-165 + 98k < 100, 98k < 265, ∴ k < 2.70

-335 + 199k < 100, 199k < 435, ∴ k < 2.18

Since, 1.68 ≤ k < 2.18 and k ∈ ℤ, k = 2.

Thus, x = 98(2) - 165 = 31 and y = -335 + 199(2) = 63.

Thus, the cheque was for $31.63.

To verify, the teller gave Mrs. Brown $63.31, she then spent 5 cents, leaving her with $63.26 which is twice the check amount (2)($31.63)=$63.26.✔

PRACTICAL USES

  • Cryptography
  • Designing different combinations of a variety of elements.

This page titled 5.1: Linear Diophantine Equations is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Pamini Thangarajah.

  • Was this article helpful?

Support Center

How can we help?