Unit content
Modular inverses and linear congruences
A number $a$ has a multiplicative inverse modulo $n$ when there is an integer $x$ such that
$$ax\equiv1\pmod n.$$
Such an inverse exists exactly when
$$\gcd(a,n)=1.$$
Bézout's identity explains why. If
$$ax+ny=1,$$
then reducing modulo $n$ gives
$$ax\equiv1\pmod n.$$
Linear congruences
A congruence
$$ax\equiv b\pmod n$$
can be solved by multiplying by the inverse of $a$ when that inverse exists.
Unlike ordinary arithmetic, division modulo $n$ is therefore not always valid: it depends on whether the divisor is invertible in the chosen modulus.
This distinction is fundamental in modular equations, cryptographic constructions and algorithms over finite residue classes.