Compute a⁻¹ mod m (modular inverse) using the Extended Euclidean Algorithm, or find the reciprocal 1/a for any non‑zero real number. Get step‑by‑step algorithm details, applications in cryptography, and academic references.
Find integer x such that a·x ≡ 1 (mod m). Requires gcd(a, m) = 1. Used in RSA, affine ciphers, and solving congruences.
Compute the multiplicative inverse in the real numbers: 1/a for any non‑zero real a.
In mathematics, the multiplicative inverse of a number a is another number that, when multiplied by a, yields the identity element 1. In real numbers, this is simply 1/a. In modular arithmetic, the modular inverse a⁻¹ (mod m) satisfies a · a⁻¹ ≡ 1 (mod m). It exists only when gcd(a, m) = 1. The Extended Euclidean Algorithm is the classical method to compute such inverses efficiently — a cornerstone of modern cryptography.
Our calculator implements the Extended Euclidean Algorithm (EEA) which not only finds the greatest common divisor but also the coefficients (Bezout coefficients). For a = 17, m = 3120, the algorithm traces divisions until remainder 1 is reached, then back‑substitutes to retrieve the inverse. The modular inverse is then reduced to the range [0, m-1].
| Context | Definition | Existence condition | Example |
|---|---|---|---|
| Real numbers | 1/a (reciprocal) | a ≠ 0 | 5⁻¹ = 0.2 |
| Modular arithmetic | a⁻¹ (mod m) | gcd(a, m) = 1 | 3⁻¹ mod 11 = 4 because 3×4=12≡1 |
| Matrix algebra | Inverse of matrix | det ≠ 0 | — |
In RSA, choose two primes p = 61, q = 53 → n = 3233, φ(n) = 3120. Select e = 17 (coprime with φ(n)). The private exponent d = e⁻¹ mod φ(n) = 17⁻¹ mod 3120 = 2753. Indeed, 17 × 2753 = 46801 ≡ 1 (mod 3120). This d unlocks encrypted messages. Our calculator reproduces exactly this core step for any coprime pair.