Modular Multiplicative Inverse Calculator

Enter an integer (a) and a modulus (m) to find the modular multiplicative inverse — the number a⁻¹ such that a × a⁻¹ ≡ 1 (mod m). The calculator uses the Extended Euclidean Algorithm and tells you whether the inverse exists (it does only when gcd(a, m) = 1). You get the inverse value, the GCD, and a step-by-step verification.

The integer whose modular inverse you want to find.

The modulus m (must be ≥ 2). The inverse exists only if gcd(a, m) = 1.

Results

Modular Inverse (a⁻¹ mod m)

--

GCD(a, m)

--

Verification: (a × a⁻¹) mod m

--

Inverse Exists?

--

Results Table

Frequently Asked Questions

What is a modular multiplicative inverse?

The modular multiplicative inverse of an integer a modulo m is an integer b such that a × b ≡ 1 (mod m). In other words, when you multiply a by its inverse b and divide by m, the remainder is 1. It is often written as a⁻¹ mod m.

When does the modular inverse exist?

The modular multiplicative inverse of a modulo m exists if and only if gcd(a, m) = 1, meaning a and m are coprime (share no common factors other than 1). If gcd(a, m) > 1, no inverse exists for that pair.

How is the modular inverse calculated?

The most common method is the Extended Euclidean Algorithm. It finds integers x and y such that a·x + m·y = gcd(a, m). When gcd(a, m) = 1, the value of x (taken mod m) is the modular inverse of a.

What numbers have a multiplicative inverse modulo 10?

Only numbers coprime to 10 have an inverse modulo 10. These are 1, 3, 7, and 9, since they share no common factors with 10. Numbers like 2, 4, 5, 6, 8 do not have inverses modulo 10 because gcd > 1.

What is the difference between a multiplicative inverse and a modular multiplicative inverse?

The ordinary multiplicative inverse (reciprocal) of x is 1/x — a real number. The modular multiplicative inverse is an integer b such that a × b ≡ 1 (mod m). These are completely different concepts; the modular inverse is always an integer within the range [0, m−1].

How do I find the additive inverse modulo m?

The additive inverse of a modulo m is simply m − a (adjusted to be in [0, m−1]). For example, the additive inverse of 15 modulo 7 is 7 − (15 mod 7) = 7 − 1 = 6. This is different from the multiplicative inverse.

What is the purpose of the modular inverse in RSA encryption?

In RSA cryptography, the modular inverse is used to compute the private key exponent d such that e × d ≡ 1 (mod φ(n)), where e is the public exponent and φ(n) is Euler's totient. This inverse relationship is what allows RSA decryption to reverse encryption.

How can I quickly find the modular inverse of 2 modulo an odd number?

For any odd modulus m, the inverse of 2 is (m + 1) / 2. For example, the inverse of 2 modulo 7 is (7 + 1) / 2 = 4, since 2 × 4 = 8 ≡ 1 (mod 7). This shortcut only works because m is odd, ensuring gcd(2, m) = 1.

More Math Tools