I recently did this exercise and I was hoping to get some feedback on my proof.
Given an real matrix $A$ such that $A^2=A$. Show that A is diagonalizable.
Proof: Assume that $A \in R^{nxn}$, and assume that we have the linear map $V \longrightarrow V$ such that $x \mapsto Ax$, where $V$ is an arbitraty vector space with $\dim V = n < \infty$.
$A$ is diagonalizable if there exists a matrix $T$ such that $D = T^{-1}AT$, where $T$ is the matrix with $n$ linearly independent eigenvectors of $A$ and $D=diag(\lambda_1,...\lambda_k)$ if we assume $k$ eigenvalues to $A$.
Note that for any vector $x\neq0 \in V$ we have $Ax = \lambda x$ but also $Ax=A^2x=A(Ax)=A(\lambda x)=\lambda(Ax) = \lambda^2x$ and thus $(\lambda-\lambda^2)x=0$
and so the only eigenvalues to $A$ is $\lambda_0=0$ and $\lambda_1=1$.
Call the corresponding eigenspaces $E_0 = \{x\in V | Ax=0\} =: \ker(A)$ and $E_1=\{x\in V | Ax=x\}$
Thus, we can express $V = E_0 \bigoplus E_1$ and it follows that $\dim V = n =\dim E_0 + \dim E_1$ and thus we know that we have a set of $n$ linearly independent eigenvectors.
Therefore $A$ is diagonalizable. $\blacksquare$
The last step is where I'm a bit unsure. I'm thinking that because we only have two eigenvalues, the space $V$ must be a direct sum of the two corresponding eigenspaces, am I right? Also, am I right when I say that because the sum of the dimensions of the two eigenspaces is $n$, we know for sure that we have $n$ linearly independent eigenvectors? I think that makes sense.
Cheers