Extended Euclidean Algorithm Calculator
Compute gcd(a,b) and Bézout coefficients x, y such that a·x + b·y = gcd(a,b). Solves linear Diophantine equations, finds modular inverses, and shows step-by-step division tableau.
gcd(a, b)
—
Bézout: a·x + b·y = gcd —
Steps (quotients) —
Extended More scenarios, charts & detailed breakdown ▾
gcd(a, b)
—
x (coefficient of a) —
y (coefficient of b) —
Verify: a·x + b·y —
Professional Full parameters & maximum detail ▾
Result
gcd(a, b) —
Bézout Identity —
Details
Division steps —
Complexity —
Historical Note —
How to Use This Calculator
- Enter integers a and b. The gcd and Bézout coefficients appear instantly.
- Use Find Mod Inverse tab when you need a⁻¹ mod m.
- Use Linear Diophantine tab to solve ax + by = c.
- Use Professional for step-by-step division tableau and complexity analysis.
Formula
a·x + b·y = gcd(a, b) — Bézout's Identity
Algorithm: iterative back-substitution through Euclidean divisions.
Example
gcd(35,15): 35=2×15+5 → 15=3×5+0. gcd=5. Back-substitution: 5=35−2×15, so x=1, y=−2. Check: 35×1+15×(−2)=5 ✓
Frequently Asked Questions
- It extends the basic Euclidean algorithm to find integers x and y satisfying a·x + b·y = gcd(a,b) (Bézout's identity). These coefficients are used to compute modular inverses.
- If gcd(a,m)=1, then a·x + m·y = 1 means a·x ≡ 1 (mod m), so x is the modular inverse of a. This is the foundation of RSA key generation.
- The linear Diophantine equation ax+by=c is solvable in integers if and only if gcd(a,b) divides c. The Extended Euclidean algorithm finds the particular solution.
- O(log min(a,b)) division steps — exponentially faster than trial methods. For 1000-digit numbers it needs only ~3000 steps.
- The basic form appears in Euclid's Elements (≈300 BC). The extended form giving Bézout coefficients was studied by Bachet de Méziriac in 1624 and formalized by Euler and Gauss.
Related Calculators
Sources & References (5) ▾
- Euclid's Elements Book VII — Propositions 1-2 — Clark University Digital Edition
- An Introduction to the Theory of Numbers — Hardy & Wright — Oxford University Press
- Concrete Mathematics — Graham, Knuth & Patashnik — Addison-Wesley
- Extended Euclidean Algorithm — Wolfram MathWorld — Wolfram Research
- MIT OCW 6.006 — Introduction to Algorithms — MIT OpenCourseWare