Skip to content

Commit 5735fd0

Browse files
authored
linear-diophantine: add Bézout's lemma and slightly reformat mathjax (#1358)
* linear-diophantine: add Bézout's lemma and slightly reformat mathjax * linear-diophantine: move identity * linear-diophantine: reword Bézout and explain all solutions
1 parent 1f1733e commit 5735fd0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/algebra/linear-diophantine-equation.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ A degenerate case that need to be taken care of is when $a = b = 0$. It is easy
2727

2828
When $a \neq 0$ and $b \neq 0$, the equation $ax+by=c$ can be equivalently treated as either of the following:
2929

30-
\begin{gather}
31-
ax \equiv c \pmod b,\newline
32-
by \equiv c \pmod a.
33-
\end{gather}
30+
\begin{align}
31+
ax &\equiv c \pmod b \\
32+
by &\equiv c \pmod a
33+
\end{align}
3434

3535
Without loss of generality, assume that $b \neq 0$ and consider the first equation. When $a$ and $b$ are co-prime, the solution to it is given as
3636

@@ -51,6 +51,12 @@ y = \frac{c-ax}{b}.
5151

5252
## Algorithmic solution
5353

54+
**Bézout's lemma** (also called Bézout's identity) is a useful result that can be used to understand the following solution.
55+
56+
> Let $g = \gcd(a,b)$. Then there exist integers $x,y$ such that $ax + by = g$.
57+
>
58+
> Moreover, $g$ is the least such positive integer that can be written as $ax + by$; all integers of the form $ax + by$ are multiples of $g$.
59+
5460
To find one solution of the Diophantine equation with 2 unknowns, you can use the [Extended Euclidean algorithm](extended-euclid-algorithm.md). First, assume that $a$ and $b$ are non-negative. When we apply Extended Euclidean algorithm for $a$ and $b$, we can find their greatest common divisor $g$ and 2 numbers $x_g$ and $y_g$ such that:
5561

5662
$$a x_g + b y_g = g$$
@@ -119,7 +125,7 @@ $$y = y_0 - k \cdot \frac{a}{g}$$
119125
120126
are solutions of the given Diophantine equation.
121127
122-
Moreover, this is the set of all possible solutions of the given Diophantine equation.
128+
Since the equation is linear, all solutions lie on the same line, and by the definition of $g$ this is the set of all possible solutions of the given Diophantine equation.
123129
124130
## Finding the number of solutions and the solutions in a given interval
125131

0 commit comments

Comments
 (0)