Show that that the ring $\mathbb{Z}_n$ need not have the property $a^2 \equiv a$ implies $a \equiv 0 \pmod{n}$ or $a \equiv 1 \pmod{n}$ Find an integer n that shows that the ring $\mathbb{Z}_n$ need not have the following property
$a^2 = a$ implies $a \equiv 0 \pmod{n}$ or $a \equiv 1 \pmod{n}$. 
This is my proof:
We will use $n=6$ for all of these. Namely, consider $\mathbb{Z}_6 = \{0, 1, 2, 3, 4, 5\}$.
Recall that to prove that an implication “$P$ implies $Q$” fails, we need to find an example where $P$ is true and $Q$ is false. Consider $a=3$. Then $a^2 = 9 \pmod{6} \equiv 3 \equiv a$ but $3\not\equiv 0$ and $3\not \equiv 1$.
I was wondering if anybody can check my proof and see if it is correct. Thank you for your time it is greatly appreciated.
 A: Your proof is correct. Notice that the property
$$a^2 = a \implies a = 0 \vee a=1$$
is true in any integral domain. In order to prove that it is false in some $\mathbb{Z}_n$ you correctly used $\mathbb{Z}_6$, which is not a domain: indeed, you found an element $a$ which is a zero divisor.
A: Your proof is correct. Viewed via CRT we see that $\,3\,$ maps to $\,(1,0)\,$ mod $\,(2,3),\,$ and clearly $\,(1,0)^2 = (1,0)\,$ is idempotent. Generally the same idea works for any composite modulus that is not a prime power, since it can be split into coprime factors $\,mn,\,$ so by CRT we can solve for $\,x\equiv (1,0)\,$ mod $ m,n\,$ to get an idempotent that's nontrivial, i.e. not $ (0,0)$ or $(1,1)$, i.e not $0$ or $1$. If you study ring theory then this will shed more light one why such idempotents are intimately connected to such (coprime) factorizations (Peirce decomposition), e.g. see here and its links.
A: To expand on Bill Dubuque’s response, I’ll point out that you’re looking for idempotents ($a^2=a$) in a ring $R$. Any time that $R=R_1\oplus R_2\oplus\cdots\oplus R_n$, that’s the ring-direct sum of the separate rings $R_i$, where you have coordinatewise addition and multiplication, any vector $(a_1,\cdots,a_n)$ in which all the $a_i$ are either zero or $1$ will be an idempotent. By Chinese Remainder Theorem, $\Bbb Z/(n)$ is the ring-direct sum of the $\Bbb Z/(p_i^{e_i})$, where $p_1^{e_1}\cdots p_n^{e_n}$ is the prime factorization of $n$. So $6$ is the first value of $n$ that gives an example.
