Linear Diophantine Equation Calculator
Solve linear Diophantine equations of the form ax + by = c and find all integer solutions.
Equation: ax + by = c
Solution Condition
The equation ax + by = c has integer solutions if and only if:
gcd(a, b) divides c
General Solution
If (xβ, yβ) is a particular solution, then all solutions are:
x = xβ + (b/d)t
y = yβ - (a/d)t
where d = gcd(a,b) and t is any integer
Equation
12x + 8y = 28
GCD(a, b)
4
Solutions Exist
Yes
Particular Solution
xβ
7
yβ
-7
General Solution
x = 7 + 2t
y = -7 - 3t
where t is any integer
Sample Solutions
| t | x | y | Verify |
|---|---|---|---|
| -5 | -3 | 8 | OK |
| -4 | -1 | 5 | OK |
| -3 | 1 | 2 | OK |
| -2 | 3 | -1 | OK |
| -1 | 5 | -4 | OK |
| 0 | 7 | -7 | OK |
| 1 | 9 | -10 | OK |
| 2 | 11 | -13 | OK |
| 3 | 13 | -16 | OK |
| 4 | 15 | -19 | OK |
| 5 | 17 | -22 | OK |