If $A^2=A$ then $0$ and $1$ are the only eigenvalues of $A$ From previous topic I learn the following statement:

If $A^2=A$  then $0$ and $1$ are the only eigenvalues of $A$.

I'm trying to prove this to myself but I can't seem to figure it out. I'm not sure how to show that they are the only ones. Also, can I say something about how many eigenvalues  $0$ and $1$ are there if $A\in\mathbb{R}^{n\times n}$?
 A: If $\lambda$ is an eigenvalue of $A$, there is $x \ne 0$ such that $A x = \lambda x$, and then $A^2 x = A(\lambda x) = \lambda^2 x$.  Now
$$ 0 = (A^2 - A) x = (\lambda^2 - \lambda) x$$
so we must have $\lambda^2 - \lambda = 0$.  The solutions of this quadratic equation are $\lambda=0$ and $\lambda=1$.
More generally, if $p(A)=0$ for some polynomial $p$, the eigenvalues of $A$ must be roots of $p$.
A: Notice that $A^2=A$ means $A^2-A=0$, therefore $f(A)=0$ when $f(x)=x^2-x$. The minimal polynomial of $A$ divides each polynomial $P$ that suffices $P(A)=0$, therefore $mA\in\{x^2-x,x,x-1\}=B$. Either way, the only eigenvalues possible are $0$ and $1$, because they are the only possible roots of the equations in the set B.
A: If $A^2=A$, then $(\lambda I-A)$ is invertible for all $\lambda\notin \{0,1\}$. In fact,
$$
                  (\lambda I-A)^{-1} = \frac{1}{\lambda^2-1}(\lambda I+A)
$$
which is easily verified directly, because
$$
                (\lambda I-A)(\lambda I+A)=\lambda^2I-A^2=(\lambda^2-1)I.
$$
Therefore, the only possible eigenvalues are $\lambda=0,1$. It is possible that one or the other is not an eigenvalue. For example $0^2=0$ and $I^2=I$. However, one or the other is an eigenvalue, and possibly both.
