Skip to content
← All questions

How is the subtraction-based algorithm derived from the gcd recurrence formula?

The subtraction-based algorithm is derived by setting the parameter k to 1 in the general recurrence formula. Substituting k=1k=1 into gcd(a,b)=gcd(b,a−k⋅ba-k\cdot b) yields gcd(a,b)=gcd(b,a-b), which replaces the first argument with the difference of the two numbers.

Conditions

  • The general recurrence formula holds.
  • k is set to 1.

Reasoning, step by step

  1. Start with the general formula gcd(a,b)=gcd(b,a−k⋅ba-k\cdot b).
  2. Substitute k=1k=1 into the equation.
  3. Simplify the term a−k⋅ba-k\cdot b to a-b.
  4. Obtain the subtraction-based algorithm: gcd(a,b)=gcd(b,a-b).

Example

The video states: "Let k=1k=1, to get the Subtraction Method: gcd(a,b)=gcd(b,a-b)."

Common misconceptions

  • Thinking that the subtraction method requires a>ba > b; the formula holds for any integers, though practical implementations may swap them.
  • Confusing the subtraction method with the Euclidean algorithm; they are different special cases of the same general formula.

Watch the explanation

Connected concepts

Explore next

Related questions

Meet the concept

↗
Find a method

↗
Find a method

↗
Find a method

↗
Meet the concept

↗

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