Nepedia
Back to Discover
Advanced Reader
🔢

Euclidean algorithm

math Maturity 7-9 Next article →

The Euclidean algorithm is a highly efficient method for calculating the greatest common divisor (GCD) of two integers. The GCD is the largest natural number that can divide both numbers without leaving a remainder. In mathematics, this value is also called the greatest common factor (GCF) or the highest common factor (HCF). When two numbers have no common factors other than one, they are described as being coprime or relatively prime.

24x60
24x60

To understand how this works, imagine a large rectangle with side lengths $a$ and $b$. You can attempt to fill this entire area with identical square tiles. A common divisor is any side length of a square that can perfectly cover the rectangle without gaps or overlaps. The GCD represents the side length of the largest possible square that can tile the rectangle.

Euclid's algorithm Book VII Proposition 2 3
Euclid's algorithm Book VII Proposition 2 3

The core mechanism of the algorithm relies on a specific principle of division. This principle states that the GCD of two numbers does not change if you replace the larger number with the difference between the two. For example, the GCD of 49 and 21 is the same as the GCD of 28 and 21. By repeatedly subtracting the smaller number from the larger one, you create a sequence of smaller and smaller pairs. This process eventually results in two equal numbers, which is the GCD.

Euclidean algorithm 1071 462
Euclidean algorithm 1071 462

While subtraction works, a more efficient version uses the remainder from division. Instead of subtracting many times, you divide the larger number by the smaller number to find the remainder. You then replace the larger number with this remainder and repeat the process. This version is much faster because it shortcuts many subtraction steps. The algorithm terminates when the remainder reaches zero. The last non-zero remainder in the sequence is the GCD.

This efficient method was analyzed deeply by Gabriel Lamé in 1844. He proved a significant result known as Lamé's Theorem. He showed that the number of steps required is never more than five times the number of digits in the smaller integer. This proof was a landmark event because it marked the beginning of computational complexity theory. This field studies how much time or effort is needed to solve specific mathematical problems.

Euclidean Algorithm Running Time
Euclidean Algorithm Running Time

The algorithm is named after the ancient Greek mathematician Euclid. He first described this method in his influential work, *Elements*. It is recognized as one of the oldest algorithms still in common use today. While Euclid originally described it for natural numbers and geometric lengths, the method was generalized in the 19th century. It can now be applied to other mathematical structures, such as polynomials of one variable and Gaussian integers. These applications lead to modern concepts like Euclidean domains in abstract algebra.

Beyond simple arithmetic, the Euclidean algorithm has vital practical applications. It is used to reduce fractions to their simplest possible form. It also plays a critical role in performing division within modular arithmetic. In the modern world, these computations are essential for cryptographic protocols. These protocols secure internet communications by protecting data from unauthorized access. The algorithm is also used to solve Diophantine equations and to find accurate rational approximations for real numbers.

Diophante Bezout
Diophante Bezout

Finally, the algorithm serves as a fundamental tool for proving deep theorems in number theory. It is used in proofs regarding Lagrange's four-square theorem and the uniqueness of prime factorizations. By using the extended Euclidean algorithm, one can express the GCD as a linear combination of the two original numbers. This specific relationship is known as Bézout's identity. This identity shows that the GCD can be written as the sum of the two numbers, each multiplied by an integer.

SternBrocotTree
SternBrocotTree
604 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (9)
File:Euclid's algorithm Book VII Proposition 2 3.svg
Euclid's algorithm Book VII Proposition 2 3.svg
File:24x60.svg
24x60.svg
File:Euclidean algorithm 1071 462.gif
Euclidean algorithm 1071 462.gif
File:Euklid.jpg
Euklid.jpg
File:Diophante Bezout.svg
Diophante Bezout.svg
File:SternBrocotTree.svg
SternBrocotTree.svg
File:Euclidean Algorithm Running Time.svg
Euclidean Algorithm Running Time.svg
File:Gaussian primes.svg
Gaussian primes.svg
File:Eisenstein primes.svg
Eisenstein primes.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.