<s>[INST] Checking if two matrices are similar I have two matrices 
$$ \begin{pmatrix}
  2 & 1 & 0 \\
  0 & 2 & 0 \\
  0 & 0 & 3
 \end{pmatrix} $$
and $$ \begin{pmatrix}
  2 & 2 & 0 \\
  0 & 2 & 0 \\
  0 & 0 & 3
 \end{pmatrix} $$
They are not diagonalizable. Share the same characteristic polynomial, the same trace, same determinant, eigenvalues, rank. What could I use more to say if they are similar or not?
 [/INST] The first of your matrices is in Jordan canonical form, which must also be the Jordan canonical form of the second one (because the eigenvalue $2$ has algebraic multiplicity $2$ but geometric multiplicity $1$). So they are similar.
More concretely, we have
$$ \begin{pmatrix}
  2 & 1 & 0 \\
  0 & 2 & 0 \\
  0 & 0 & 3
 \end{pmatrix} = 
  \begin{pmatrix}1 \\ &2 \\ &&1 \end{pmatrix} 
\begin{pmatrix}
  2 & 2 & 0 \\
  0 & 2 & 0 \\
  0 & 0 & 3
 \end{pmatrix} 
  \begin{pmatrix}1 \\ &2 \\ &&1 \end{pmatrix}^{-1} 
$$
</s>