[Math] Some questions about similar matrices

computer-algebra-systemslinear algebramatrices

Two matrices $A$ and $B$ are similar, if and only if there exists an invertible matrix
$C$ with $A=C^{-1}BC$. A necessary condition for the similarity is, that the
characteristic polynomials coincide.

  • I read in one answer concerning similar matrices : If $A$ and $B$ are $2\times{2}$-matrices,
    they are similar if and only if they have the same characteristic polynomial
    and both are not a multiple of the identity matrix. Is this true and how can it
    be proven ?

  • In one answer it was stated that it is not easy to determine, if two matrices
    $A,B $ are similar. Isn't there an easy sufficient condition ?

  • How can I check similarity with PARI/GP ?

  • For example, the two random matrices

$$\begin {bmatrix}
2 & 7 & -8 \\
-8 & -4 & -3 \\
2 &-3 & -6
\end{bmatrix}$$

$$\begin {bmatrix}
-2 & -2 & -10 \\
7 & 0 & -3 \\
2 & 7 & -6
\end{bmatrix}$$

have the same characteristic polynomial.
Are they similar, and if yes, what is
the matrix $C$ doing the job ?

I know that there is already an answer to the question, when matrices are
similar. Nevertheless, I hope, that my question brings new aspects and
is therefore not marked as a duplicate.

Best Answer

If the two matrices are diagonalizable, then $$ \exists P_A\,:\,\,P_A^{-1} A P_A = D_A\\ \exists P_B\,:\,\,P_B^{-1} B P_B = D_B $$ with $D_A$ and $D_B$ diagonal matrices. $P_A$ and $P_B$ are simply the matrices whose columns are the eigenvectors of $A$ and $B$, respectively (I think that the columns in $P_B$ could be arranged to have the same ordering of the relative eigenvalues than $P_A$). If $A$ and $B$ are similar, then they have the same eigenvalues, so $D_A=D_B$, then $$ P_A^{-1}AP_A=P_B^{-1}BP_B\qquad\implies\qquad A=P_A P_B^{-1} B P_B P_A^{-1} $$ so the similarity matrix to change $B$ in $A$ is $C=P_B P_A^{-1}$.

If the matrices are not diagonalizable, then they have the same Jordan Normal Form, and the similarity matrix $P$ is built using generalized eigenvectors.

Related Question