# Which matrix $P$ makes two matrices $A$ and $B$ similar

Two square matrices $A,\ B$ are similar if $\exists P : PAP^{-1} = B$. In order to find $P$ for two given $A,\ B$ one can try to solve $PA-BP = 0$. I worked out this equation for abstract $3 \times 3$ matrices:

$A = \left(\begin{matrix}a_{00} & a_{01} & a_{02}\\a_{10} & a_{11} & a_{12}\\a_{20} & a_{21} & a_{22}\end{matrix}\right),\ B = \left(\begin{matrix}b_{00} & b_{01} & b_{02}\\b_{10} & b_{11} & b_{12}\\b_{20} & b_{21} & b_{22}\end{matrix}\right),\ P = \left(\begin{matrix}p_{00} & p_{01} & p_{02}\\p_{10} & p_{11} & p_{12}\\p_{20} & p_{21} & p_{22}\end{matrix}\right)$

If one considers $3 \times 3$ matrices as vectors of a $9$ dimensional vector space, using the following matrix expressions:

$PA \mapsto \left(\begin{matrix}a_{00} & a_{10} & a_{20} & 0 & 0 & 0 & 0 & 0 & 0\\a_{01} & a_{11} & a_{21} & 0 & 0 & 0 & 0 & 0 & 0\\a_{02} & a_{12} & a_{22} & 0 & 0 & 0 & 0 & 0 & 0\\0 & 0 & 0 & a_{00} & a_{10} & a_{20} & 0 & 0 & 0\\0 & 0 & 0 & a_{01} & a_{11} & a_{21} & 0 & 0 & 0\\0 & 0 & 0 & a_{02} & a_{12} & a_{22} & 0 & 0 & 0\\0 & 0 & 0 & 0 & 0 & 0 & a_{00} & a_{10} & a_{20}\\0 & 0 & 0 & 0 & 0 & 0 & a_{01} & a_{11} & a_{21}\\0 & 0 & 0 & 0 & 0 & 0 & a_{02} & a_{12} & a_{22}\end{matrix}\right)\left(\begin{matrix}p_{00}\\p_{01}\\p_{02}\\p_{10}\\p_{11}\\p_{12}\\p_{20}\\p_{21}\\p_{22}\end{matrix}\right)$

$BP \mapsto \left(\begin{matrix}b_{00} & 0 & 0 & b_{01} & 0 & 0 & b_{02} & 0 & 0\\0 & b_{00} & 0 & 0 & b_{01} & 0 & 0 & b_{02} & 0\\0 & 0 & b_{00} & 0 & 0 & b_{01} & 0 & 0 & b_{02}\\b_{10} & 0 & 0 & b_{11} & 0 & 0 & b_{12} & 0 & 0\\0 & b_{10} & 0 & 0 & b_{11} & 0 & 0 & b_{12} & 0\\0 & 0 & b_{10} & 0 & 0 & b_{11} & 0 & 0 & b_{12}\\b_{20} & 0 & 0 & b_{21} & 0 & 0 & b_{22} & 0 & 0\\0 & b_{20} & 0 & 0 & b_{21} & 0 & 0 & b_{22} & 0\\0 & 0 & b_{20} & 0 & 0 & b_{21} & 0 & 0 & b_{22}\end{matrix}\right)\left(\begin{matrix}p_{00}\\p_{01}\\p_{02}\\p_{10}\\p_{11}\\p_{12}\\p_{20}\\p_{21}\\p_{22}\end{matrix}\right)$

the equation to solve can be expressed as: $$(I \otimes A^t - B \otimes I)p = 0$$

Where $\otimes$ stands for the Kronecker product of square matrices and $I$ is the identity matrix. The question is if this can be proven for arbitrary dimensions?

• An alternative approach. $A$, $B$ similar, they have the same Jordan form, call it $J$, there are constructive ways to find $Q$, $R$ such that $QAQ^{-1}=J$ and $RBR^{-1}=J$. Then $QAQ^{-1}=RBR^{-1}$, so $PAP^{-1}=B$, where $P=R^{-1}Q$. – Gerry Myerson Apr 21 '17 at 9:23
• @GerryMyerson: ndeed, but how are the $Q, R$ calcultaed without calculating the eigenvalues? – Marc Bogaerts Apr 23 '17 at 15:49
• They aren't – was that a requirement? I don't see anything in the body of the question forbidding eigenvalue calculations. – Gerry Myerson Apr 23 '17 at 23:39

Yes this is true. You need to use the $vec$ operator
$vec(ABC)=(C^T\otimes A)vec(B)$
Hence $$vec(PA-BP)=vec(PA)-vec(BP)=(A^T\otimes \mathbb{I}-\mathbb{I}\otimes B)vec(P)=0$$ Note that the $vec$ operator vectorizes along columns not rows. This explains the difference with your notation.