I am having trouble with a proof of the Hamilton-Cayley theorem (in the case the square matrix is diagonalisable).
$$ A=SDS^{-1} $$ $$ p_{A}(A)=(A-\lambda _{1}I)^{r_{1}}...(A-\lambda _{k}I)^{r_{k}} $$ $$ p_{A}(A)=S(D-\lambda _{1}I)^{r_{1}}...(D-\lambda _{k}I)^{r_{k}}S^{-1} $$
Where D is the diagonal matrix, the lambdas are the eigenvalues and p_A(A) is the characterstic polynomial of A.
In perticular I am having trouble understanding why when you replace A with SDS^-1 you can just take S and S^-1 out of the parentheses.