Skip to main content
Calcimator

Diophantine Equation Calculator

Solve linear Diophantine equations of the form ax + by = c. Find integer solutions using the Extended Euclidean Algorithm.

About this calculator

A linear Diophantine equation asks for whole-number solutions to ax + by = c, and whether any exist at all comes down to a single divisibility check: a solution exists exactly when the greatest common divisor of a and b divides c evenly, with no remainder. This calculator runs the Extended Euclidean Algorithm to compute that GCD and, in the same pass, two coefficients that express the GCD itself as a combination of a and b — a result called Bezout's identity. Those coefficients are then scaled by c divided by the GCD to produce one particular solution, x-naught and y-naught, that genuinely satisfies the original equation rather than an equation for the GCD alone.

Because a linear equation with integer solutions always has infinitely many of them, the calculator also reports the General Solution as a formula in a free parameter t: every integer value of t, positive, negative, or zero, produces another valid pair. At the default values of a = 3, b = 5, c = 1, the GCD of 3 and 5 is 1, which divides every integer including 1 itself, so a solution is guaranteed to exist before any arithmetic even starts. When a and b share a larger common factor that does not divide c, the calculator reports plainly that no integer solution exists — it does not fall back to showing the nearest approximate, non-integer answer, because none of the outputs here are meant to be read as anything but exact whole numbers.

Inputs

Results

Solution Exists

Yes

x₀ (particular)2
y₀ (particular)-1
GCD(a, b)1
General Solutionx = 2 + 5t, y = -1 - 3t
How to Use This Calculator
  1. Enter a, b, and c.
  2. Review the Solution Exists result.
  3. Use x₀ (particular) and y₀ (particular) to inform your decision.
  4. Use the chart to visualize the results and explore different scenarios by adjusting inputs.

What each input means

a
Coefficient a in ax + by = c
b
Coefficient b in ax + by = c
c
Right-hand side constant c in ax + by = c

How this is calculated

Worked example, using the default values

  1. Identify Input Parameters
    a = 3, b = 5, c = 1 = 3 input(s) provided
  2. Calculate Solution Exists
    Yes = Yes
  3. Calculate x₀
    2 = 2
  4. Calculate y₀
    -1 = -1

Engine last updated . Checked against 3 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.

Frequently Asked Questions

How does the calculator know a solution exists before solving for it?

It computes the greatest common divisor of a and b first and checks whether that divides c with no remainder. That single divisibility test, proven by number theory, is both necessary and sufficient — it is never wrong about whether an integer solution can be found.

What is the General Solution formula actually telling me?

It describes every integer solution at once using a free parameter t: starting from the one particular solution the calculator found, adding a multiple of b divided by the GCD to x and subtracting the matching multiple of a divided by the GCD from y always produces another valid pair.

What happens if a and b share a common factor that doesn't divide c?

The calculator reports directly that no integer solution exists, rather than offering a rounded or approximate pair. This is a case where the mathematics genuinely forbids any whole-number answer, so no amount of extra searching would ever turn one up.

How does the Extended Euclidean Algorithm find x-naught and y-naught, not just the GCD?

The ordinary Euclidean algorithm only tracks remainders while computing the GCD. The extended version also carries a pair of coefficients backward through each step, so by the time the GCD is found, those coefficients already express it as a combination of the original a and b.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Math & Statistics.