The Problem
In regular math, every number has an inverse:
The inverse of 5 is . Multiply them, you get 1.
But in modular arithmetic, there are no fractions. Everything is whole numbers.
So how do we “undo” multiplication?
The Modular Inverse
The modular inverse of (mod ) is a number such that:
Multiply and , take mod , get 1.
Finding an Inverse
Example: What’s the inverse of 3 mod 7?
We need a number that, when multiplied by 3, gives remainder 1.
Let’s try them all:
| Try | Calculation | Result mod 7 | Is it 1? |
|---|---|---|---|
| ✗ | |||
| ✗ | |||
| ✗ | |||
| ✗ | |||
| ✓ |
Found it. The inverse of 3 mod 7 is 5.
We write this as:
Check: , and . ✓
Why Do We Care?
In regular math, division is just multiplying by the inverse:
Same in modular arithmetic. To “divide” by , multiply by ’s inverse.
In RSA encryption, the private key is the modular inverse of the public exponent .
Finding that inverse is how you generate the key pair.