TITLE: Showing that similar matrices have the same minimal polynomial
QUESTION [5 upvotes]: I am in the process of proving the title.
The hint says, for any polynomial $f$, we have $$f(P^{-1}AP) = P^{-1}f(A)P.$$ A is an $n \times n$ matrix over $F$ while $P$ is an invertible matrix such that the above matrix multiplication $P^{-1}AP$ makes sense.
Why is this true? 
Thank you.

REPLY [4 votes]: if $f$ is a polynomial then you have:
$$f(x)=a_nx^n+...+a_1x+a_0$$
Then you have
$$f(P^{-1}AP)=a_n(P^{-1}AP)^n+...+a_1(P^{-1}AP)+a_0I$$
which is
$$f(P^{-1}AP)=a_n(P^{-1}APP^{-1}AP...P^{-1}AP)+...+a_1(P^{-1}AP)+a_0P^{-1}IP$$
or
$$f(P^{-1}AP)=P^{-1}a_nA^nP+...+P^{-1}a_1AP+a_0P^{-1}IP$$
which finally gives
$$f(P^{-1}AP)=P^{-1}(a_nA^n+...+a_1A+a_0I)P=P^{-1}f(A)P$$