Extended Euclidean Calculator

Enter two integers to find their GCD and Bezout coefficients (s, t) with a step-by-step extended Euclidean algorithm table.

Inputs

Step-by-Step Table

Enter values and click Calculate to see the steps.

How to read the table

  • Each row performs one division step: dividend = quotient × divisor + remainder.
  • The s and t columns are updated as: s_new = s_prev − quotient × s_curr (same for t).
  • The last non-zero remainder is the GCD. The s and t values in that row are the Bezout coefficients.
  • Highlighted row is the final step where the remainder reaches zero.

Summary

Enter two integers to find their GCD and Bezout coefficients (s, t) with a step-by-step extended Euclidean algorithm table.

How it works

  1. Enter two integers a and b in the input fields.
  2. Click Calculate to run the extended Euclidean algorithm.
  3. The step-by-step table shows each division, quotient, and coefficient update.
  4. Read the GCD and Bezout coefficients s, t from the final result row.
  5. Verify: a·s + b·t should equal the GCD shown.

Use cases

  • Find the modular inverse of a number (when gcd = 1, s is the inverse of a mod b).
  • Solve linear Diophantine equations of the form a·x + b·y = c.
  • Check whether two integers are coprime (GCD = 1).
  • Cryptography coursework — RSA key generation requires extended GCD.
  • Number theory homework — verify Bezout identity by hand.
  • Competitive programming — precompute modular inverses quickly.

Frequently Asked Questions

Last updated: 2026-06-13 · Reviewed by Nham Vu