Derivation of transformation law for square matrices

Let $\v v = A\v u$. Denote $\v u$ and $\v v$ be the components expressed in the old basis, and $\v u'$ and $\v v'$ be the components expressed in the new basis.

So using the transformation law for vectors, $$\begin{align*} \v v &= A\v u \\ Q\v v' &= AP\v u' \\ \v v' &= Q\inv AP\v u' \equiv A'\v u'. \end{align*}$$ Note that $Q\inv$ exists since columns of $R$ are the basis vectors, which are linearly independent.

Hence $$ A' = Q\inv AP. $$