Modular Inverse and Extended Euclidean Calculator
Find gcd, Bézout coefficients, and modular inverse using the extended Euclidean algorithm.
Calculate
What this calculator teaches
The extended Euclidean algorithm finds integers x and y such that ax + my = gcd(a,m). When gcd(a,m)=1, x is the modular inverse of a modulo m.
This is essential for modular arithmetic, RSA cryptography, coding theory, and competitive programming.
Formula & Symbols
| Concept | Formula | Meaning |
|---|---|---|
| Bézout identity | ax + my = gcd(a,m) | Extended Euclidean result. |
| Modular inverse | a^{-1} mod m | A number x such that ax ≡ 1 (mod m). |
| Existence condition | gcd(a,m)=1 | Inverse exists only when a and m are coprime. |
Step-by-Step Examples
- Use Euclidean algorithm to find gcd(17,43).
- Because gcd=1, an inverse exists.
- Extended steps give 17·38 + 43·(-15)=1.
Where students use this
Common Mistakes to Avoid
A modular inverse exists only when gcd(a,m)=1.
If x is negative, add m until it is between 0 and m−1.
Division modulo m means multiplying by a modular inverse, when it exists.
Frequently Asked Questions
Related Math Calculators
Formula Explorer connections
Interpretation: This formula uses integer divisibility, modular arithmetic, finite fields or coding relationships. Assumption: Inputs are usually integers with specific modulus or coprimality requirements. Cryptographic examples are educational and not a substitute for vetted security libraries.