Divide both sides of the equation by \(\gcd(a,b)\) (if this does not leave the right-hand side as an integer, there are no solutions). Let's assume that \(ax + by = c\) has already been reduced in this way.
Pick the smaller of \(a\) and \(b\) (here, assume it is \(b\)), and convert to a congruence modulo \(b\text{:}\)
This will reduce to a congruence with one variable, \(x\text{:}\)
Solve the congruence as we did in the previous section. Write your solution as an equation, such as,
Plug this into the original Diophantine equation, and solve for \(y\text{.}\)
If we want to know solutions in a particular range (for example, \(0 \le x, y \le 20\)), pick different values of \(k\) until you have all required solutions.