Criteria for the existence of zero-divisors and idempotent elements in the integers modulo $n$ I need help in establishing or at least deciding the validity of the following two criteria:


*

*There are in the ring $Z_n$ non-trivial zero divisors if only if $n$ is divisible with some square. 

*There are in the ring $Z_n$ non-trivial idempotent elements if only if $n$ divides the product of two consecutive integers.

 A: There is possibly some confusion regarding the terms used in the first criterion, let me try to clear this up. 


*

*It is false that non-trivial zero-divisors exists only if $n$ is divisible by a square. Recall that that a nontrivial zero-divisor is a nonzero (modulo $n$) element $a$ such that $ab \equiv 0$ for a non-zero $b$. If $n$ is not a prime number, and $d \mid n $  is a divisor other than $1$ and $n$, then $$d \ \frac{n}{d} \equiv 0 \pmod{n}$$ so $d$ is a non-trivial zero-divisor. It is also possible to show that if $n$ is prime then there are no non-trivial zero-divisors; just recall that $n \mid ab$ implies that $n \mid a$ or $n \mid b$ if $n$ is prime. So the criterion is (the special case $n= 1$ is easy): 

$\mathbb{Z}_n$ contains nontrivial zero-divisors if and only if $n$ is composite.

The criterion you gave is a criterion for something else though. 
Namely, an element $a$ is called nilpotent if $a^k \equiv 0 \mod n$ for some positive integer $k$. One has the following criterion: 

$\mathbb{Z}_n$ contains nontrivial nilpotent elements if and only if $n$ is divisible by a square.

To see this note that if $m^2 \mid n$ then $(\frac{n}{m})^2 =  n \frac{n}{m^2} \equiv 0  \mod n$. And, conversely if $n$ is squarefree, then for $1 \le a \le n-1$ there is a prime $p \mid n$ such that $p \nmid a $ and then $ p \nmid a^k$ for each $k$ showing that $a^k$ is non-zero modulo $n$.

*An element $a$ is called idempotent if $a^2 \equiv a \mod n$. This is equivalent to $a^2 - a \equiv 0 \mod n$ so $n \mid (a^2 -a) = a(a-1)$. Showing the validity of the criterion: 

$\mathbb{Z}_n$ contains a nontrivial idempotent element if and only if $n$ divides the product of two consecutive positive integers less than $n$.

If one does not insist on the integers being positive (or at least non-zero) the condition is empty as $n$ always divides $0 = 0 \times 1$ as well as e.g. $n\times(n-1)$.     
A: In $\mathbf{Z}_6$ there are non-trivial zero divisors, but $6$ is squarefree. [?]
