You are here
Home ›Euclid's algorithm
Primary tabs
Euclid’s algorithm
Euclid’s algorithm describes a procedure for finding the greatest common divisor of two integers.
Suppose , and without loss of generality, , because if , then , and if , then . Put .
By the division algorithm for integers, we may find integers and such that where .
Notice that , because and , so and if and had a common divisor larger than , then would also be a common divisor of and , contradicting ’s maximality. Thus, .
So we may repeat the division, this time with and . Proceeding recursively, we obtain
Thus we obtain a decreasing sequence of nonnegative integers , which must eventually reach zero, that is to say, for some , and the algorithm terminates. We may easily generalize the previous argument to show that for , where . Therefore,
More colloquially, the greatest common divisor is the last nonzero remainder in the algorithm.
The algorithm provides a bit more than this. It also yields a way to express the as a linear combination of and , a fact obscurely known as Bezout’s lemma. For we have that
so substituting each remainder into the next equation we obtain
Sometimes, especially for manual computations, it is preferable to write all the algorithm in a tabular format. As an example, let us apply the algorithm to and . The following table details the procedure. The variables at the top of each column (without subscripts) have the same meaning as above. That is to say, is used for the sequence of remainders and for the corresponding sequence of quotients. The entries in the and columns are obtained by multiplying the current values for and by the in this row, and subtracting the results from the and in the previous row.
Thus, and .
Euclid’s algorithm was first described in his classic work Elements (see propositions VII 1 and VII 2), which also contained procedures for geometrical constructions. These are the first known formally described algorithms. Prior to this, informally defined algorithms were in common use to perform various computations, but Elements contained the first attempt to rigorously describe a procedure and explain why its results are admissible. Euclid’s algorithm for greatest common divisor is still commonly used today; since Elements was published in the fourth century BC, this algorithm has been in use for nearly 2400 years!
Mathematics Subject Classification
11A05 Multiplicative structure; Euclidean algorithm; greatest common divisors- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)
- Other useful stuff
Recent Activity
new question: Taylor's Series Query! by Bruce Lee
new question: Laplace transform by J
new question: Residue Calculus by J
May 19
new Education: Project: PlanetMath Outlines Series by unlord
May 17
new image: sinx_approx.png by jeremyboden
new image: approximation_to_sinx by jeremyboden
new image: approximation_to_sinx by jeremyboden
new question: Solving the word problem for isomorphic groups by unlord
new image: LineDiagrams.jpg by m759
new image: ProjPoints.jpg by m759
Attached Articles
Corrections
Very important generalization. by drini ✓
broken by yark ✓
exact reference by rspuzio ✓
Spelling by rm50 ✓



Comments
Oops. I feel a bit like a thief
I think it was a rash decision of mine to adopt this object. My approach to the Euclidean algorithm would be entirely different, so I would completely rewrite this entry, proving its O(log n) complexity and accepting Logan's suggestion of showing why consecutive Fibonacci numbers are the worst case. I don't know when I'll do this, probably within the next two days.