Why an idempotent matrix has only eigenvalue equal to 0 or 1 I came across a pdf file on the internet today about an idempotent matrix. Inside the pdf file, it stated that:

A matrix A is idempotent if and only if all its eigenvalues are either
  0 or 1. The number of eigenvalues equal to 1 is then tr(A).

The proof inside has illustrated below:  
$\lambda v = Av = AAv = \lambda Av = \lambda^2v $
$ \lambda v - \lambda^2v = 0$
$ \lambda(1-\lambda) = 0$
where $v$ is a non-zero vector, we can get $ \lambda = 0$ or $ \lambda = 1$ eventually.

The above proof sounds reasonable, however if I twist this equation a bit:
$ \lambda v = Av $
$ \lambda v = AAv $
$ \lambda v = AAAv $ because of the fact $A^2 = A$
$ \lambda v = AA \lambda v = \lambda AAv = \lambda^2Av = \lambda^3v$
$ \lambda v - \lambda ^3 v = 0$
$ \lambda(1-\lambda^2) = 0$ 
I can get $\lambda = 0$, $\lambda = 1$ and $\lambda = -1$ which contradicts the properties stated. I know that the theorem is always true so the question should be in my side. Can anyone help to point out what's wrong with my proof? Thank you in advance.
 A: Obtaining the equation $\lambda (1-\lambda^{2})=0$ does not mean that every solution of this equation is an eigen value. You have only proved that any eigen value satisfies this equation but the converse result is not true.
A: What you've shown is that possible eigenvalues are $0$, $1$, and $-1$. That doesn't mean they occur! Before you started any argument at all, possible eigenvalues are all real numbers!
A: More carefully formulated, what has been proved in the paper is:

If $A^2=A$ and $\lambda$ is an eigenvalue of $A$, then $\lambda\in\{0,1\}$.

What you proved is:

If $A^2=A$ and $\lambda$ is an eigenvalue of $A$, then $\lambda\in\{-1,0,1\}$.

What you proved is true, but not in contradiction to what was proved in the PDF; indeed, your statement is a direct consequence of the PDF's statement.
Note that what was not proved — in both cases — is that all the values occur. And indeed, there are obvious counterexamples:


*

*The zero matrix is its own square, and has only zero as eigenvalues, thus proving that the eigenvalue $1$ does not need to occur.

*The identity matrix is it's own square, and has only one as eigenvalues, thus proving that the eigenvalue $0$ does not need to occur.
And of course the proof in the PDF tells you that the eigenvalue $-1$ will never occur.
A: Here is a more thorough proof.
Let $A$ be $n$-by-$n$ idempotent matrix. Then it is square and has an eigen-decomposition
$$A = Q\Lambda Q^{-1}$$
where $Q$ is a matrix with column being eigenvectors of $A$ and $\Lambda$ is a diagonal matrix with eigenvalues of $A$.
Since $A$ is idempotent we know that:
$A = AA$
So:
$$AA = Q\Lambda Q^{-1}Q\Lambda Q^{-1} = Q\Lambda^2Q^{-1} = Q\Lambda Q^{-1} = A$$
Now note that we can repeat this reasoning as many times as we want, so in fact for idempotent matrices we have:
$$\Lambda = \Lambda^k\text{   for }k = 1, 2, 3, \ldots$$
The only way this can happen is when we have:
$$\forall_{k \in \mathbb{N}}\forall_{i = 1, \ldots, n} \lambda_i = \lambda_i^k$$
And this may only happen when all $\lambda_i \in \{0, 1\}$. $\square$
