Similarity between matrices. I have two matrices,
$A = \begin{pmatrix} 1&2\\3&4\end{pmatrix}$
$B =\begin{pmatrix} 1&2\\-1&-4\end{pmatrix}$
I need to check if A is similar to B.
I did by first computing the characterstic polynomial of the first one and the second one.
I got that $\det(t I-A) = t^2 -5t -2$
and $\det(t I-B) = t^2+3t-2$
Which means they are not similar. Please correct me if I'm wrong.
Also, I have another two matrices
$C = \begin{pmatrix} i\sqrt{2}&0&1 \\0&1&0 \\ 1&0&-i\sqrt{2}\end{pmatrix}$
$D = \begin{pmatrix} i&0&1 \\0&1&0 \\ 0&0&-i\end{pmatrix}$
And I need to check the similarity between them.
I got that:
$\det(t I-C) = (t-i)(t-1)(t+i)$
and $\det(t I-D) = (i\sqrt{2}t + 1)(t-1)$
Which makes them not similar. Are my characteristic polynomials wrong?
 A: To prove that these matrices are not similar, the easiest thing is to look at their traces: $A$ has trace $5$ while $B$ has trace $-3$, so they cannot be similar (since similar matrices always have equal traces). Thus one can avoid computing other coefficients of the characteristic polynomial (the trace is minus the subdominant coefficient of the characteristic polynomial, so here minus the coefficient of$~t$).
For the case of $C,D$ the traces are equal (both are $1$), as are the determinants (again both are $1$), so you might start to suspect these matrices are in fact similar. Two possibilities to complete the proof that they are, are:


*

*Their characteristic polynomials are equal: $\def\i{\mathbf i}t^3-t^2+t-1=(t-1)(t-\i)(t+\i)$, and have distinct roots, so that both matrices are diagonalsable with the same set of distinct diagonal entries.

*You can see that both matrices have an eigenspace for $\lambda=1$ (in fact the same eigenspace, spanned by $e_2$, though equality of the eigenspaces is irrelevant), and an invariant complementary subspace ($\langle e_1,e_3\rangle$); it suffices to check the matrices by which they act on the complementary subspace ($(\begin{smallmatrix}\i\sqrt2&1\\1&-\i\sqrt2\end{smallmatrix})$ and $(\begin{smallmatrix}\i&1\\0&-\i\end{smallmatrix})$) are similar, which again can be deduced from a computation (easier here) of the characteristic polynomials, which are equal and have simple roots. 
A: $A$ is similar to $B$ if for some $C$, $$A=CBC^{-1}$$
Hence if $A$ is similar to $B$, then $$ {\rm det}\ (tI- A)= {\rm det}\ (tI-B)$$
A: The first characteristic polynomial (A) is correct, the second (B) one must have a spelling error: I got $t^2 + 3t -2$. For C I calculated $-t^3+t^2-t+1$ and for D $-t^3+t^2-t+1$, so C and D are similar, so you've got a mistake there.
$(t - i) (t + i) (t - 1) = t^3-t^2+t-1$ so there you must have missed a minus. The other one cannot be correct since it has only two linear factors.
The method of calculating the polynomials is correct, but I think there are just some minor mistake. You can always check your answer with wolframalpha or another CAS.
A: Now, let's prove similar matrices have equal traces.

General proposition:
Let $A\in M_{mn}(\mathbb F)$ and $B\in M_{nm}(\mathbb F)$. Then $\operatorname{trace}(AB)=\operatorname{trace}(BA)$.
Note: $AB\in M_m(\mathbb F)$ and $BA\in M_n(\mathbb F)$.
As stated in previous answers, 
two matrices $A,B\in M_n(\mathbb F)$ are similar $\iff\exists S\in M_n(\mathbb F),\det S\ne 0$ s.t.
$$A=S^{-1}BS$$
$\operatorname{trace} A=\operatorname{trace}\left(S^{-1}BS\right)=\operatorname{trace}\left(\left(S^{-1}B\right)S\right)=\operatorname{trace}\left(S\left(S^{-1}B\right)\right)=\operatorname{trace}\left(SS^{-1}B\right)=\operatorname{trace} B$
