PrevNext

Overview

A Diophantine equation is an algebraic equation where we are strictly looking for integer solutions. The most fundamental type is the Linear Diophantine Equation, which takes the form ax+by=cax + by = c, where a,b,ca, b, c are given integers, and x,yx, y are unknown integers.

Geometrically, the equation ax+by=cax + by = c represents a line in the Cartesian plane. Solving the Diophantine equation means finding the exact points on this line where both the x-coordinate and y-coordinate are integers (often called lattice points).

Key Ideas

  • Existence of Solutions (Bézout's Identity): The equation ax+by=cax + by = c has integer solutions if and only if the greatest common divisor gcd⁡(a,b)\gcd(a, b) divides cc. If gcd⁡(a,b)∤c\gcd(a, b) \nmid c, no integer solutions exist.
  • Finding a Base Solution: If the numbers are small, guess and check. If they are large, use the Extended Euclidean Algorithm to work backward and find a base solution (x0,y0)(x_0, y_0).
  • Generating the Infinite Solution Set: Once you have one valid point (x0,y0)(x_0, y_0), you can find all other integer points on the line using the slope. The general solution is:
    x=x0+bgcd⁡(a,b)⋅kx = x_0 + \frac{b}{\gcd(a, b)} \cdot k
    y=y0−agcd⁡(a,b)⋅ky = y_0 - \frac{a}{\gcd(a, b)} \cdot k
    where kk is any integer. Notice how as xx steps forward by the reduced bb coefficient, yy must step backward by the reduced aa coefficient to keep the sum balanced.

Worked Examples

Example 1: Finding the General Solution

Find all integer solutions to 12x+15y=3912x + 15y = 39.

1. Check for existence: First, compute gcd⁡(12,15)=3\gcd(12, 15) = 3. We check if 3∣393 \mid 39. Since 39/3=1339 / 3 = 13, integer solutions exist.

2. Simplify the equation: Divide the entire equation by the GCD to make the coefficients coprime:

4x+5y=134x + 5y = 13

3. Find a base solution: By inspection, 4(2)+5(1)=8+5=134(2) + 5(1) = 8 + 5 = 13. So, (x0,y0)=(2,1)(x_0, y_0) = (2, 1) is a valid base solution.

4. Write the general solution: Using the simplified coefficients a′=4a'=4 and b′=5b'=5, we apply the general formula. As xx increases by 55, yy must decrease by 44:

x=2+5kx = 2 + 5k
y=1−4ky = 1 - 4k

where k∈Zk \in \mathbb{Z}.

Example 2: Recognizing When No Solutions Exist

Does the equation 14x+21y=5014x + 21y = 50 have any integer solutions?

1. Check for existence: Compute gcd⁡(14,21)=7\gcd(14, 21) = 7. We then check if 7∣507 \mid 50. Since 5050 is not a multiple of 77, Bézout's Identity tells us that it is impossible to form the sum of 5050 using integer multiples of 1414 and 2121. Conclusion: There are no integer solutions.

Example 3: Word Problems and Real-World Constraints

A farmer buys chickens for 33 dollars each and pigs for 55 dollars each. If he spends exactly 3434 dollars, what are all the possible combinations of chickens and pigs he could have bought?

1. Set up the equation: Let cc be the number of chickens and pp be the number of pigs.

3c+5p=343c + 5p = 34

Because he is buying physical animals, we have a real-world constraint: c≥0c \ge 0 and p≥0p \ge 0.

2. Isolate one variable: It is usually easiest to isolate the variable with the smaller coefficient.

3c=34−5p  ⟹  c=34−5p33c = 34 - 5p \implies c = \frac{34 - 5p}{3}

3. Test valid inputs: Since cc must be an integer, 34−5p34 - 5p must be a multiple of 33. We test non-negative integers for pp:

  • If p=0p = 0: c=34/3c = 34 / 3 (Not an integer)
  • If p=1p = 1: c=(34−5)/3=29/3c = (34 - 5) / 3 = 29 / 3 (Not an integer)
  • If p=2p = 2: c=(34−10)/3=24/3=8c = (34 - 10) / 3 = 24 / 3 = 8. Valid solution: (8,2)(8, 2)
  • If p=3p = 3: c=(34−15)/3=19/3c = (34 - 15) / 3 = 19 / 3 (Not an integer)
  • If p=4p = 4: c=(34−20)/3=14/3c = (34 - 20) / 3 = 14 / 3 (Not an integer)
  • If p=5p = 5: c=(34−25)/3=9/3=3c = (34 - 25) / 3 = 9 / 3 = 3. Valid solution: (3,5)(3, 5)
  • If p=6p = 6: c=(34−30)/3=4/3c = (34 - 30) / 3 = 4 / 3 (Not an integer)
  • If p=7p = 7: c=(34−35)/3=−1/3c = (34 - 35) / 3 = -1 / 3 (We stop here because cc is now negative).

Conclusion: The farmer could have bought 8 chickens and 2 pigs, or 3 chickens and 5 pigs.

Common Pitfalls

  • Forgetting to divide by the GCD: When writing the general solution, students often use the original coefficients (e.g., +15k+15k and −12k-12k). You must divide aa and bb by gcd⁡(a,b)\gcd(a,b) to ensure you don't skip over valid integer points between your steps.
  • Sign errors in the general solution: Remember that one variable must increase while the other decreases to maintain the constant sum cc.
  • Ignoring constraints: In word problems, variables often represent physical quantities that cannot be negative. Always bounds-check your general solution against x≥0x \ge 0 and y≥0y \ge 0 if the context demands it.

Practice Problems

StatusSourceProblem NameDifficultyTags
Mastering AMC 8Medium
Show TagsDiophantine Equations
AMC 12AMedium
Show TagsGCD, Linear Diophantine Equations, Number Theory
AJHSMENormal
Show TagsMaximization, Scoring System
AMC 8Normal
Show TagsModular Arithmetic, Optimization
AMC 8Very Easy
Show TagsCombinations, Money
AMC 8Normal
Show TagsFractions, Minimization, Ratios
AMC 8Normal
Show TagsSystems of Equations, Word Problems
AMC 8Normal
Show TagsInequalities, Word Problems
AMC 8Easy
Show TagsBase 10 Representation, Digit Manipulation
AMC 8Easy
Show TagsAlgebraic Setup, Constraints
AMC 8Normal
Show TagsCoins/Stamps, Optimization
AMC 8Normal
Show TagsModular Arithmetic, Optimization
AMC 8Hard
Show TagsDiophantine Equations, Factors

Module Progress:

Join the Discord Community!

Stuck on a problem, or don't understand a module? Join the Discord and get help with your doubts while making more math friends.

PrevNext