I've seen some claims that idempotency ($\rho^2=\rho$) is necessary and sufficient to guarantee the existence of some state $\psi$ such that $\rho=|\psi\rangle\langle\psi|$, as well as claims on the trace such as here. However, I have so far been unable to prove a necessary and sufficient condition for a density matrix to represent a pure state.
It is easy to see that if $\rho=|\psi\rangle\langle\psi|$ then $\rho$ is idempotent: $$ \rho^2=|\psi\rangle\langle\psi|\psi\rangle\langle\psi|=|\psi\rangle\langle\psi|=\rho $$ by normalization. However, the converse has proven more difficult I have been able to show, by expanding in a basis and noting that the eigenvalues of an idempotent matrix are either 0 or 1, that if $\rho$ is idempotent then $$ \rho=\sum_j \lambda_j |\psi_j\rangle\langle\psi_j| $$ where each $\lambda_j$ is either 0 or 1. How can I complete the proof? Alternatively, is idempotency not a sufficient condition for a pure state?