Section 11.3 Linear Diophantine equations
Let us consider again the linear Diophantine equation
We will use some properties about continued fractions to find a solution \((x, y)\) to this equation provided one exists. Since we must have \(\gcd(a, b)\vert c\) to have a solution we will assume this to be the case. Also, if \(d = \gcd(a, b)\gt 1,\) we can consider the related equation
where \(\gcd(a/d, b/d) = 1.\) We continue to reduce this system to only looking at the equation
where \(\gcd(a, b) = 1;\) we can then find a solution to the general equation.
To get a solution to
where \(\gcd(a, b) = 1,\) we will consider the simple continued fraction of \(a/b.\) Doing this we gain the following theorem.
Theorem 11.3.1.
Let \(a, b \in\mathbb{N}\) with \(\gcd(a, b) = 1.\) Write \(a/b =[a_0; a_1,..., a_n], C_k = p_k/q_k\) the convergents of \(a/b,\) and consider the equation
If \(n\) is odd then the equation in (11.3.1) has the solution \((x_0, y_0) =(q_{n-1}, -p_{n-1}),\) whereas for even \(n,\) then (11.3.1) has the solution \((x_0, y_0) =(-q_{n-1}, p_{n-1}).\)
Proof.
We expand
The last two convergents of this continued fraction are
Since \(\gcd(p_n, q_n) = 1\) we have that \(p_n = a\) and \(q_n = b.\) By the last theorem of the previous section we have that
Considering the cases of \(n\) for even and odd, we will have our result.
If \(n\) is even, write \(n = 2k\) for some \(k,\) then
and so
If \(n\) is odd, write \(n=2k+1\) for some \(k,\) then
Example 11.3.2.
We solve the Diophantine equation \(6x + 32y = 2.\) Since \(\gcd(6, 32) = 2,\) we divide by \(2\) and consider the equation
Using the Euclidean algorithm for \(3\) and \(16\) gives
So
The convergents of \(3/16\) are \(C_0 = 0, C_1 = 1/5,\) and \(C_2 = 3/16.\) Since \(n\) is even we have that \((x_0, y_0) = (-5, 1)\) is a solution to \(3x + 16y = 1.\) Thus multiplying the equation by \(2,\) we have that \((x_0, y_0) = (-5, 1)\) is a solution to \(6x + 32y = 2.\)