# For $Z_5=\{0,1,..4\}$ and $z\in Z_n$. Prove that there exists a multiplicative inverse (except zero)

We define addition in $Z_5$ as addition and then modulo 5. Similarly we define multiplication as multiplication modulo 5. Then how do I proof the existence of multiplicative inverse? i.e $$\forall z \in Z_5-\{0\}\, \exists x\in Z_5\ni (zx \equiv 1 \pmod 5)$$ Or for every $z\in Z_5-\{0\}$, there exists $x\in Z_5$ such that $zx\equiv 1\pmod 5$.

I was able to prove the additive inverse, but I can't seem to remember this one.

• $0$ has no multiplicative inverse. $\mathbb Z_5$ is a field because $5$ is prime. – Peter Feb 14 '18 at 13:27
• One possibility is to use Bézout's identity and use that 5 is prime. Of course, as mentioned before, $0$ has no multiplicative inverse. – Anton V. Feb 14 '18 at 13:31
• For $\mathbb{Z}_5$ you can show multiplicative inverses exist for everything except $0$ by simply writing out the whole multiplication table. That's an informative exercise. For arbitrary prime moduli you want Bezout's theorem (look it up). – Ethan Bolker Feb 14 '18 at 13:35
• It seems odd to write "..." instead of just 0, 1, 2, 3, 4. It easy to see that 1*1= 1 so that 1 is its own inverse (that is always true),, 2*3= 6= 1 (mod 5) so 2 is the inverse of 3 and 3 is the inverse of 2. That leaves only 4 so it must also be its own inverse- and that is easy to see: 4*4= 16= 1 (mod 5). – user247327 Feb 14 '18 at 13:38
• What is $n$ in the title? – Andrés E. Caicedo Feb 14 '18 at 14:00

The general solution results from Bézout's identity, as mentioned in the comments, which itself results from $\mathbf Z$ being a Euclidean domain, hence a P.I.D., and this property:
In a principal ideal domain $R$, given two elements $a,b\in R$, a generator $d$ of the ideal $(a,b)$ is a common divisor of $a$ and $b$, and it is a greatest common divisor, in the sense that any common divisor of $a$ and $b$ is a divisor of $d$.
Thus two integers are coprime i.e. they have no common divisor but $\pm 1$, if and only if there exist integers $u,v$ such that $$um+vn=1.$$
Now in a ring $\mathbf Z/n\mathbf Z$, the units (i.e. the elements which have a multiplicative inverse) are the congruence classes of the elements $m$ which are coprime to $n$, because for such an element, we have a Bézout's relation which yields $\;um=1-vn$ so $\overline {um}=\overline u\,\overline m=\overline{1}$, which means the class of $u$ is the inverse of that of $m$.
In particular, if $n$ is prime, all non-zero elements in $\mathbf Z/n\mathbf Z$ have representatives in $\{1,\dots,n-1\}$ which are coprime to $n$, so they have in inverse modulo $n$. In other words,if $n$ is prime, the ring $\mathbf Z/n\mathbf Z$ is a field, and conversely.