Diophantine Equation Solver

ax + by = c (integers)

CalculatorsFreeNo Signup
4.4(217 reviews)
All Tools

Loading tool...

About Diophantine Equation Solver

A linear Diophantine equation solver for ax + by = c. Uses the extended Euclidean algorithm to find gcd(a,b) and particular solution. Shows general solution x = x₀ + (b/d)t, y = y₀ − (a/d)t. Checks solvability (d|c). All calculations are client-side.

Diophantine Equation Solver Features

  • gcd check
  • Particular solution
  • General solution
  • Extended GCD
  • Presets
Linear Diophantine equation: ax + by = c has integer solutions iff gcd(a,b)|c. Extended Euclidean algorithm: find x₀,y₀ such that ax₀ + by₀ = gcd(a,b). Scale to get particular solution. General: x = x₀(c/d) + (b/d)t, y = y₀(c/d) − (a/d)t.

How to Use

Enter coefficients:

  • a, b, c: Integer coefficients
  • gcd: Solvability check
  • Solution: x, y parameterized by t

Algorithm

Extended Euclidean: gcd(a,b) = ax₀+by₀. If d=gcd(a,b) divides c, multiply by c/d. General solution adds multiples of (b/d, −a/d) to the particular solution.

Applications

  • Coin problems (Chicken McNugget)
  • Cryptography (RSA key generation)
  • Number theory proofs
  • Integer programming

Step-by-Step Instructions

  1. 1Enter a, b, c.
  2. 2Check if gcd(a,b)|c.
  3. 3Get particular solution.
  4. 4View general solution.
  5. 5Find specific solutions.

Diophantine Equation Solver — Frequently Asked Questions

When does ax + by = c have solutions?+

If and only if gcd(a,b) divides c. For example, 6x + 10y = 5 has no solutions because gcd(6,10)=2 doesn't divide 5. But 6x + 10y = 4 has solutions because 2|4.

How many solutions are there?+

If one solution exists, infinitely many: x = x₀ + (b/d)t, y = y₀ − (a/d)t for all integers t. If you need positive solutions, find t values where both x>0 and y>0. There may be finitely many or none.

What is the Chicken McNugget theorem?+

For coprime a,b: the largest integer NOT representable as ax+by (x,y≥0) is ab−a−b. So for 6 and 9 nugget packs (gcd=3), you can't represent all multiples of 3. For coprime 6,7: largest unrepresentable = 42−6−7=29.

Share this tool: