Skip to content
Gioi Toan
Start learning
A thick book and a smiling magnifying glass

What is Euclidean algorithm?

Short answer

The Euclidean algorithm is a way to find the greatest common divisor of two numbers by dividing repeatedly and taking the remainder.

Type
Definition
First learned
Grade 6
Also called
thuật toán Ơ-clít, thuật toán Euclide, thuat toan euclid
In English
Euclidean algorithm, Euclid's algorithm

Formulas

ƯCLN(a,b)=ƯCLN(b,r)với r laˋ soˆˊ dư khi chia a cho b\text{ƯCLN}(a, b) = \text{ƯCLN}(b, r) \quad \text{với } r \text{ là số dư khi chia } a \text{ cho } b

Explanation

The Euclidean algorithm is used to find the greatest common divisor of two natural numbers. How it works: divide the larger number by the smaller one; if the remainder is not 0, take the divisor and divide it by the remainder, and keep going until the remainder is 0. The greatest common divisor is the divisor of the last division.

This algorithm is much faster than listing all the divisors. It is based on the property GCD(a,b)=GCD(b,r)\text{GCD}(a, b) = \text{GCD}(b, r), where rr is the remainder when dividing aa by bb.

You can use the Euclidean algorithm to simplify the fraction to a fraction in simplest form when the numerator and denominator are large numbers.

Examples

Example 1

Use the Euclidean algorithm to find GCD(48,18)\text{GCD}(48, 18).

See the solution to example 1

We have 48=18⋅2+1248 = 18 \cdot 2 + 12, 18=12⋅1+618 = 12 \cdot 1 + 6, 12=6⋅2+012 = 6 \cdot 2 + 0. So GCD(48,18)=6\text{GCD}(48, 18) = 6.

Common mix-ups

  • When dividing, you must take the old divisor and divide it by the new remainder, not divide the larger number by the remainder right from the start.
  • The algorithm stops when the remainder is 0; the greatest common divisor is the divisor in the last division, not the remainder 0.

Where the name comes from

The algorithm is named after the ancient Greek mathematician Euclid (around 300 BC), who recorded it in the book Elements.

Skills