A non-zero number $a \in \mathbb Z_n$ is called a divisor of zero if there is a non-zero number $b \in \mathbb Z_n$ such that $ab\equiv 0\pmod n.$
How can I prove $\mathbb Z_n$ has divisors of zero if and only if $n$ is not prime.
I filled out the addition and multiplication tables for modulo 6 and 7 and tried to find out the relation, and it's definitely true. I know I need to prove it in both directions since it is an 'iff' question. But I still don't get it.
Great question. If we have the integers mod some composite number m=pq, then pq will equal zero, so we have zero divisors. If we have the integers mod some prime number p, then if p | a*b for some a,b then p | a or p | b which can't occur because every element is less than p.