I have found the following example in Horn's and Johnson's Matrix Analysis book.
Let
$$A=\begin{bmatrix}
0&1&0&0\\
0&0&0&0\\
0&0&0&1\\
0&0&0&0
\end{bmatrix}$$
$$B=\begin{bmatrix}
0&1&0&0\\
0&0&1&0\\
0&0&0&0\\
0&0&0&0
\end{bmatrix}$$
The two matrices have the same eigenvalues (characteristic polynomial), trace, determinant and rank. But since $A^2=0$ and $B^2\neq0$, we can conclude that they are not similar. Can you explain me the last claim i.e. why it implies that they cannot be similar? Please cite relevant theorems or lemmas.
[Math] An example of non-similar matrices with same eigenvalues, rank and determinant
determinanteigenvalues-eigenvectorslinear algebramatrix-ranktrace
Best Answer
Suppose $A^2=0$ and $B^2 \neq 0$ but $B=P^{-1}AP$
then $B^2=P^{-1}A^2P=0$ which is a contradiction.