Skip to main content
\( \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section2.3The Euclidean Algorithm

The Euclidean algorithm says that to find the gcd of \(a\) and \(b\), you do the division algorithm until you get zero as the remainder, each time replacing the old division by the new remainder, and the old number by the old division number. The last non-zero remainder is the gcd.

We'll state and prove this momentarily (Algorithm 2.3.2). Let's try it with a reasonably sized problem, \(a=60\) and \(b=42\). \begin{align*} 60&=42\cdot 1+18\\ 42&=18\cdot 2+6\\ 18&=6\cdot 3+0 \end{align*} So \(\gcd(60,42)=6\).

This procedure is named after Euclid because of this proposition in Euclid's Elements. There is an amazing complete Java interactive implementation of all the propositions, by David Joyce; his version of this proposition includes some explanation of what Euclid assumes in doing this. In particular, Euclid basically assumes the Well-Ordering Principle, although of course he didn't think of it in such anachronistic terms.

Remark2.3.1

Euclid, a mathematician in Alexandria during the Hellenistic era, appears to have written the Elements as a compendium of rigorous mathematical knowledge. In addition to being the main geometry textbook in the Western and Islamic worlds for two millennia (as late a teacher as Charles Dodgson a.k.a. Lewis Carroll was extolling its virtues in print), there are substantial number-theoretic portions as well. No one really knows how much of the Elements is original to Euclid, but the work as a whole is monumental and well-organized, despite some well-known criticisms.

Try the algorithm on your own by hand for the gcd of 280 and 126. Or, for even more practice, try it with \(\gcd(2013,1066)\) and then check your work with Sage.

As you might expect, the proof makes more sense if you try it out with actual numbers; for the theoretical view, see Exercise 2.5.14. Especially if you can find \(a\) and \(b\) for which the algorithm takes four or five steps, you will gain some insight.