Greatest Common Divisors
If a,b∈Z with a,b≠0, then the largest positive integer
which divides both a and b is the greatest common divisor
of two integers a and b. It is denoted gcd(a,b).
By convention, we define gcd(0,0)=0.
For some special case: gcd(0,x)=x, where x∈Z.
It's obvious because 0=0⋅x.
Bézout's Lemma
Let a,b∈Z with a,b≠0, then
there exist integers s and t such that as+bt=gcd(a,b).
That is, gcd(a,b) is a linear combination of a and b.
∃s,t∈Z:as+bt=gcd(a,b)
Proof
Consider the set
S=ax+by:x,y∈Z∩(N\{0})
or
S=ax+by:x,y∈Z and ax+by>0
S is definitely non-empty set.
Take x=a,y=b, then k=a⋅a+b⋅b>0
because a,b≠0. So, k∈S and S≠∅.
Since S is a nonempty subset of N,
{S≠∅}∩{S⊆N},
there is a least element by the Well-Ordering Principle,
which we denote by d.
Then there exist integers x0,y0 such that
d=a⋅x0+b⋅y0
, d is the minimal positive integer in S.
By Division Algorithm, we assume that
\begin{aligned}
a = q_a \cdot d + r_a \
\text{, where } q_a, r_a \in Z, q_a \text{ is the quotient and } 0 \leq r_a < d
\end{aligned}
and
\begin{aligned}
b = q_b \cdot d + r_b \
\text{, where } q_b, r_b \in Z, q_b \text{ is the quotient and } 0 \leq r_b < d
\end{aligned}
From above, we can get:
ra=a−qa⋅d=a−qa⋅(a⋅x0+b⋅y0)=a(1−qa⋅x0)+b(−qa⋅y0)
Thus, ra is a linear combination of a and b.
If ra>0, then ra∈S, and since ra<d,
it means that there is a element ra in S smaller than d.
We have a contradiction that d is NOT the least element of S.
Thus, ra must be 0, and it means that a=qa⋅d, so qa∣a.
In same manner, we can know b=qb⋅d and qb∣b.
Therefore, d is a common divisor of a and b.
Next, we will show d is the greatest common divisor of a and b.
Let c is another positive common divisor of a and b,
c∣a and c∣b.
Then,
d=a⋅x0+b⋅y0=c⋅m⋅x0+c⋅n⋅y0=c⋅(m⋅x0+n⋅y0)=c⋅z, where m=ca,n=cb and z is a positive integer(because c,d>0)
Thus, we can know c∣d and c≤d.
In summary,
- d is a common divisor of a and b
- Every positive common divisor of a and b, c,
can divide d.
Therefore,
d=gcd(a,b)
Finally, we prove that:
there exist integers s,t such that d=as+bt=gcd(a,b).
References
https://www.math.byu.edu/~bakker/M290/Lectures/Lec30.pdf
https://math.berkeley.edu/~sagrawal/su14_math55/notes_gcd.pdf