Bézout identities and integer equations
Use a gcd certificate to decide solvability and parameterize every integer solution of a linear equation.
On this page
The question for today
What you’ll understand
- Recover a Bézout identity by reversing Euclidean divisions.
- Decide whether ax + by = c has an integer solution.
- Describe every solution using a single free integer parameter.
An integer equation can have a perfectly good real solution and still have no integer solution. A price expressed in two available coin denominations provides an everyday example: fractions of coins are not allowed. The gcd is the obstruction, and a Bézout identity shows that it is the only obstruction for a linear equation in two integer unknowns. We will build a solution from the algorithm, then explain why a single answer must be enlarged into a complete family.
Reverse the remainder chain
Every remainder in Euclid is an integer combination of the original inputs. Initially this is obvious for a and b. If two successive quantities are combinations, subtracting an integer multiple of one from the other produces another combination. At termination the gcd d therefore has the form au + bv. The coefficients u and v are not generally positive or unique; allowing subtraction is precisely what makes the statement true.
Back substitution recovers the coefficients explicitly. Solve the last nonzero remainder equation for d, replace the preceding remainder by its expression, and repeat until only a and b remain. Keep parentheses until coefficients are collected, since a sign error is easy to hide in mental substitution. Once found, check the identity by direct multiplication. This supplies both a numerical answer and a proof that no larger common divisor was overlooked.
The exact solvability obstruction
Suppose ax + by = c. Every common divisor of a and b must divide the left side and hence c. In particular d must divide c; if it does not, stop immediately. Conversely, if c = dt, multiply the Bézout identity by t to obtain one solution x = tu and y = tv. Necessity and sufficiency are different arguments, and together they establish a complete decision rule.
To find every solution, subtract a known solution from an arbitrary one. Write a = da′ and b = db′ with coprime a′ and b′. The difference equation becomes a′Δx = −b′Δy. A Bézout identity for a′ and b′, multiplied by Δx, shows that b′ divides Δx: both resulting terms are multiples of b′. Thus Δx = b′k and Δy = −a′k. This argument assumes both coefficients are nonzero; if one is zero, solve the remaining one-variable equation and leave the unused variable arbitrary.
Integer solutions are not necessarily feasible solutions
The parameter describes a lattice of points along a real straight line. Adjacent integer solutions differ by a fixed direction vector, so the real line is continuous while the allowed integer points are discrete. Additional constraints such as nonnegative coin counts restrict k to an interval of integers. Bézout guarantees an integer solution when d divides c, but it does not guarantee that this interval contains an integer.
This distinction matters in scheduling, inventory, and modular inverses. An equation may be solvable with negative x, which corresponds to subtraction in arithmetic but may have no direct interpretation as a purchase count. Translate each practical restriction into an inequality on k after deriving the complete family. Testing a few positive guesses cannot establish impossibility, whereas an empty parameter interval gives a short proof. Retaining every solution first makes the later feasibility check systematic.
Work it through
Solve and then impose nonnegativity
Find all integer solutions of 35x + 22y = 1, and decide whether either variable can be nonnegative simultaneously with the other.
Run Euclid: 35 = 22 + 13, 22 = 13 + 9, 13 = 9 + 4, and 9 = 2 × 4 + 1. The gcd is 1, so an integer solution exists.
Back substitute: 1 = 9 − 2(13 − 9) = 3 × 9 − 2 × 13 = 3 × 22 − 5 × 13 = 8 × 22 − 5 × 35. Thus x₀ = −5 and y₀ = 8.
The full family is x = −5 + 22k and y = 8 − 35k. Nonnegative x requires integer k at least 1, while nonnegative y requires k at most 0. The requirements cannot both hold.
Every integer solution has the stated parameter form, but no solution has both coordinates nonnegative.
The living notebook
Explore the model
Interactive lab · modular
A Bézout identity reaches the residue one
Pause and reset the lab, then set both controls: modulus m = 12 and additive step a = 5. Predict that the orbit reaches residue one at index five, then play or step to check: 5 × 5 − 12 × 2 = 1. For a fresh comparison, pause and reset again, then set modulus m = 12 and additive step a = 8. Predict that one is never reached because the gcd is four. This additive orbit illustrates one Bézout consequence; it does not solve general integer equations or impose nonnegative solution constraints.
- Residue r0
- 0
- Orbit period · m/gcd(m,a)
- 12
- Distinct residues visited
- 1 of 12
Addition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forReaching one by repeated addition is equivalent to the step being coprime to the modulus, and a Bézout identity certifies why.
Pause & reason
Check your understanding
Your turn
Try it yourself
Solve 14x + 21y = 35 completely, and list the solutions with x and y both nonnegative.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Divide by the gcd before finding the homogeneous step; then bound the integer parameter.
Compare with the solution
The gcd is 7, and division gives 2x + 3y = 5. A particular solution is (1, 1). Every solution is x = 1 + 3k and y = 1 − 2k for integer k. Nonnegativity gives k at least 0 and at most 0, so only k = 0 is allowed. Thus (1, 1) is the unique nonnegative solution, although infinitely many integer solutions exist without those inequalities.
Keep the idea
Take it with you
- A Bézout identity is a computable certificate for the gcd.
- The gcd dividing the target is necessary and sufficient for integer solvability.
- Practical sign restrictions must be imposed on the full parameter family.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.