Number System

Modular Inverse

A pupil follows a circular path back to a highlighted mark.

Modular Inverse definition

A modular inverse of a modulo m is a number b such that ab ≡ 1 (mod m).

In Spanish
inverso modular
Topic
Number theory

Modular Inverse in a picture

Modular Inverse diagramThe product returns to the residue class of 1.a = 3, m = 7Find an inverse of 33 × 5 = 15Try b = 515 ≡ 1 (mod 7)The inverse is 5
The product returns to the residue class of 1.

How it works

For m > 1, an inverse exists exactly when gcd(a, m) = 1. If it exists, it is unique as a residue class. You can find it by testing residues or by using the extended Euclidean algorithm to write ax + my = 1. Then x is an inverse modulo m.

Worked examples

Find the inverse of 2 modulo 5.

3, because 2 × 3 = 6 ≡ 1.

Does 4 have an inverse modulo 6?

No. gcd(4, 6) = 2.

Find the inverse of 5 modulo 7.

3.

Common mistake

Check that a and m are coprime. A number’s ordinary reciprocal is a different operation from choosing an integer inverse modulo m.

Quick check

What residue must the product equal?

Show answer

1.

When does the inverse exist?

Show answer

When gcd(a, m) = 1.

Can two integer representatives name the same inverse?

Show answer

Yes, if they are congruent modulo m.

Sources

Flashcard

Modular Inverse

Reveal the definition

A modular inverse of a modulo m is a number b such that ab ≡ 1 (mod m).

Effortless Math. “Modular Inverse.” Math Dictionary.