# Can the additive and the multiplicative inverses to an element in $Z_p$ be the same?

Does it contradict the axioms of a field? I think not. If not so there need to be $a \in Z_7$ and so $3+a=0$ and $3\cdot a=1$ but I can not find this $a \in Z_7.$

If $a+b=0$, then $b=-a$. If simultaneously $1=ab$, then $1=-a^2$ which is equivalent to $a^2=-1$. This is possible in $\Bbb{Z}_p$, if and only if $p=2$ or $p\equiv1\pmod4$.

So you're right. This cannot happen in $\Bbb{Z}_7$.

• What do you say about: math.stackexchange.com/a/863700/103441 Thanks – gbox Jul 10 '14 at 21:55
• @gbox: You were discussing field axioms. Therefore I assumed that you are only interested in the case, where $\Bbb{Z}_p$ is a field. In other words I assume that $p$ is a prime. Kaj's extra examples (+1) concern the cases where that is not the case. If $m$ is not a prime, there is an element $a$ such that $a^2=-1$ if and only if $m$ is not divisible by four, and all its odd prime factors are $\equiv1\pmod4$. – Jyrki Lahtonen Jul 10 '14 at 22:11
• Thanks a lot! I understood your proof for $1=-a^2$ but where did $a^2=-1$ came from? – gbox Jul 10 '14 at 22:19
• Multiply the previous equation by $-1$. Ahh. It is phrased a bit oddly. Let me clarify. – Jyrki Lahtonen Jul 10 '14 at 22:19

Absolutely! I wrote a Python program a while ago to generate some examples for general quotient rings $\mathbb{Z}_n$. Here are some:

$2$ and $3$ $\pmod{5}$

$3$ and $7$ $\pmod{10}$

$5$ and $8$ $\pmod{13}$

$4$ and $13$ $\pmod{17}$

Anyone interested can find my Python code here. In general, let's suppose a pair of such elements exists in the ring $\mathbb{Z}_m$. They will satisfy the system $x+y \equiv 0 \pmod{m}$ and $xy \equiv 1 \pmod{m}$, and from this we discover that such a pair exists if and only if there exists an $x \in \mathbb{Z}_m$ such that $x^2 \equiv -1 \pmod{m}$.

To expand on your specific question regarding $\mathbb{Z}_p$ when $p$ is prime, note that if there is an element $x$ such that $x^2 \equiv -1 \pmod{p}$, then in particular $x^4 \equiv 1 \pmod{p}$. That is, there must exist an element of order $4$ in the multiplicative group $\mathbb{Z}_p^\times$. Now, it is a theorem that $\mathbb{Z}_p^\times \cong \mathbb{Z}_{p-1}$ when $p$ is prime. Finally, since $\mathbb{Z}_{p-1}$ is cyclic, it will contain an element of order $4$ $\iff$ $4|(p-1)$. So this phenomenon occurs in $\mathbb{Z}_p \iff$ $p \equiv 1 \pmod{4}$.

• Thanks! I do not know Python. but I did not understand your question – gbox Jul 10 '14 at 21:51
• @gbox, the claim is that there will exist two elements that are each others additive and multiplicative inverse in $\mathbb{Z}_m$ whenever $m = a^2 + 1$. This is a sufficient condition, but not a necessary condition (useful for generating examples). I edited my response with a necessary and sufficient condition. – Kaj Hansen Jul 10 '14 at 22:01
• @gbox, I added some detail to my response so that, hopefully, it ties in with Jyrki's response and makes a bit more sense. – Kaj Hansen Jul 11 '14 at 4:03