Answer
See the proof below.
Work Step by Step
If $A$ is singular, then $|A|=0$ and then
$|A^{2}|=|A||A|=0$
Thus, $A^{2}$ is singular.
If $A$ is nonsingular, then it has an inverse $A^{-1}$
By multiplying the equation $A^{2}=A$ with $A^{-1}$, we see that
$A^{-1}(A^{2})=A^{-1}A=I$ and then $A^{-1}(A^{2})=IA=A=I$
Thus, $A=I$