Given that matrix $A$ is diagonalizable and has eigenvalues of $0$ or $1$, show that $A^2 = A$

Since $ A $ is diagonalizable, you can rewrite it as $ A = PDP^{-1} $, so, by associativity of matrix multiplication $$ A^2 = A \cdot A = (PDP^{-1}) \cdot (PDP^{-1}) = PD \cdot (P^{-1}P) \cdot DP^{-1} = PD^2 P^{-1} $$

Now it’s left to calculate what $D^2$ is.

I won’t go in the details, it depends on the level of formality required, but it’s not difficult to get convinced that the product of two diagonal matrices is still a diagonal matrix. Moreover, the following property holds: given two diagonal matrices $S$ and $D$, one can use the compact notation for diagonal matrices and write only the elements on the diagonal $$S = \mathrm{diag}(a_1, \dots, a_n), \quad D= \mathrm{diag}(b_1, \dots, b_n)$$ then, the product of the matrices is the product of the elements. $$ D\cdot S = \mathrm{diag}(a_1\cdot b_1, \dots, a_n \cdot b_n)$$

Specifically, in your case, A has eigenvalues of either 0 or 1, and your $ D $ is the spectral matrix, the diagonal matrix that has the eigenvalues on the main diagonal. So when you write D with the compact notation, the entries in that “$ \mathrm{diag} $ vector” will only be either 0 and 1, and when you calculate $ D^2 $, since the entries will be the same, in every entry you’ll either do $0\cdot0=0$ or $1\cdot 1 =1 $. So, in the end, $D^2 = D $.

We left ourselves saying that $ A^2 = PD^2 P^{-1} $, so $ A^2 = PDP^{-1} $, but $ A = PDP^{-1} $by hypothesis. In the end $ A^2 = A $.


Since $A$ is a diagonalizable $n \times n$ matrix and has only eigenvalues $0$ and $1$ it Jordan matrix is like: $$J =\pmatrix{O_k&0\\0&I_{n-k}}\implies J^2 = J$$ where $O_k$ is $k\times k$ zero matrix and $I_{n-k}$ is $n-k\times n-k$ identity matrix. Thus your matrix has the same property.