Skip to content
← All questions

Why does letting k=floor(a/ba/b) yield the Euclidean algorithm?

Letting k equal the floor of a divided by b transforms the term a−k⋅ba-k\cdot b into the remainder of a divided by b. Since a mod b=ab = a - floor(a/ba/b)·b, substituting this into the recurrence formula gcd(a,b)=gcd(b,a−k⋅ba-k\cdot b) results in gcd(a,b)=gcd(b,a mod b), which is the Euclidean algorithm.

Conditions

  • k is set to floor(a/ba/b).
  • b is not zero (implied by the division operation, though not explicitly stated in the video).

Reasoning, step by step

  1. Start with the general formula gcd(a,b)=gcd(b,a−k⋅ba-k\cdot b).
  2. Set k = floor(a/ba/b).
  3. Recognize that a - floor(a/ba/b)·b is the definition of a mod b.
  4. Substitute a mod b into the formula to get gcd(a,b)=gcd(b,a mod b).

Example

The video explains: "Let k=floor(a/ba/b), to get the Euclidean Algorithm: gcd(a,b)=gcd(b,a mod b)."

Common misconceptions

  • Believing that floor(a/ba/b) is the remainder; it is the quotient.
  • Thinking that the Euclidean algorithm works when b=0b=0; the division by b is undefined in that case.

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.