Modular Inverse Calculator

Solve inverses using Euclid steps and residue checks. See proofs, examples, and downloadable reports instantly. Built for students, coders, teachers, and number theory practice.

Calculator Input

Any integer is allowed, including negatives.
Use an integer greater than 1.
Shown in exported result files.
Changes display only, not validity.
Useful for proofs and assignments.

Formula Used

a × x ≡ 1 (mod m)
An inverse exists only when gcd(a, m) = 1
Extended Euclidean Algorithm finds x and y such that: a × x + m × y = gcd(a, m)
If gcd(a, m) = 1, then x mod m is the modular inverse

The calculator first reduces a into its least positive residue modulo m. It then applies the Extended Euclidean Algorithm to compute coefficients that satisfy Bezout’s identity.

When the gcd equals 1, the coefficient attached to a becomes the inverse after normalization into the interval 0 to m - 1.

How to Use This Calculator

  1. Enter the integer a whose inverse you want.
  2. Enter the modulus m. It must be greater than 1.
  3. Optionally add a report label for CSV and PDF exports.
  4. Choose how the residue should be displayed.
  5. Enable detailed tables or verification if needed.
  6. Press Calculate Modular Inverse.
  7. Read the gcd result first. If it is not 1, no inverse exists.
  8. Use the export buttons to save the summary and step table.

Example Data Table

a m gcd(a, m) Inverse Check
3 11 1 4 3 × 4 ≡ 1 (mod 11)
17 43 1 38 17 × 38 ≡ 1 (mod 43)
12 29 1 17 12 × 17 ≡ 1 (mod 29)
-7 26 1 11 -7 × 11 ≡ 1 (mod 26)
14 35 7 None Inverse does not exist

FAQs

1) What is a modular inverse?

A modular inverse is a number that multiplies with a to give a remainder of 1 under modulus m. It solves a × x ≡ 1 (mod m).

2) When does a modular inverse exist?

It exists only when a and m are coprime. That means gcd(a, m) = 1. If the gcd is larger than 1, no modular inverse exists.

3) Why is the Extended Euclidean Algorithm used?

It efficiently finds integers x and y such that a × x + m × y = gcd(a, m). When the gcd is 1, x gives the inverse.

4) Can I enter negative values for a?

Yes. The calculator normalizes negative inputs into the correct residue class modulo m. That keeps the inverse result mathematically consistent and easy to verify.

5) Why must the modulus be greater than 1?

A modulus of 1 collapses every integer to the same residue class. That makes the usual modular inverse concept unusable for practical number theory calculations.

6) What does the Bezout identity show?

It shows the exact coefficients produced by the algorithm. This identity proves whether the gcd is 1 and directly explains where the inverse value comes from.

7) Why are there many equivalent inverses?

If one inverse is x, then every value of the form x + km is equivalent modulo m. The calculator reports the least positive representative.

8) Where is this calculation commonly used?

Modular inverses appear in cryptography, coding theory, discrete mathematics, linear congruences, residue arithmetic, and algorithms involving divisions inside modular systems.

Related Calculators

Modular Exponentiation Fast Power CalculatorReverse Euclidean algorithm calculatorfast modular exponentiation calculatorLarge number modulo calculatormodular congruence solverpisano period calculatoreuler totient calculatorprime number checkerextended euclidean calculatorlegendre symbol calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.