Enter Inputs
Results
No results yet. Enter values and press Compute.
Example Data
Click “Use” to send values to the form.
| a | m | Expected inverse | |
|---|---|---|---|
| 3 | 11 | 4 | |
| 10 | 17 | 12 | |
| 15 | 26 | 7 |
Formula Used
The modular inverse of a modulo m is an integer x such that:
a · x ≡ 1 (mod m)
- Exists iff gcd(a, m) = 1.
- Using the Extended Euclidean Algorithm, find integers x, y with a·x + m·y = gcd(a,m).
- If the gcd is 1, then x mod m is the inverse.
We also reduce a modulo m first to simplify steps.
How to Use
- Enter integers for a and m (m > 1).
- Optionally paste multiple pairs in Batch input, one per line.
- Click Compute to get inverses and full Extended Euclid steps.
- Download a summary via Download CSV or a snapshot as PDF.
- Use examples to quickly test and verify understanding.
Tip: Negative a values are automatically reduced into the range [0, m).
FAQs
1) When does a modular inverse exist?
An inverse exists exactly when gcd(a, m) = 1. If the gcd is greater than 1, no inverse exists.
2) How are the steps generated?
They come from the Extended Euclidean Algorithm, showing quotients and the evolving remainders and coefficients.
3) What if a is negative or larger than m?
We reduce a modulo m so the computation is equivalent and cleaner.
4) Can I compute many inverses at once?
Yes. Paste multiple pairs in the batch area, one pair per line, and compute all together.
5) Why might the inverse show as “No inverse”?
Because gcd(a, m) ≠ 1. In that case, the congruence a·x ≡ 1 (mod m) has no solution.
Invertible Residues Count φ(m) for m = 2..20
The number of invertible classes modulo m equals Euler’s totient φ(m).
| m | φ(m) | Notes |
|---|---|---|
| 2 | 1 | All odd residues invertible |
| 3 | 2 | |
| 4 | 2 | |
| 5 | 4 | |
| 6 | 2 | |
| 7 | 6 | Prime: φ(m)=m-1 |
| 8 | 4 | |
| 9 | 6 | |
| 10 | 4 | |
| 11 | 10 | Prime: φ(m)=m-1 |
| 12 | 4 | |
| 13 | 12 | Prime: φ(m)=m-1 |
| 14 | 6 | |
| 15 | 8 | |
| 16 | 8 | |
| 17 | 16 | Prime: φ(m)=m-1 |
| 18 | 6 | |
| 19 | 18 | Prime: φ(m)=m-1 |
| 20 | 8 |
Common Modular Inverse Pairs (Quick Reference)
Pairs (a, a⁻¹ mod m) shown for selected moduli. Symmetry: if a·b≡1 then b·a≡1.
m = 7
- (1, 1)
- (2, 4)
- (3, 5)
- (6, 6)
m = 11
- (1, 1)
- (2, 6)
- (3, 4)
- (5, 9)
- (7, 8)
- (10, 10)
m = 26
Coprime residues: 1,3,5,7,9,11,15,17,19,21,23,25.
- (1, 1), (3, 9), (5, 21), (7, 15), (9, 3), (11, 19)
- (15, 7), (17, 23), (19, 11), (21, 5), (23, 17), (25, 25)