Idempotent elements in $\mathbb{Z}_n$ I have found a question in Beachy and Blair: Abstract algebra. I have been trying for some days now and I cannot solve it:
Assume that $n$ is not a prime power. Show that $\mathbb{Z}_n$ has idempotent elements different from $[0], [1]$.
Hint: Suppose that $n=bc$ with $\mathrm{gcd}(b,c)=1$ and solve the simultaneous congruences 
$$
x\equiv 1 \ (\mathrm{mod} \ b),\qquad x\equiv 0 \ (\mathrm{mod} \ c).
$$ 
So I assume this $x$ is that is going to be the idempotent element. Solving the system of congruences is by the "standard method"
$$
(b,c)=1\quad \Rightarrow \quad \exists p,q\in\mathbb{Z},\quad  1=bp+qc
$$ 
therefore
$$
x=0\cdot bp+1\cdot qc
$$
fulfills the above congruences. But here I am stuck since since $0\cdot bp=0$, right? Which leaves us with $x=qc$. Did I make some mistake somewhere? 
Any help is appreciated :)
 A: No, that is correct. 
To verify it, compute $$(qc)^2=qc(1-pb)=qc-pq(bc)\equiv qc\pmod{bc}$$
By symmetry, $pb$ is likewise an idempotent.
More generally if $e$ is an idempotent, then $1-e$ is also an idempotent. This pair lets us "factor" a ring. If $R$ is a commutative ring with idempotent $e$, then $eR$ and $(1-e)R$ are rings with $e$ and $1-e$ as identities, respectively, and $R\cong eR\times (1-e)R$. 
In the above case, this becomes $\mathbb Z_n\cong \mathbb Z_b\times\mathbb Z_c$ when $n=bc$ and $\gcd(b,c)=1.$ 
This means that if $n=p_1^{a_1}\cdots p_k^{a_k}$ with the $p_i$ distinct, then:
$$\mathbb Z_n\cong \mathbb Z_{p_1^{a_1}}\times\cdots\times\mathbb Z_{p_k^{a_k}}$$

The reason you are solving this congruence is that if $$x\equiv 1\pmod b,\quad x\equiv 0\pmod{c}$$ then you have:
$$x^2\equiv 1\pmod b,\quad x^2\equiv 0\pmod{c}$$
So $x^2-x$ is divisible by $b$ and by $c$, and hence by $bc$ since $b,c$ are relatively prime, so $x^2\equiv x\pmod{bc}$, and $x$ is an idempotent.
If you think of this in terms of the isomorphism $\mathbb Z_n\cong \mathbb Z_b\times\mathbb Z_c$ then you are finding the element of $\mathbb Z_n$ corresponding to $(1,0)$ on the right side of the isomorphism. If $R_1,R_2$ are rings, then $(1,0)$ and $(0,1)$ are idempoenntents in $R_1\times R_2$.
