Let \(a\), \(b\) and \(c\) be integers where \(a\) and \(b\) are non-zero. Consider the following equation
This is called a linear Diophantine equation. We’re interested in only the integers solution to this equation (lattice points). Since we have two variables, then we know that there is either infinitely many solution or none. When do we have a solution? First a Corollary based on the Divison Algorithm / Euclidean Algorithm.
Proof: TODO but based on the Euclidean Algorithm .. just backtrack.
Next, we have
Proof: Suppose \(ax + by = c\). Let \(\gcd(a,b) = d\). Then, \(a = ed\), \(b = fd\) for some \(e,f \in \mathbf{Z}\). Then
Therefore, we must have that \(d \mid c\). For the other direction, suppose that \(d = \gcd(a,b)\). Then, by Corollary 2-1, there exists integers \(x'\) and \(y'\) such that
But we’re given that \(d \mid c\) so \(c = dk\) for some \(k \in \mathbb{Z}\). Multiply the previous equation by \(k\) to see that
So set \(x = kx'\) and \(y = ky'\) to be a solution. \(\ \blacksquare\)
How to Find a Solution
So now suppose that we have an equation like
and suppose that \(\gcd(a,b) = d \mid c\). First, we find an integer \(k\) such that \(dk = c\). Then, divide the equation by \(k\) to get
Now let
\((x_0,y_0)\) is a solution to the equation \(ax + by = c\). To find all the other solutions, suppose that \((x',y')\) is a solution too. Then
Divide the whole equation by \(d\) to get
Therefore,
But now since \(\gcd(a/d,b/d)=1\), then
Hence, there exists some \(t\) such that
But this gives the following solution
To verify this, observe that
Stated as a theorem
Solutions Modulo \(b\)
Before doing an example, consider finding solutions modulo \(b\). That is
The congruence is just a special case of the linear Diophantine equation. By Theorem 2-4, this has a solution if and only if \(\gcd(a,b) \mid c\). Moreover, if we take
then again, by theorem 2-4, this has a solution if and only if \(\gcd(a,b) \mid 1\). That is, \(\gcd(a,b) = 1\) or \(a\) and \(b\) are coprime.
Example
Suppose we want to solve
Then, \(\gcd(23,29) = 1\). \(1 \mid 25\) so there is a solution. To find an initial solution \((x_0,y_0)\), we need to use the Euclidean Algorithm as follows
Then we work backwards to find the coefficients
so \(x_0=-5\) and \(y_0=4\) is an initial solution to \(23x + 29y = 1\). We want to solve \(23x + 29y = 25\). Therefore, the initial solution is \((25 \cdot -5, 4 \cdot 25) = (-125, 100)\). To find the remaining solutions, we use the theorem to get
References
- Number Theory by George E. Andrews
- Math310 Class Notes by Matthias Beck