Bézout's Identity/Proof 2

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 \mathrel \backslash x$.

In particular:


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


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

Thus:
 * $d \mathrel \backslash a \land d \mathrel \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:

Since $d$ is the smallest number in $S$, $\gcd \left\{{a, b}\right\} = d = u a + v b$.