Check if two square matrices are similar. Check if matrices $A=        \begin{bmatrix}
        1 & 1 & 5 \\
        0 & 2 & 0 \\
        0 & 0 & 2 \\
        \end{bmatrix}$ and $B=\begin{bmatrix}
        1 & 7 & 0 \\
        0 & 2 & 7 \\
        0 & 0 & 2 \\
        \end{bmatrix}$ are similar.
Is it sufficient to show that $A$ and $B$ have the same characteristic polynomial $p_A(\lambda)=p_B(\lambda)=(1-\lambda)(2-\lambda)^2$?
If $p_A(\lambda)=p_B(\lambda)$, then $A$ and $B$ are similar matrices.
 A: In general it is not sufficient to check the characteristic polynomial to make sure that two matrices are similar. In order to be similar, there needs to exist an invertible matrix $P$ such that $A = P^{-1}B P$. 
If two matrices are similar and one of them is diagonalizible (say, $B=Q^{-1}DQ$), then $A$ is automatically diagonalizible, too (by means of $QP$).
This means: If you have two matrices with the same eigenvalues (this is equivalent to them having the same characteristic polynomial), then it can still happen that they are not similar, since one is diagonalizble and the other is not. 
Consider $A = \begin{pmatrix} 0 & 0 \\ 0&0 \end{pmatrix}$ and $B = \begin{pmatrix} 0 & 1 \\ 0&0 \end{pmatrix}$, which have the same eigenvalues, but $B$ isnt diagonalizble and hence, can't be zero.
On the other hand, you can enhance your approach: If you calculate the characteristic polynomial and you can show that each matrix is diagonalizible, then the $A$ and $B$ are similar indeed (because they are both similar to the same diagonal matrix). Here, you have to check that both matrices have a two-dimensional eigenspace for the eigenvalue zero.
For some cases, it does suffice to compare the characteristic polynomials: When $A$ and $B$ are self-adjoint (symmetric in the real case) or when all of the eigenvalue have algebraic multiplicity $1$.
