Bézout's Identity/Proof 2

Theorem
Let $a, b \in \Z$ such that $a$ and $b$ are not both zero.

Let $\gcd \left\{{a, b}\right\}$ be the greatest common divisor of $a$ and $b$.

Then:
 * $\exists x, y \in \Z: a x + b y = \gcd \left\{{a, b}\right\}$

That is, $\gcd \left\{{a, b}\right\}$ is an integer combination (or linear combination) of $a$ and $b$.

Furthermore, $\gcd \left\{{a, b}\right\}$ is the smallest positive integer combination of $a$ and $b$.

Proof
Let $a, b \in \Z$ such that $a$ and $b$ are not both zero.

Let $S$ be the set of all positive integer combinations of $a$ and $b$:


 * $S = \left\{{x \in \Z, x > 0: x = m a + n b: m, n \in \Z}\right\}$

First we establish that $S \ne \varnothing$.

We have:

As it is not the case that both $a = 0$ and $b = 0$, it must be that at least one of $\left \vert {a} \right \vert \in S$ or $\left \vert {b} \right \vert \in S$.

Therefore $S \ne \varnothing$.

As $S$ contains only positive integers, $S$ is bounded below by $0$ and therefore $S$ has a smallest element.

Call this smallest element $d$: we have $d = u a + v b$ for some $u, v \in \Z$.

Let $x \in S$.

By the Division Theorem:
 * $x = q d + r, 0 \le r < d$

Suppose $d \nmid x$.

Then $x \ne q d$ and so $0 < r$.

But:

which contradicts the choice of $d$ as the smallest element of $S$.

Therefore $\forall x \in S: d \mathop \backslash x$.

In particular:


 * $d \mathop \backslash \left \vert {a} \right \vert = 1 \times a + 0 \times b$


 * $d \mathop \backslash \left \vert {b} \right \vert = 0 \times a + 1 \times b$

Thus:
 * $d \mathop \backslash a \land d \mathop \backslash b \implies 1 \le d \le \gcd \left\{{a, b}\right\}$

However, note that as $\gcd \left\{{a, b}\right\}$ also divides $a$ and $b$ (by definition), we have:

So $\gcd \left\{{a, b}\right\} = d = u a + v b$.