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.
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)$$