Linear Diophantine Equations
When does ax + by = c have integer solutions? When it does, how many, and how do you find them all? Complete theory including the Frobenius number for two coprime integers.
You want to pay ₹100 using ₹12 notes and ₹8 notes. Is it possible? If yes, in how many ways?
Translated: does have solutions in positive integers?
This is a linear Diophantine equation — a linear equation where you demand integer solutions. The theory of when solutions exist, and how to find them all, comes entirely from GCD.
When does have solutions?
Theorem. The equation has integer solutions if and only if .
Proof.
Necessity. If is a solution, then divides both and , so it divides .
Sufficiency. By Bezout's Identity, for some integers . If , write . Then .
Consequence. If , then always has solutions for any integer .
All solutions from one
Theorem. If is one solution to , then every integer solution is:
where .
Proof. Suppose is another solution. Then:
Since , Euclid's Lemma forces . Write . Back-substitute to get .
Worked examples
Example 1. Solve .
By inspection: . Particular solution: .
General solution: , , .
Example 2. Solve .
and . ✓ Divide through: .
Particular solution: . So .
General solution: , , .
Example 3. The ₹100 problem: , positive integers.
and . ✓ Divide: .
Particular solution: (check: ). ✓
General solution: , .
For : . For : .
So — exactly 4 solutions: .
Counting solutions in a range
A common JEE pattern: find the number of non-negative (or positive) integer solutions to .
The solutions form an arithmetic progression in . Count the integers in the valid range.
General method:
- Find . Check .
- Divide through by : where .
- Find one particular solution .
- General: , .
- Set constraints (, , etc.) and count valid .
The Frobenius Number
Question. Given coprime positive integers and , which positive integers cannot be expressed as with ?
Theorem (Sylvester-Frobenius). The largest integer that cannot be represented is:
The number of non-representable positive integers is .
Proof of the formula. is representable iff has a solution with . Work through the modular arithmetic: exactly values of in each block of consecutive integers are representable once is large enough. The cutoff works out to .
Example. Denominations 3 and 7 (coprime): largest non-representable = .
Check: 11 cannot be written as with . (Try: gives , no; gives , no.) ✓
12 = 3×4 + 7×0 ✓. Every integer is representable.
Number of non-representable positive integers: . They are: 1, 2, 4, 5, 8, 11.
Geometric interpretation
The equation defines a line in the -plane. Integer solutions are lattice points — points with integer coordinates — on this line.
The general solution says: lattice points on a line are evenly spaced. The spacing vector is . If one lattice point exists, infinitely many do (running in both directions along the line).
If you restrict to positive integers, you're looking at lattice points in the first quadrant — a finite set.
Common mistakes
Mistake 1. Checking but forgetting to also verify the sign/range constraints when looking for positive solutions.
Mistake 2. Taking the general solution formula as , without dividing by first. The correct step size is , not .
Mistake 3. Assuming the Frobenius formula applies when . It doesn't — if , then only multiples of are representable at all; most integers are permanently excluded.
The connection between and is direct — one is just the other with playing the role of the "error." That bridge is built in GCD and Modular Arithmetic.