Does $P^{-1} A P = P P^{-1} A$? I hung up on the following step in a derivation I'm following and could use some guidance as to why it's true. I'm trying to show that the trace of a matrix is invariant under any similarity transformation, and I'm not sure why this step is legal. 
\begin{align}
    \text{Tr} (\mathbf{B}) = \text{Tr} (\mathbf{P}^{-1}\mathbf{AP}) =\text{Tr} (\mathbf{PP}^{-1}\mathbf{A})
\end{align}
From there, it's simply the identity matrix and therefore the matrix $\mathbf A$ is invariant under similarity transformations. But, matricies are not commutative. So, I'm not sure  the right hand side is true. 
 A: It is true because, for any two $n\times n$ matrices $A$ and $B$, $\operatorname{tr}(AB)=\operatorname{tr}(BA)$.
A: With Einstein's notation, we have that
$$\text{Tr}(AB)=A_{ij}B_{ji}=B_{ji}A_{ij}=\text{Tr}(BA)$$
And for 3 matrices:
$$\text{Tr}(ABC)=A_{ij}B_{jk}C_{ki}=C_{ki}A_{ij}B_{jk}=\text{Tr}(CAB)$$
A: Let $U=(U_{ij})_{n\times n}$ and $V=(V_{ij})_{n\times n}$  such that $V=P^{-1}$ and $U=P$. We have 
\begin{align}
UAV
=&
(U_{ij})_{n\times n}
\cdot 
(A_{ij})_{n\times n}
\cdot 
(V_{ij})_{n\times n}
\\
=&
\left(\sum_{k=1}U_{ik}\cdot A_{kj}\right)_{n\times n}
\cdot
(V_{ij})_{n\times n}
\\
=&
\left(\sum_{\ell=1}^{n}\big(\sum_{k=1}^nU_{ik}\cdot A_{k\ell}\big)\cdot V_{\ell j}\right)_{n\times n}
\\
=&
\left(\sum_{\ell=1}^{n}\sum_{k=1}^nU_{ik}\cdot A_{k\ell}\cdot V_{\ell j}\right)_{n\times n}
\end{align}
Then $U=P$ and $V=P^{-1}$ implies $UV=(U_{i\ell})_{n\times n}\cdot(V_{i\ell})_{n\times n}=(\sum_{k=1}^{n}U_{ik}V_{k\ell})_{n\times n}=I$. More explicitly,
$$
\sum_{k=1}^{n}U_{ik}V_{k\ell}=\begin{cases} 1 & \mbox{if } i=\ell\\ 0 & \mbox{if } i\neq \ell\end{cases}
$$
With this in mind we obtain the identitie below
\begin{align}
\mbox{trace}(UAV)
=&
\sum_{i=1}^{n} \sum_{\ell=1}^{n}\sum_{k=1}^n
U_{ik}\cdot A_{k\ell}\cdot V_{\ell i}
\\
=&
\sum_{k=1}^n \sum_{\ell=1}^{n} \Big(\sum_{i=1}^{n}  
U_{ik}\cdot V_{\ell i}\Big)\cdot A_{k\ell}
\\
=&
\sum_{k=1}^n  A_{k k}
\end{align}
In an entirely analogous way
\begin{align}
UVA
=&
(U_{ij})_{n\times n}
\cdot 
(V_{ij})_{n\times n}
\cdot 
(A_{ij})_{n\times n}
\\
=&
\left(
\sum_{r=1}U_{ir}\cdot V_{rj}\right)_{n\times n}
\cdot
(A_{ij}
)_{n\times n}
\\
=&
\left(
\sum_{s=1}^{n}\big(\sum_{r=1}^n
U_{ir}\cdot V_{rs}\big)\cdot A_{s j}
\right)_{n\times n}
\\
=&
\left(
\sum_{s=1}^{n}\sum_{r=1}^n
U_{ir}\cdot V_{rs}\cdot A_{s j}
\right)_{n\times n}
\end{align}
implies 
$$
\mbox{trace}(UVA)=
\sum_{t=1}^{n}\sum_{s=1}^{n}\sum_{r=1}^n
U_{tr}\cdot V_{rs}\cdot A_{st}
=\sum_{t=1}^{n} A_{tt}
$$
