- Enter any integer for
a, including negatives. - Enter a positive integer for
m(the modulus). - Press Compute Additive Inverse to get normalized results.
- Use the buttons to export the results as CSV or PDF.
- Check the steps panel to verify each arithmetic transformation.
| a | m | a mod m | additive inverse b | (a+b) mod m | class [0..m-1] |
|---|---|---|---|---|---|
| No calculation yet. Enter values and compute. | |||||
| # | a | m | a mod m | additive inverse b | (a+b) mod m |
|---|---|---|---|---|---|
| 1 | 14 | 5 | 4 | 1 | 0 |
| 2 | -7 | 4 | 1 | 3 | 0 |
| 3 | 123456789 | 97 | 39 | 58 | 0 |
| 4 | 0 | 13 | 0 | 0 | 0 |
| 5 | 5 | 5 | 0 | 0 | 0 |
| 6 | -1 | 11 | 10 | 1 | 0 |
| 7 | 37 | 1 | 0 | 0 | 0 |
| 8 | -42 | 9 | 3 | 6 | 0 |
These samples include negatives, zero, equal modulus, and modulus one.
Formula Used
The additive inverse of a modulo m is a number b in the residue class [0, m-1] such that
a + b ≡ 0 (mod m). Therefore, b ≡ -a (mod m). A practical formula is:
b = (-a) mod m = (m - (a mod m)) mod m
We always normalize with a non‑negative remainder, ensuring a canonical representative in [0, m-1].
Properties of Additive Inverses modulo m
- Every residue class has exactly one additive inverse in
[0, m-1]. - If
a ≡ 0 (mod m), then its inverse is0. aand its inverse sum to a multiple ofm.- Inverse is an involution: the inverse of
bisa mod m. - For even
m,m/2is self‑inverse since(m/2 + m/2) ≡ 0.
Common Edge Cases and Worked Examples
- Negative a: normalize first; e.g.,
a=-7, m=4givesa mod m = 1, inverse3. - Zero a: inverse is zero for any positive
m. - m = 1: the only residue is
0; the inverse is0. - a multiple of m: inverse
0sincea mod m = 0.
Residue Class Pairings for m = 12
Each residue r has an additive inverse b such that r + b ≡ 0 (mod m). Canonical representatives are listed in [0, m-1].
| r | additive inverse b = (−r) mod m | (r + b) mod m |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 11 | 0 |
| 2 | 10 | 0 |
| 3 | 9 | 0 |
| 4 | 8 | 0 |
| 5 | 7 | 0 |
| 6 | 6 | 0 |
| 7 | 5 | 0 |
| 8 | 4 | 0 |
| 9 | 3 | 0 |
| 10 | 2 | 0 |
| 11 | 1 | 0 |
Self‑Inverse Residues for m = 12
Residues satisfying 2r ≡ 0 (mod m) are fixed points under inversion. For even m, this set is {0, m/2}. For odd m, only {0}.
| # | Residue r | Verification (2r mod m) |
|---|---|---|
| 1 | 0 | 0 |
| 2 | 6 | 0 |
FAQs
b satisfying a + b ≡ 0 (mod m). In other words, b ≡ -a (mod m), normalized to the canonical class [0, m-1].m, every residue class has a unique additive inverse within [0, m-1], including 0 which maps to 0.a mod m is always in [0, m-1], then compute b = (-a) mod m.a + b ≡ 0 (mod m), while multiplicative inverse requires a·x ≡ 1 (mod m) and exists only when gcd(a,m)=1.0 (mod 1), so the additive inverse is always 0.