# How many zero divisors are there in $\mathbb Z_{pq}$ and $\mathbb Z_{p^2}$ when $p$ and $q$ are primes?

First of all, I'm still trying to prove that $a \in \mathbb{Z}_n$ is a zero divisor if and only if $\gcd(a,n)>1$, so if anyone wants to help me finish the details on that that'd be awesome.

But assuming I have proven that! I now need to figure out how many zero divisors there are in $\mathbb Z_{pq}$ and $\mathbb Z_{p^2}$. This seems like it should be a simple counting argument that I am making more complicated than need be.

Thanks.

• There's a slick way to do this if you know that the units are the elements coprime to the modulus. Sep 15, 2018 at 0:22
• Hm, and then the idea is an element can not be a zero divisor and a unit but they are one or the other for some reason? Sep 15, 2018 at 1:21
• Exactly right... Sep 15, 2018 at 1:39

## 1 Answer

Remember that a zero divisor is an $a$ such that exists $b$ nonzero, with $ab=0$. So, for example in the case of $\mathbb{Z}_{pq}$, that would be an $a$ such that there is a nonzero $b$ with $ab=kpq$, for some $k \in \mathbb{Z}$. Automatically $p|ab$, $q|ab$. Since $p$, $q$ are prime, you would have either $p|a$ or $p|b$, and $q|a$ or $q|b$. So, the number of zero divisors would be the sum of zero divisors $a$ multiples of $p$, plus the number of zero divisors $a$ multiples of $q$. That is $q+p-1$ (you are counting $0$ twice). What makes this two sets of possibilities having just one element in common is that the only common multiple is $pq=0$.

For $\mathbb{Z}_{p^2}$, your equation becomes $ab=kp^2$. Then this would imply $p|a$ and $p|b$, or $p^2|a$ or $b$ (this two last possibilities would imply either $a=0$ or $b=0$, so you rule them out). Then $a$ could be any multiple of $p$. that is, $p$ zero divisors (because $p\cdot 0=p\cdot p$).

As of your first question: $a$ is a zero divisor in $\mathbb{Z}_n$ iff $ab=kn$ has a nonzero solution in $b$ for some $k\in \mathbb{Z}$. If $(a,n)=1$, then $n|b$, so $b=0$ and $a$ is not a zero divisor (take now the counter-reciprocal). For the other implication: if $(a,n)=r>1$, then just take $b=\frac{n}{r}$, $ab=n=0$ and $b\neq 0$, so that $a$ is a zero divisor.

• I added and edit: I wasn't counting $0$ as a zero divisor, but it turns out that $0$ is indeed considered a zero divisor.
– Laz
Sep 15, 2018 at 0:12
• Now I corrected all typos, I think is now correct.
– Laz
Sep 15, 2018 at 0:20
• I cannot count $0$ as a zero divisor, so I was fine with the first version ;) Sep 15, 2018 at 0:29
• Well, if you mean nonzero zero divisors, just subtract one on each case, getting $p+q-2$ zero divisors in the first case, and $p-1$ in the second. But $0$ is considered a zero divisor. It's just semantics :) (en.wikipedia.org/wiki/Zero_divisor#Zero_as_a_zero_divisor). I agree with your idea of counting instead the units. I imagine you used the first part of your question to see that.
– Laz
Sep 15, 2018 at 0:33
• Oh @Randall, I confused you with the guy who asked the question. I see you are a Professor. My respect for you.
– Laz
Sep 15, 2018 at 0:44