theorem 31.2
If a and b are any integers,not both zero,then GCD(a,b) is the smallest positive element of the set {a*x+b*y} of linear combination of a and b.
Proof:
1.Let s be the smallest positive element in the set {ax+by},q=(int)a/s.
then a mod s=a-q*s=a-q*(a*x+b*y)=(a-q*a)*x-q*b*y.
that means a mod s also is a linear combination of the a and b.
Besides,a mod s<s and s is the smallest element in the set.
Therefore a mod s should be a nonpositive integer,but acutually a mod s>=0.
Thus,a mod s must be equal to zero.
so s|a.
By analogous reasoning,we could get s|b,then s|GCD(a,b).
2.On the other hand,GCD(a,b)|a and GCD(a,b)|b,
so GCD(a,b)|(a*x+b*y),then GCD(a,b)|s.
beacause GCD(a,b)|s and s|GCD(a,b),we could conclude that GCD(a,b) is equal to s.
I'ts a original edition ,I wish everyone wants to reproduce indicate the source.