This notebook explores how to compute greatest common divisors and solve linear diophantine equations in the integers.
The gcd is computed as $2^2\cdot 3 = 12$.
We apply the division algorithm repeatedly:
$$48 = 20 \cdot 2 + 8$$ $$20 = 8 \cdot 2 + 4$$ $$8 = 4 \cdot 2 + 0$$The last non-zero remainder is $4$, so $\gcd(48, 20) = 4$.
However, we can still find the gcd efficiently!
A linear Diophantine equation is an equation of the form: $$ax + by = d$$ where $a, b, d$ are integers and we seek integer solutions for $x$ and $y$.
A fundamental result is that this equation has integer solutions if and only if $\gcd(a, b)$ divides $d$.
When we use the Euclidean algorithm to find $\gcd(a, b)$, we can back substitute to express the GCD as a linear combination of $a$ and $b$. This process allows us to solve linear Diophantine equations.
First, we apply the Euclidean algorithm to find $\gcd(13, 17)$:
$$17 = 13 \cdot 1 + 4$$ $$13 = 4 \cdot 3 + 1$$ $$4 = 1 \cdot 4 + 0$$The GCD is $1$, which divides $1$, so the equation has integer solutions.
Now we back substitute to express $1$ as a linear combination of $13$ and $17$:
From the second equation: $$1 = 13 - 4 \cdot 3$$ Substitute $4 = 17 - 13 \cdot 1$ from the first equation: $$1 = 13 - (17 - 13 \cdot 1) \cdot 3$$ $$1 = 13 - 17 \cdot 3 + 13 \cdot 3$$ $$1 = 13 \cdot 4 + 17 \cdot (-3)$$Therefore, one solution is $x = 4$ and $y = -3$.
We can verify: $13(4) + 17(-3) = 52 - 51 = 1$ ✓
Once we have one particular solution $(x_0, y_0)$ to $ax + by = d$, we can find all solutions using:
$$x = x_0 + \frac{b}{\gcd(a,b)} \cdot t$$ $$y = y_0 - \frac{a}{\gcd(a,b)} \cdot t$$where $t$ is any integer.
Prove that every solution to the linear Diophantine equation $ax + by = d$ is of the form:
$$x = x_0 + \frac{b}{\gcd(a,b)} \cdot t$$ $$y = y_0 - \frac{a}{\gcd(a,b)} \cdot t$$where $(x_0, y_0)$ is a particular solution and $t$ is any integer.
Hint: If $(x_1, y_1)$ is another solution, consider $a(x_1 - x_0) + b(y_1 - y_0)$ and what this equals.