[Math] Find the general solution to diophantine equation $-221x + 187y – 493 = 0$

diophantine equationselementary-number-theorysolution-verification

I have to find the general solution to

$$-221x + 187y – 493 = 0$$ The main issue, I'm figuring out if I have found the general solution or not. Below, are my steps:

The $\gcd{(-221,187)} = 17$ and $\gcd{(-221,187)} \mid -493 = -29$.

\begin{align}
&221 = 187 + 34 \\
&187 = 34(5) + 17 \\
&34 = 17(2)
\end{align}

Then from here, I go in reverse and do the following:

\begin{align}
17 &= 187 – 34(5) \\
&= 187 – 5(221 – 187) \\
&= 187 – 5(221) + 5(187) \\
&= -5(221) + 6(187) \\
&= 221(-5) + 187(6)
\end{align}

Then from here, I rearrange the equation to get

$$221(-5) + 187(6) – 17$$

However, this doesn't resemble my original equation, so I have to multiple everything by $29$ to get

$$-221(145) + 187(174) – 493 = 0$$

So now my $x$ equation should be in the form of $x = x_0 + jb$ and $y = y_0 – ja$, where $j \in \mathbb{Z}$. My general solution should be:

\begin{align}
&x = 145 + \frac{174}{29}j = 145 + 11j \\
&y = 174 – \frac{-221}{29}j = 174 + 13j
\end{align}

So, is that correct and is this how you would solve these linear Diophantine equations?

Thanks a lot!

Best Answer

As far as I know, Cauchy gave the [first] general solution:

Theorem (Cauchy). If $r,s,t$ are relatively prime integers, the complete solution to $$rX+sY+tZ=0$$ in integers $x,y,z$ is given by $$ (x,y,z) = (s\delta-t\beta,\ t\alpha-r\delta,\ r\beta-s\alpha),$$ where $\alpha, \beta,\delta$ are arbitrary integers.

Your problem is then, as you point out, handled by Cauchy's after dividing out the gcd of $17$.