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

Proof of the Euclidean algorithm

#Euclidean algorithm#gcd invariance#proof

Statement

Show that if a=bq+ra=bq+r, then gcd⁡(a,b)=gcd⁡(b,r)\gcd(a,b)=\gcd(b,r).

Hint

Show that both pairs have the same set of common divisors.

Show solutionHide solution

Solution

Common divisors. If d∣ad\mid a and d∣bd\mid b, then d∣a−bq=rd\mid a-bq=r. Conversely, if d∣bd\mid b and d∣rd\mid r, then d∣bq+r=ad\mid bq+r=a.

Conclusion. Both pairs have the same common divisors, hence the same greatest one. The Euclidean algorithm terminates because remainders strictly decrease, and stops at the last nonzero remainder, which is the gcd.