<<

Euclidean

In , the (also called 's algorithm) is an efficient method for computing the greatest common (GCD), also known as the greatest common factor (GCF) or highest common factor (HCF). It is named after the Greek mathematician Euclid, who described it in Books VII and X of his Elements.[1]

The GCD of two numbers is the largest number that divides both of them without leaving a . The Euclidean algorithm is based on the principle that the of two numbers does not change if the smaller number is subtracted from the larger number. For example, 21 is the GCD of 252 and 105 (252 = 21 × 12; 105 = 21 × 5); since 252 − 105 = 147, the GCD of 147 and 105 is also 21. Since the larger of the two numbers is reduced, repeating this process gives successively smaller numbers until one of them is zero. When that occurs, the GCD is the remaining nonzero number. By reversing the steps in the Euclidean algorithm, the GCD can be expressed as a sum of the two original numbers each multiplied by a positive or negative integer, e.g., 21 = [5 × 105] + [(−2) × 252]. This important property is known as Bézout's identity.

The earliest surviving description of the Euclidean algorithm is in Euclid's Elements (c. 300 BC), making it one of the oldest numerical still in common use. The original algorithm was described only for natural numbers and geometric lengths (real numbers), but the algorithm was generalized in the 19th century to other types of numbers, such as Gaussian integers and in one variable. This led to modern abstract algebraic notions such as Euclidean domains. The Euclidean algorithm has been generalized further to other mathematical structures, such as knots and multivariate polynomials.

The Euclidean algorithm has many theoretical and practical applications. It may be used to generate almost all the most important traditional musical rhythms used in different cultures throughout the world. It is a key element of the RSA algorithm, a public-key encryption method widely used in electronic commerce. It is used to solve Diophantine equations, such as finding numbers that satisfy multiple congruences (Chinese remainder theorem) or multiplicative inverses of a finite field. The Euclidean algorithm can also be used in constructing continued , in the Sturm chain method for finding real roots of a , and in several modern integer algorithms. Finally, it is a basic tool for proving theorems in modern , such as Lagrange's four- theorem and the fundamental theorem of (unique factorization).

If implemented using of long rather than subtractions, Euclid's algorithm computes the GCD of large numbers efficiently: it never requires more division steps than five times the number of digits (base 10) of the smaller integer. This was proved by Gabriel Lamé in 1844, and marks the beginning of computational complexity theory. Methods for improving the algorithm's efficiency were developed in the 20th century.

1 Concrete example

Suppose it is desired to find gcd(1989, 867), i.e. the greatest common divisor of 1989 and 867.

If we reduce the larger number by subtracting the smaller one from it, the gcd does not change:

So subtract again:

Now 867 is no longer the smaller number. Continuing in the same way, we reduce the larger number, now 867, by subtracting the smaller one from it, leaving the gcd unchanged:

The first number, 255, is still the smaller one, so again we use it to reduce the larger one:

Now 255 is the larger number and we reduce it by subtracting 102 from it:

Now 102 is the larger one and we reduce it by subtracting 51 from it:

Now we are done: we conclude that gcd(1989,867) = 51. Thus we must have

By division, we get

2 When one repeatedly reduces the larger number by subtracting the smaller one from it, thus:

then the smallest number at the end, 255, is the remainder that results from dividing 1989 by 867. Thus the algorithm is often described as follows:

• Given the problem of finding gcd(1989,867), one replaces the larger number, 1989, by the remainder that results from dividing it by the smaller number, 867, getting

• Next one replaces the larger number, 867, by the remainder that results from dividing it by the now-smaller number, 255, getting

• Next one replaces the larger number, 255, by the remainder that results from dividing it by the now-smaller number, 102, getting

• Next one replaces the larger number, 102, by the remainder that results from dividing it by the now-smaller number, 51, getting

• When 0 appears, we are done; the gcd is 51.

******************* ************

3