on page 285, of SCHAUM's "linear algebra" second edition, by Lipschutz, it says
Suppose matrix A can be diagonalized as above, say $P^{-1} A P = D$ where $D$ is diagonal. Then $A$ has the extremely useful diagonal factorization $$ A=PDP^{-1} $$ Using this factorization, the algebra of $A$ reduces to the algebra of the diagonal matrix $D$. .... and more generally, for any specific polynomial $f(t)$ $$ f(A) = f(P D P^{-1}) = P f(D) P^{-1} $$
My question is on the polynomial part above. How do you go from $f(P D P^{-1})$ to $P f(D) P^{-1}$?
I only knew about the relation $A^m = (P D P^{-1})^m = P D^m P^{-1}$ which is easy to show. I am not sure how it follows for any polynomial $f(t)$ as well.
$p(A) = \sum_{m=0}^r\alpha_mA^m$. That's all you need.