Maths WorkshopMaths problems with full solutions
Exercise 917Number theory › Divisibility and gcdHigh schoolAdded 3 Nov 2026

GCD as a linear combination

#gcd#linear combination#Bézout

Statement

Show that gcd⁡(a,b)\gcd(a,b) is the smallest positive integer of the form au+bvau+bv with u,v∈Zu,v\in\mathbb{Z}.

Hint

Let d=gcd⁡(a,b)d=\gcd(a,b) and mm the smallest positive au+bvau+bv. Show m∣am\mid a and m∣bm\mid b, then m≤dm\le d; and d∣md\mid m, so d≤md\le m.

Show solutionHide solution

Solution

Setup. Let m=min⁡{au+bv>0:u,v∈Z}m=\min\{au+bv>0:u,v\in\mathbb{Z}\}, achieved at (u0,v0)(u_0,v_0).

m∣am\mid a. Euclidean division: a=qm+ra=qm+r with 0≤r<m0\le r<m. Then r=a−qm=a−q(au0+bv0)=a(1−qu0)+b(−qv0)r=a-qm=a-q(au_0+bv_0)=a(1-qu_0)+b(-qv_0) is a positive combination if r>0r>0, contradicting minimality. So r=0r=0.

m∣bm\mid b. Same argument.

Conclusion. mm is a common divisor, so m≤dm\le d. Conversely, d∣ad\mid a and d∣bd\mid b imply d∣md\mid m, so d≤md\le m. Hence m=dm=d.