Given two positive integers a and b, there exist integers n and m such that an+bm = gcd(a,b)Theorem (Bézout):
Proof: Let S be the set of all (strictly) positive an+bm, and let s = an'+bm' be the least element of S. You will see that s is the gcd of a and b.
After all, you already know that gcd(a,b) has to divide s; s is an integer combination of a and b and all such are divisible by gcd(a,b). You just need to see that s divides gcd(a,b)
To that end, divide a by s giving a quotient q and a remainder r. This means a = qs + r with r a positive integer less than s.
Rearranging, you see that r = a-qs is itself an integer combination of a and b,
and it is less than s.
Since you know that s is already the least strictly positive such combination, r must be 0
and you now have that a = qs, i.e., s divides a.
The same argument shows that s divides b, and thus s divides gcd(a,b), which was all you needed, QED
Conclusion: halfway between a math proof and a recipe for how to make a pie