Modular Multiplicative Inverse:
From: | To: |
The modular multiplicative inverse of an integer a modulo m is an integer x such that the product a × x is congruent to 1 modulo m. It exists only if a and m are coprime (gcd = 1).
The calculator uses the extended Euclidean algorithm to find integers x and y such that:
When gcd(a, m) = 1, the value of x (mod m) is the modular inverse of a.
Details: Modular inverses are essential in cryptography (RSA algorithm), solving linear congruences, and computer algebra systems.
Tips: Enter integer a and modulus m (must be > 1). The calculator will find x such that a × x ≡ 1 mod m, or indicate if no inverse exists.
Q1: When does the modular inverse exist?
A: The inverse exists if and only if a and m are coprime (gcd(a, m) = 1).
Q2: How is this different from division?
A: Modular inverse is the equivalent of reciprocal in modular arithmetic. Instead of dividing by a, you multiply by its inverse.
Q3: What's the time complexity?
A: The extended Euclidean algorithm runs in O(log min(a, m)) time.
Q4: Can modulus be negative?
A: The modulus m must be positive (m > 1). The integer a can be negative.
Q5: What if multiple inverses exist?
A: The inverse is unique modulo m. All solutions are congruent modulo m.