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 = \set {x \in \Z, x > 0: x = m a + n b: m, n \in \Z}$

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

We have:

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

Therefore $S \ne \O$.

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

In particular:


 * $d \divides \size a = 1 \times a + 0 \times b$


 * $d \divides \size b = 0 \times a + 1 \times b$

Thus:
 * $d \divides a \land d \divides b \implies 1 \le d \le \gcd \set {a, b}$

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

Since $d$ is the smallest number in $S$:
 * $\gcd \set {a, b} = d = u a + v b$