Paragraph

  1. 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.

  2. Pick the smaller of \(a\) and \(b\) (here, assume it is \(b\)), and convert to a congruence modulo \(b\text{:}\)

    \begin{equation*} ax + by \equiv c \pmod{b}\text{.} \end{equation*}

    This will reduce to a congruence with one variable, \(x\text{:}\)

    \begin{equation*} ax \equiv c \pmod{b}\text{.} \end{equation*}
  3. Solve the congruence as we did in the previous section. Write your solution as an equation, such as,

    \begin{equation*} x = n + kb\text{.} \end{equation*}
  4. Plug this into the original Diophantine equation, and solve for \(y\text{.}\)

  5. 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.

in-context