Modular Inverse Calculator
Find a⁻¹ mod m by extended Euclid with existence check, Bezout coefficients, and multiply-to-1 verification.
Calculator
Inverse Inputs
Value to invert
Must exceed 1
Inverse Summary
Results
Inverse a⁻¹ mod m
4
(3)⁻¹ mod 11
1
Equals 1 — inverse valid
1
Must equal 1
4
Raw coefficient pre-normalization
0 … 10
Inverse lives here
Extended Euclid is exact for these inputs; the GCD gate decides existence and the multiply-to-1 check certifies every inverse.
Visualizations
Inverse vs modulus
Inverse position
GCD gate
Formula
Extended Euclid runs the remainder chain while tracking how each remainder combines a and m; at GCD 1 the a-coefficient is the inverse.
Alternative Form
Variables
| Symbol | Name | Unit | Description |
|---|---|---|---|
| a | Value | integer | Number being inverted |
| m | Modulus | integer | Exceeds 1 |
| x, y | Bezout coefficients | integers | Combine a and m into the GCD |
| inv | Inverse | integer | Normalized x in 0…m−1 |
Explanation
The verification bar stacks the product as full m-blocks: everything cancels except a green tip of exactly 1.
Derivation
Invariant a·xᵢ + m·yᵢ = rᵢ across Euclid rows; at r = GCD = 1, a·x ≡ 1 (mod m). Normalizing x fixes the unique class representative.
Step-by-Step Calculation
Follow each step to understand how the result is calculated from your inputs.
Normalize a onto the clock.
Run extended Euclid tracking coefficients.
Read the Bezout x as the raw inverse.
Normalize the candidate into range.
Verify by multiplying back to 1.
Worked Examples
See how the calculator works with different scenarios.
Scenario
Default textbook pair.
Inputs
Calculation
11=3×3+2; 3=2×1+1 Back-substitute → x = 4
Result
Inverse = 4 (3×4=12≡1)
Interpretation
Dividing by 3 mod 11 means multiplying by 4.
Understanding Your Result
Your Result: a⁻¹ mod m or a proven no-inverse verdict — see the result cards.
Typical range: Inverses always land in 0…m−1; existence fails exactly for non-coprime pairs.
What This Means
The inverse is the key that undoes multiplication by a on the m-clock; GCD > 1 means no such key exists.
Why It Matters
Private RSA keys, cipher decryption, and finite-field fractions are all modular inverses in disguise.
Professional Interpretation
A verified 1 is safe to deploy as a decryption exponent or field divisor; a GCD obstruction redirects to the congruence solver.
Recommendations
- •Verify (a·inv) mod m = 1 always
- •Normalize negatives before Euclid
- •Read GCD > 1 as impossible
- •Use the inverse for modular division
- •Keep m above 1
Educational Content
Introduction
Modular arithmetic has no division button — instead, the inverse turns division into multiplication by a special partner.
Concept Explanation
Extended Euclid expresses the GCD as a combination of a and m; when that combination equals 1, the a-part is the inverse.
Applications
Benefits
- •Existence gate included
- •Bezout coefficients exposed
- •Multiply-to-1 verification
- •Negative-safe normalization
- •Impossibility explained
Limitations
- •Requires GCD(a, m) = 1
- •m must exceed 1
- •10M input cap
Best Practices
- •Check GCD first
- •Normalize a mod m early
- •Wrap negative x forward
- •Verify with one multiply
- •Route GCD > 1 to congruences
Common Misconceptions
Practical Tips
- •Check GCD(a, m) = 1 before trusting output
- •Normalize a into 0 … m−1 first
- •Wrap negative Bezout x forward
- •Verify with one multiply to 1
- •Read GCD > 1 as provably impossible
- •Use the inverse to divide mod m
- •Keep m strictly above 1
Common Mistakes
Assumptions
This calculator makes the following assumptions to provide estimates:
Limitations
Be aware of these limitations when using this calculator:
Frequently Asked Questions
Answers to common questions about this calculator.
What is a modular inverse?
When does a modular inverse exist?
How is the inverse computed?
How do you verify an inverse?
Why normalize a into 0…m−1 first?
Where are modular inverses used?
Is the inverse unique?
What if GCD(a, m) is not 1?
Can m be 1?
Related Calculators
Explore more calculators related to this topic.
Related Guides
Deepen your understanding with these educational resources.
Glossary
Technical terms used in mortgage calculations explained in plain language.
- Modular inverse
- x with a·x ≡ 1 (mod m).
- Extended Euclid
- Euclid tracking combination coefficients.
- Bezout identity
- a·x + m·y = GCD(a, m).
- Coprime
- GCD 1 — the inverse precondition.
- Normalization
- Wrapping into 0…m−1.
- Verification product
- (a·inv) mod m, must be 1.
- Obstruction
- A GCD above 1 blocking inversion.
- Finite field
- Mod-prime arithmetic where every nonzero value inverts.
Authoritative References
Trusted sources and standards referenced by this calculator.
Applicable Standards
Was This Calculator Helpful?
Page Information
2026-09-29
2.0.0
Free to use for educational and professional purposes.