Proving: "The trace of an idempotent matrix equals the rank of the matrix"

Sorry to post solution to this such a old question, but "The trace of an idempotent matrix equals the rank of the matrix" is very basic problem and every answer here is using the solution using eigen values. But there is another way which should be highlighted.

Solution:

Let $A_{n\times n}$ is a idempotent matrix. Using Rank factorization, we can write $A=B_{n\times r}C_{r\times n}$ where $B$ is of full column rank and $C$ is of full row rank, then $B$ has left inverse and $C$ has right inverse.

Now, since $A^2=A$, we have $BCBC=BC$. Note that, $$BCBC=BC\Rightarrow CBC=C\Rightarrow CB=I_{r\times r}$$

Therefore $$\text{trace}(A)=\text{trace}(BC)=\text{trace}(CB)=\text{trace}(I_{r\times r})=r=\text{rank}(A)\space\space\space\blacksquare$$


An idempotent has two possible eigenvalues, zero and one, and the multiplicity of one as an eigenvalue is precisely the rank. Therefore the trace, being the sum of the eigenvalues, is the rank (assuming your field contains $\mathbb Q$...)


I came to this page by accident but just wanted to note that the statement above that

"the multiplicity of one as an eigenvalue is precisely the rank"

is non-trivial and is not true for general matrices. You still need to prove that algebraic multiplicity equals geometric multiplicity (in other words, that the number of linearly independent eigenvectors equals the multiplicity of one)

The fact that "since y = Px = P(Px) therefore members of an orthogonal basis of the range of P are also eigenvectors of P " is the missing piece. Because of this we can comfortably say that the rank is at least equal to the multiplicity. After that we need to state that none of the eigenvectors whose eigenvalue is zero could contribute to the range (though that one might omit because it's trivial.) @DavidSpeyer said similar things in his comment.