Skip to content
← All questions

What is the invariant common divisor property used in the Euclidean algorithm?

The invariant property is that the set of common divisors of two numbers aa and bb is identical to the set of common divisors of aa and b−ab-a (or bb and a mod ba \bmod b). This ensures that the greatest common divisor (gcd) remains unchanged throughout the algorithm's steps.

Conditions

  • aa and bb are integers.
  • The operation is either subtraction (b−ab-a) or modulo (a mod ba \bmod b).

Reasoning, step by step

  1. Define the set of common divisors D(a,b)={d:d∣a and d∣b}D(a,b) = \{d : d|a \text{ and } d|b\}.
  2. Show that d∈D(a,b)d \in D(a,b) if and only if d∈D(a,b−a)d \in D(a, b-a).
  3. Conclude that gcd⁡(a,b)=gcd⁡(a,b−a)\gcd(a,b) = \gcd(a, b-a).
  4. Extend this to the division step: gcd⁡(a,b)=gcd⁡(b,a mod b)\gcd(a,b) = \gcd(b, a \bmod b).
  5. This equality is the invariant that allows the algorithm to reduce the problem size without changing the solution.

Example

The script states: 'An integer divides both a and b exactly when it divides both a and b−ab-a. Consequently the sets of common divisors, and hence the gcd, stay the same.'

Common misconceptions

  • Thinking that the invariant refers to the numbers themselves staying constant.
  • Believing that only the gcd stays constant, but other common divisors might change.
  • Confusing the invariant with the termination condition.

Watch the explanation

Connected concepts

Explore next

Related questions

Understand why

↗
Find a method

↗
Find a method

↗
Know when to use it

↗

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