Diagonalization of a projection

If $T$ is a projection, that means there's a subspace $W$ onto which it projects. It maps every vector in $W$ to itself. Therefore every vector in $W$ is an eigenvector with eigenvalue $1$. Every vector not in $W$ is mapped to a vector in $W$. Take any vector $v$ and write $$ v = Tv + (v-Tv), $$ so the first term $Tv$ is in $W$. It is easy to see that the second term, $v-Tv$, is in the kernel of $T$: the first term is mapped to $Tv$, and the second is mapped to $Tv-T^2v$. But since $Tv$ is in $W$, it must be fixed by $T$, so $T^2v=Tv$; thus $T(v-TV)=0$. In this way, every vector $v$ is written as the sum of a vector in $W$, which is an eigenvector with eigenvalue $1$, and a vector in the kernel of $T$, which is an eigenvector with eigenvalue $0$. So form a basis of the whole space by taking the union of a basis of $W$ and a basis of the kernel of $T$, and the matrix of $T$ with respect to that basis is $$ \begin{bmatrix} 1 \\ & 1 \\ & & 1 \\ & & & \ddots \\ & & & & 1 \\ & & & & & 0 \\ & & & & & & \ddots \\ & & & & & & & 0 \end{bmatrix} $$ (and all off-diagonal entries are $0$) where the number of $1$s is the dimension of $W$ and the number of $0$s is the dimension of the kernel of $T$.


@Michael Hardy's answer is nice and complete. I'd like to write down how I think about this question.

Let $P:{\mathbb R}^m\to{\mathbb R}^m$ be the projection transformation. By rank–nullity theorem,

$$\dim(\ker(P))+\dim(\operatorname{range}(P))=m $$ On the other hand, by definition, $P^2=P$, which implies that the eigenvalues of $P$ are $\lambda=0$ or $1$. It's not hard to show that $\ker(P)$ is the eigenspace of $\lambda=0$ and $\operatorname{range}(P)$ is the eigenspace of $\lambda=1$. Therefore, we have an independent set of $m$ eigenvectors, which implies that $P$ is diagonalizable.


If $P$ is a projection and $J$ is the Jordan matrix associated with $P$ (that is, for some nonsingular $Q$, $P=QJQ^{-1}$) then $$J^2=\left(Q^{-1}PQ\right)\left(Q^{-1}PQ\right)=Q^{-1}P^2Q=Q^{-1}PQ=J$$ This is possible only when $J$ is diagonal.