Skip to content
← All questions

Why does the Euclidean algorithm terminate when repeatedly replacing the pair?

The Euclidean algorithm terminates because the remainder in each step is strictly smaller than the previous divisor. Since the second argument is a nonnegative integer that decreases with each step, it must eventually reach zero.

Conditions

  • The algorithm operates on nonnegative integers.
  • Each step replaces the pair (a,b)(a,b) with (b,a mod b)(b, a\bmod b).
  • The remainder a mod ba\bmod b is strictly less than bb when b>0b > 0.

Reasoning, step by step

  1. Observe that the new second argument is the remainder of the division.
  2. Note that the remainder is always smaller than the divisor.
  3. Recognize that a strictly decreasing sequence of nonnegative integers must reach zero.
  4. Conclude that the algorithm stops when the second argument becomes zero.

Example

The remainder is smaller than bb, which makes repeated steps terminate.

Common misconceptions

  • Thinking that the remainder could stay the same or increase in subsequent steps.
  • Believing that the algorithm could loop infinitely with positive integers.

Watch the explanation

Connected concepts

Explore next

Related questions

Meet the concept

↗
Find a method

↗
Meet the concept

↗
Find a method

↗
Find a method

↗

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