Find the values of $a$ and $b$ such that the following matrices are similar.
$$A=\begin{bmatrix} -2& 0 & 0 \\ 2 & a & 2 \\ 3& 1 & 1 \end{bmatrix}, \qquad B=\begin{bmatrix} -1& 0 & 0 \\ 0 & 2 & 0 \\ 0& 0 & b \end{bmatrix}$$
I know that similar matrices must have the same ranks. Hence, I can take that value of $a$ as any real number and $b \neq 0$. Is my answer is true or false? Any hints or solutions will be appreciated. Thank you.
If two matrices are similar, then they have the same characteristic polynomials. The characteristic polynomials of your matrices are$$-x^2+(a-1)x^2+(a+4)x+4-2a\text{ and }-x^3+(b+1)x^2+(-b+2)x-2b$$respectively. They are equal if and only if $a=0$ and $b=-2$. On the other hand, in this case the matrices have three distinct eigenvalues (the same for both). Therefore, they're similar.