Multiplicative Inverse Modulo Calculator

Find x such that ax ≡ 1 (mod m) with full Extended Euclidean Algorithm steps, Euler theorem method, brute-force verification, Bézout identity, and all inverse pairs table.

a mod m
3
3 reduced mod 7
GCD(a, m)
1
Coprime ✓ — inverse exists
Multiplicative Inverse
5
3 × 5 ≡ 1 (mod 7)
Euler Totient φ(m)
6
Invertible elements in ℤ/7ℤ
Euler Method
5
3^(6-1) mod 7
Brute Force Check
5
Scanned x = 0…6

Extended Euclidean Algorithm — Step by Step

Steprs (Bézout)t (Bézout)q
0310
17010
23102
31-213

GCD = 1. Bézout identity: 3 × (-2) + 7 × (1) = 1. → Inverse = -2 mod 7 = 5

General Solution: x ≡ 5 (mod 7)

512192633

Invertibility Ratio

6 of 6 integers in 1…6 are invertible (100.0%)

All Inverse Pairs mod 7

aa⁻¹a × a⁻¹ mod 7Self-inverse?
111
241
351
421
531
661
Planning notes, formulas, and examples

About the Multiplicative Inverse Modulo Calculator

The **Multiplicative Inverse Modulo Calculator** finds the integer x satisfying ax ≡ 1 (mod m) — the modular multiplicative inverse of a modulo m. This relationship is fundamental in number theory, cryptography (RSA key generation, Diffie–Hellman), and computer science (hash functions, error correction). An inverse exists exactly when GCD(a, m) = 1.

Three independent methods confirm the answer. The **Extended Euclidean Algorithm** (EEA) computes Bézout coefficients s, t such that a·s + m·t = GCD(a, m); when GCD = 1, s mod m is the inverse. The **Euler's theorem** approach derives a^(φ(m)−1) mod m. A **brute-force scan** checks every x from 0 to m − 1 as an independent verification. Each step of the EEA is presented in a detailed table showing quotients, remainders, and running Bézout coefficients so students can follow the algorithm by hand.

Beyond the single-answer computation, the calculator lists every inverse pair in ℤ/mℤ, highlights self-inverse elements, shows the general solution family x ≡ inv + k·m, and displays a bar indicating what fraction of elements are invertible — which equals φ(m)/(m − 1). Presets cover common textbook moduli (7, 11, 13, 26, 43) so you can compare standard cases without retyping the inputs.

When This Page Helps

Computing modular inverses manually through the Extended Euclidean Algorithm is easy to derail once the quotient-remainder chain gets long. This calculator keeps every intermediate step visible, so you can learn or verify the method without losing the structure of the algorithm.

It also offers three cross-checking methods. If EEA, Euler, and brute-force all agree, you can be confident the answer is correct — useful when debugging cryptographic code or verifying hand computations before an exam.

How to Use the Inputs

  1. Enter the value a whose inverse you seek.
  2. Enter the modulus m (must be > 1).
  3. Select a display method: EEA, Euler, or Brute Force.
  4. Read the Multiplicative Inverse card — or see why none exists.
  5. Examine the EEA step table to trace the algorithm.
  6. Optionally enter a candidate in the Verify field for independent confirmation.
  7. Toggle "Show all inverse pairs" to see the full table for ℤ/mℤ.
Formula used
Extended Euclidean: a·s + m·t = GCD(a,m); if GCD = 1 then x = s mod m. Euler: x = a^(φ(m)−1) mod m. Brute force: scan x ∈ [0, m) until a·x mod m = 1.

Example Calculation

Result: x = 5 (since 3 × 5 = 15 ≡ 1 mod 7)

GCD(3, 7) = 1, so the inverse exists. The EEA yields Bézout coefficient s = 5, and indeed 3 × 5 mod 7 = 1. Euler confirms: 3^(6−1) mod 7 = 3^5 mod 7 = 243 mod 7 = 5.

Tips & Best Practices

  • If GCD ≠ 1, the equation has no solution — try a different a or m.
  • For prime m, every integer 1 ≤ a < m has an inverse.
  • Check the Bézout identity line beneath the EEA table to verify the computation.
  • Self-inverse elements (a = a⁻¹) are marked in the pairs table.
  • Use the verification field to confirm answers you computed by hand.
  • The invertibility ratio bar shows φ(m)/(m−1), which equals 100% for prime m.

The Extended Euclidean Algorithm in Detail

The standard Euclidean Algorithm finds GCD(a, m) by repeated division. The extended version tracks two auxiliary sequences (s and t) that express each intermediate remainder as a linear combination of the original inputs: r_i = a·s_i + m·t_i. When the algorithm terminates with GCD = 1, the coefficient s gives us a·s ≡ 1 (mod m), so s mod m is the modular inverse.

Connection to RSA Cryptography

In RSA, the public exponent e and the secret exponent d satisfy e·d ≡ 1 (mod λ(n)), where λ is the Carmichael function of the RSA modulus n. Computing d is precisely the modular-inverse problem this calculator solves. Any error in that computation would generate an invalid private key, which is why independent cross-checks (EEA vs Euler vs brute-force) are standard practice in crypto libraries.

Self-Inverse Elements and Involutions

An element a is *self-inverse* (also called an involution) if a² ≡ 1 (mod m). For prime m, the only self-inverse elements are 1 and m − 1, by Lagrange's theorem applied to the polynomial x² − 1. For composite m, additional self-inverse elements may exist, and their number relates to the factorization of m.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • It means that a times x leaves remainder 1 when divided by m. Equivalently, a·x − 1 is divisible by m.