Skip to content
← All questions

What is the Euclidean algorithm and how is it set up for two natural numbers?

The Euclidean algorithm is a method for finding the greatest common divisor (gcd) of two natural numbers. It is set up by repeatedly applying the division algorithm. Given aa and bb, you write a=bq1+r1a = bq_1 + r_1, then b=r1q2+r2b = r_1q_2 + r_2, and so on, until a remainder of 0 is reached. The last nonzero remainder is the gcd.

Conditions

  • The inputs aa and bb are natural numbers.
  • The division algorithm is used at each step.

Reasoning, step by step

  1. Start with two natural numbers aa and bb.
  2. Write the first division: a=bq1+r1a = bq_1 + r_1.
  3. Write the second division: b=r1q2+r2b = r_1q_2 + r_2.
  4. Continue the chain: r1=r2q3+r3r_1 = r_2q_3 + r_3, etc.
  5. Stop when rn−2=rn−1qn+0r_{n-2} = r_{n-1}q_n + 0.
  6. Conclude rn−1=gcd⁡(a,b)r_{n-1} = \gcd(a, b).

Example

The left board displays the general setup: a=bq1+r1a=bq_1+r_1, b=r1q2+r2b=r_1q_2+r_2, r1=r2q3+r3r_1=r_2q_3+r_3, ..., rn−2=rn−1qn+0r_{n-2}=r_{n-1}q_n+0, leading to rn−1=gcd⁡(a,b)r_{n-1}=\gcd(a,b).

Common misconceptions

  • Thinking the algorithm requires a specific order of aa and bb; usually a>ba > b is assumed for the first step, but the algorithm handles it naturally.
  • Confusing the Euclidean algorithm with the prime factorization method for finding gcd.

Watch the explanation

Connected concepts

Explore next

Related questions

Understand why

↗
Find a method

↗
Find a method

↗
Find a method

↗
Understand why

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.