Modular Inverse:
From: | To: |
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).
The calculator finds x that satisfies:
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.
Details: Modular inverses are essential in cryptography (especially RSA algorithm), computer algebra systems, and solving linear congruences.
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).
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)).