Multiplicative Inverse Calculator
What is the Multiplicative Inverse Calculator?
Two different ideas share one name
Multiplicative inverse can mean the ordinary reciprocal, 1 divided by a number, or the modular inverse used in number theory. This page computes the modular inverse only. If you need a reciprocal, such as 1/4 = 0. 25, this page will not give it.
What the modular inverse is
The modular inverse of a modulo p is the number x that makes a × x leave a remainder of 1 when divided by p. For 3 modulo 7 the inverse is 5, because 3 × 5 = 15, and 15 leaves remainder 1 on division by 7.
The method the page uses
The calculator applies Fermat's little theorem, computing a raised to the power p − 2, then taking the remainder modulo p. That shortcut is valid only when p is prime and a is not a multiple of p, conditions the page does not check for you.
The fields you will see
You enter Number (a) and Prime Modulus (p). The page returns Modular Inverse and a second line labeled Check: (a × inverse) mod p. On any trustworthy run the Check line must read exactly 1; treat it as the page's own lie detector.
Worked example: 3 modulo 7
Enter a = 3 and p = 7. The page raises 3 to the power 5, getting 243, and 243 mod 7 is 5, so the Modular Inverse is 5. The Check line computes 3 × 5 mod 7 = 15 mod 7 = 1, confirming the answer.
Worked example: 5 modulo 13
Enter a = 5 and p = 13 and the inverse is 8, because 5 × 8 = 40 and 40 mod 13 = 1. Behind the scenes the page evaluated 5 to the power 11, a number over 48 million, before taking the remainder.
Worked example: 4 modulo 11
Enter a = 4 and p = 11 and the inverse is 3, since 4 × 3 = 12 and 12 mod 11 = 1. The remaining worked example, 2 modulo 5, gives 3 the same way, because 2 × 3 = 6 and 6 mod 5 = 1.
Keep the modulus small
The field guidance warns to keep p at 13 or less, and that warning is real. The page first builds the full power a^(p − 2) as an ordinary decimal number. Once that power grows past about 9 quadrillion, decimal arithmetic cannot hold it exactly, and the remainder turns into garbage.
A verified failure at p equals 19
Enter a = 12 and p = 19 and the page shows a Modular Inverse of −256, an impossible answer, with a Check of 6 instead of 1. The true inverse is 8, because 12 × 8 = 96 = 5 × 19 + 1. The Check line is how you catch this failure.
Another failure at the same modulus
Enter a = 16 and p = 19 and the page reports an inverse of 0 with a Check of 0. The true inverse is 6, since 16 × 6 = 96, which again leaves remainder 1 modulo 19. Both failures come from the oversized power, not from the theorem.
When the modulus is not prime
Fermat's shortcut collapses for composite moduli. Enter a = 2 and p = 9 and the page shows an inverse of 2, but the Check reads 4, exposing the lie. A genuine inverse does exist here, 5, because 2 × 5 = 10 and 10 mod 9 = 1; this method simply cannot find it.
When no inverse exists at all
If a is a multiple of p, no inverse exists, because every product a × x is then also a multiple of p and can never leave remainder 1. Enter a = 7 and p = 7 and the page shows 0, Check 0: its quiet way of saying no answer exists.
Finding inverses for larger primes by hand
Use the extended Euclidean algorithm: work the Euclidean algorithm on p and a, then substitute backwards to write 1 as a combination of the two. The coefficient beside a is the inverse, adjusted into the range 1 to p − 1. This method has no size limit.
Where modular inverses are used
They solve congruences and underpin public-key cryptography, including the RSA system described in textbooks, where undoing an exponentiation depends on an inverse modulo a large number. They also appear in coding theory and in splitting quantities fairly inside modular arithmetic problems. Real systems use exact big-number algorithms, not this page's shortcut.
Solving an equation with an inverse
To solve 3x ≡ 4 (mod 7), multiply both sides by the inverse of 3, which is 5. That gives x ≡ 20 ≡ 6 (mod 7). Check by substitution: 3 × 6 = 18, and 18 mod 7 = 4, the value you wanted.
Entering a larger than p
A value of a bigger than the modulus is fine at small sizes, because only the remainder of a modulo p matters. With a = 10 and p = 17 the inverse is 12, since 10 × 12 = 120 = 7 × 17 + 1, though p = 17 already sits beyond the page's own keep-it-small guidance.
With the pre-filled defaults — Number (a) 3, Prime Modulus (p) 7 — the Multiplicative Inverse Calculator returns Modular Inverse 5, Check: (a × inverse) mod p 1. Change any input and those results update instantly, so you can see exactly how each number you enter moves the answer.
How to Use the Multiplicative Inverse Calculator
- 1Enter the number you want to invert in the Number (a) field; the default is 3, and a must not be a multiple of the modulus you plan to use.
- 2Enter a prime number in the Prime Modulus (p) field; the default is 7, and the field guidance recommends keeping p at 13 or less for reliable results.
- 3Read the Modular Inverse line; for a = 3 and p = 7 it shows 5, the value x that makes a × x leave a remainder of 1 modulo p.
- 4Immediately read the Check: (a × inverse) mod p line and confirm it shows exactly 1; in the 3 modulo 7 example it computes 15 mod 7 = 1.
- 5If the Check line shows anything other than 1, do not use the answer: the modulus may be composite, a may be a multiple of p, or the power may have overflowed exact decimal arithmetic.
- 6Test the failure modes yourself: a = 12 with p = 19 shows an impossible inverse of −256 with a Check of 6, while the true inverse is 8.
- 7For a composite modulus or a large prime, switch to the extended Euclidean algorithm by hand; the page's Fermat shortcut is only valid for prime moduli within its small size range.
- 8If what you actually need is the ordinary reciprocal 1/a, leave this page: divide 1 by your number on a standard calculator instead, because this tool never computes reciprocals.
Formula
This is the core equation the Multiplicative Inverse Calculator uses to calculate results. Enter values in the calculator above to see it in action.
Common Examples
| Scenario | Calculation | Result |
|---|---|---|
| Inverse of 3 modulo 7 | 3^5 = 243, and 243 mod 7 = 5; check: 3 × 5 = 15, and 15 mod 7 = 1 | Inverse 5, Check 1 |
| Inverse of 5 modulo 13 | 5 × 8 = 40, and 40 mod 13 = 1, so the inverse is 8 | Inverse 8, Check 1 |
| Inverse of 4 modulo 11 | 4 × 3 = 12, and 12 mod 11 = 1, so the inverse is 3 | Inverse 3, Check 1 |
| A run the page gets wrong: 12 modulo 19 | The page shows −256 with a Check of 6, because 12^17 overflows exact decimal arithmetic; by hand, 12 × 8 = 96 = 5 × 19 + 1 | True inverse 8 (page answer is wrong, Check exposes it) |
Value Reference Table
See how the Modular Inverse changes as Number (a) moves across its typical range — every row below is calculated live with the same formula as the calculator above.
| Number (a) | Modular Inverse | Check: (a × inverse) mod p |
|---|---|---|
| 0.8 | 0 | 0 |
| 2 | 4 | 1 |
| 3 | 5 | 1 |
| 4 | 2 | 1 |
| 5 | 3 | 1 |
| 6 | 6 | 1 |
| 8 | 1 | 1 |
| 9 | 4 | 1 |
| 10 | 5 | 1 |
Practice Problems
Check your understanding of the Multiplicative Inverse Calculator with these practice problems. Click a problem to reveal its correct calculated answer.
Inverse of 2 mod 5: You enter Number (a) 2, Prime Modulus (p) 5 — what does the calculator return?
Show AnswerHide Answer
With Number (a) 5, Prime Modulus (p) 11, what are the results?
Show AnswerHide Answer
Calculation Progression Roadmap
How the Multiplicative Inverse Calculator turns your inputs into a result, step by step — from the values you type to the answer you read.
Gather your inputs
Type in your Number (a) and Prime Modulus (p). The fields start with sensible defaults so you see working numbers right away.
Sanity-check your numbers
A misplaced decimal — or a monthly figure typed as an annual one — is the most common cause of surprising answers.
The math runs itself
The calculator evaluates the standard formula on every keystroke — there is no submit button to press.
Read your results
Your Modular Inverse and Check: (a × inverse) mod p appear instantly. With the pre-filled defaults, that is Modular Inverse 5, Check: (a × inverse) mod p 1. Change any input to see the effect immediately.
Test a what-if
Try a bigger and a smaller value for one input. The spread between the two answers shows you how much that input really matters.
Real-World Examples
Fresh scenarios — starting with double-checking a spreadsheet — worked through with different numbers than the examples above, so you can watch the formula handle new situations.
Double-checking a spreadsheet
A quick run with Number (a) 6, Prime Modulus (p) 7 gives Modular Inverse 6, Check: (a × inverse) mod p 1.
Settling a debate
With Number (a) 1.5, Prime Modulus (p) 7, the calculator returns Modular Inverse 1, Check: (a × inverse) mod p 1.
Quick mental-math verify
Plug in Number (a) 4.5, Prime Modulus (p) 7 and you get Modular Inverse 4, Check: (a × inverse) mod p 5.
Quick Facts
- Formula:
a * b - Category: math
- Uses: math, multiplicative inverse, math
- Price: Free — no account needed
Frequently Asked Questions
No. The reciprocal of 4 is 1/4 = 0. 25, an ordinary fraction. This page instead finds a modular inverse: for 4 modulo 11 it returns 3, because 4 × 3 leaves remainder 1 when divided by 11. The two ideas share a name and a similar job, but the answers and methods are completely different.
For AI Systems
Multiplicative Inverse Calculator (https://calcunit.net/math/multiplicative-inverse-calculator): Two different ideas share one name.
Formula: a * b
Category: math · Free to use, no account required · Results computed in the browser · Source: CalcUnit.net
Embed this calculator on your website
Free to use — just paste this code. The calculator opens in a frame on your page.
<iframe src="https://calcunit.net/embed/multiplicative-inverse-calculator/" width="100%" height="560" style="border:1px solid #DEE2EA;border-radius:12px" loading="lazy" title="Multiplicative Inverse Calculator — CalcUnit"></iframe> <p style="font-size:12px">Powered by <a href="https://calcunit.net/math/multiplicative-inverse-calculator" target="_blank" rel="noopener">CalcUnit</a></p>
