Home Back

Modular Inverse Calculator

Modular Inverse:

\[ a \times x \equiv 1 \mod m \]

Unit Converter ▲

Unit Converter ▼

From: To:

1. What is Modular Inverse?

The modular inverse of a number a modulo m is a number x such that the product a × x is congruent to 1 modulo m. It exists if and only if a and m are coprime (their greatest common divisor is 1).

2. How Does the Calculator Work?

The calculator finds x that satisfies:

\[ a \times x \equiv 1 \mod m \]

Where:

Explanation: The calculator uses a brute-force method to test each possible value of x until it finds one that satisfies the equation or determines that no inverse exists.

3. Applications of Modular Inverse

Details: Modular inverses are essential in cryptography (especially RSA algorithm), computer algebra systems, and solving linear congruences.

4. Using the Calculator

Tips: Enter positive integers for both a and m. The calculator will either return the inverse or indicate that no inverse exists (when a and m are not coprime).

5. Frequently Asked Questions (FAQ)

Q1: When does a modular inverse exist?
A: A modular inverse exists if and only if a and m are coprime (gcd(a, m) = 1).

Q2: Is the modular inverse unique?
A: The inverse is unique modulo m, meaning all solutions are congruent modulo m.

Q3: What's a more efficient algorithm than brute-force?
A: The Extended Euclidean Algorithm is much more efficient, especially for large numbers.

Q4: Can negative numbers have modular inverses?
A: Yes, but this calculator uses positive integers. For negative a, use a ≡ a + m mod m.

Q5: What's the time complexity of this method?
A: The brute-force method used here is O(m), while the Extended Euclidean Algorithm is O(log min(a, m)).

Modular Inverse Calculator© - All Rights Reserved 2025