Exercise · ZW-EXTENDED-EUCLIDEAN-ALGORITHM-009 · ★★☆ Intermediate

If the extended algorithm gives \(s_k\) and \(t_k\) with \(r_k=as_k+bt_k\), what must hold at the end of the process?

Choose one option.

Show answer
  • D. That the last nonzero remainder \(r_k\) equals \(\gcd(a,b)\) together with its coefficients

Explanation

The invariant holds at every step, and at the end the last nonzero remainder is the greatest common divisor with its associated coefficients. Taking a zero remainder as the result is a common mistake.

Study Elementary number theory in ZWMath →

Review the concept: Extended Euclidean algorithm

The extended Euclidean algorithm computes \(d=\gcd(a,b)\) and integers \(x\), \(y\) such that \(ax+by=d\). It is the Euclidean algorithm that also tracks the Bézout coefficients.

\[r_k=r_{k-2}-q_{k-1}r_{k-1}\\s_k=s_{k-2}-q_{k-1}s_{k-1}\\t_k=t_{k-2}-q_{k-1}t_{k-1}\]

More practice problems: extended euclidean algorithm

← ZW-EXTENDED-EUCLIDEAN-ALGORITHM-008 ZW-EXTENDED-EUCLIDEAN-ALGORITHM-010 →