Britannica Sources used in this answer

When does a number have a multiplicative inverse modulo a nonprime modulus?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

In number theory, an integer a has a multiplicative inverse modulo a modulus N if and only if a and N are relatively prime—meaning their greatest common divisor is 1.

When the modulus N is not prime, division is not always possible for every residue class. Specifically, the equation a×X≡1(modN) has a solution for X if and only if a and N share no common factors other than 1. If a and N are not relatively prime, no such X exists, and the multiplicative inverse is undefined for that class.1