Diophantine Equation Calculator
Solve linear Diophantine equations ax + by = c for integer solutions using the Extended Euclidean Algorithm.
Equation: ax + by = c
12x + 8y = 20
General Solution
x = 5 + 2t
y = -5 + -3t
where t is any integer
gcd(12, 8)
4
Particular Solution
(5, -5)
Smallest Positive Solution
x = 1, y = 1
Sample Solutions
| t | x | y | Check |
|---|---|---|---|
| -3 | -1 | 4 | 20 |
| -2 | 1 | 1 | 20 |
| -1 | 3 | -2 | 20 |
| 0 | 5 | -5 | 20 |
| 1 | 7 | -8 | 20 |
| 2 | 9 | -11 | 20 |
| 3 | 11 | -14 | 20 |
Linear Diophantine Equations
Existence Condition
ax + by = c has integer solutions if and only if gcd(a, b) divides c.
General Solution
If (x₀, y₀) is a particular solution, all solutions are: x = x₀ + (b/d)t, y = y₀ - (a/d)t