Some questions about similar matrices 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.
 A: 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.
A: It is necessary to have the same characteristic and minimal polynomials, but even this is not sufficient once dimension is at least 4.
As you can confirm with gp-pari, for both matrices below, the characteristic polynomial is $(x-3)^4$ and the minimal polynomial is $(x-3)^2.$ However, they are not similar, the Jordan normal forms are different. The exponents in the minimal polynomial tell us only the size of the largest Jordan block with a given eigenvalue. They do not tell us the full partition of Jordan block sizes. Below, for $A$ we have $2 + 2$ but for $B$ we have $1+1+2.$ 
$$ A \; = \;  
 \left(  \begin{array}{cccc}
 3  &  1  &  0  &  0 \\
 0  &  3   &  0  &  0 \\
 0  &  0  &  3   &  1  \\ 
 0  &  0  &  0   &  3  
\end{array} 
  \right).
  $$
$$ B \; = \;  
 \left(  \begin{array}{cccc}
 3  &  0  &  0  &  0 \\
 0  &  3   &  0  &  0 \\
 0  &  0  &  3   &  1  \\ 
 0  &  0  &  0   &  3  
\end{array} 
  \right).
  $$
I do not see how to get such an example in dimension 3 or 2, so in those dimensions characteristic and minimal polynomials suffice. Note that these examples are not diagonalizable, they are already in Jordan Normal Form, these are the best that can be done. 
