Why do only the numbers coprime to n (numbers that share no prime factors with n) have a modular inverse (mod n)? Can anyone intuitively explain it?
Asked
Active
Viewed 126 times
-3
-
IMHO, It is a so direct consequence of Bezout formula that it doesn't deserve a special intuition. – Jean Marie May 18 '23 at 13:00
-
1Suppose that you have a number $x$ which is not coprime to $n$, i.e. $n\geq \gcd(x,n)=g>1$. Then $x=ag$ for some $a$ and $n = bg$ for some $0<b<n$. Then $xb = na$ and in the context of modn that means that $xb \equiv 0 \pmod{n}$ and so $x$ is a zero divisor. You should know that you can't divide by zero in normal contexts, well you can't divide by zero here either. If there were such a thing as $x^{-1}$ then you would have hoped for $x^{-1}xb \equiv b\pmod{n}$ but we have $x^{-1}xb \equiv x^{-1}0\equiv 0\pmod{n}$ instead. – JMoravitz May 18 '23 at 13:05
-
1More generally, see the Proof in the linked dupe. – Bill Dubuque May 18 '23 at 18:38
1 Answers
2
Say $x$ is not coprime to $n$. Let $p$ be a common factor of $x,n$. Then we can write $x=py,n=pm$. This shows that $x$ is a "zero divisor", i.e., $$xm\equiv 0\mod n.$$ It is a general fact that zero-divisors cannot have inverses.
In particular, here is a simple proof by contradiction of this fact: Assume that for some $z$, we have $zx\equiv 1\mod p$. This gives the following two equations: $$zxm \equiv 1m\not\equiv 0\mod n$$ $$zxm \equiv z0\equiv 0 \mod n$$ which is clearly impossible.
For intuition, I think it is helpful to note that if $x,p$ are coprime then $x,2x,3x,\ldots$ is a permutation of $0,1,2,\ldots, p-1$ (which in particular shows that $x$ has a multiplicative inverse), whereas this cannot work for zero-divisors.

Alek Westover
- 136
-
Please strive not to post more (dupe) answers to dupes of FAQs, cf. recent site policy announcement here. – Bill Dubuque May 18 '23 at 18:38