Full problem: Suppose that$ A $is a diagonalizable $ n \times n$ matrix such that the characteristic polynomial of $A$ is $p(\lambda)=\lambda^{k} (1-\lambda)^{n-k}$ , where $k$ is a positive integer such that $0 \leq k \leq n$. Prove $A^2 = A$.
I am not quite sure how to prove this while incorporating the characteristic polynomial.
hint
Since $A$ is diagonalizable, there exists a basis made up of eigen vectors. From the characteristic polynomial we know that the only eigen values are $0$ and $1$. If $v$ is an eigen vector corresponding to the eigen value $1$, then $$A^2(v)=A(v)$$ Same holds for the zero eigen value.