How can we find a condition on $a$ so that there exists a regular matrix $P$ s.t. $B=P^{-1}AP$ $$ A=\begin{pmatrix} 4 & 1 & 1 \\ -1 & 1 & 0 \\  -2 & -1 & 0 \\ \end{pmatrix}, \, \, B=\begin{pmatrix} 0 & 1 & 0 \\ -3 & 4 & 0 \\  a & 2 & 1 \\ \end{pmatrix} $$
How can we find a condition on $a$ so that there exists a regular matrix $P$ s.t. $B=P^{-1}AP$
Answer:
$$(1- \lambda)^2( \lambda -3)=0$$
Eigenvalues are
 $ \lambda_1 =1$ and $  \lambda_2= 3$ .
Corresponding eigenvectors are 
$$v_1=\begin{pmatrix} 0 \\ 1 \\  -1 \\ \end{pmatrix},   v_2=\begin{pmatrix} 0 \\ 0 \\  0 \\ \end{pmatrix} ,  v_3=\begin{pmatrix} -2 \\ 1 \\  1\\ \end{pmatrix} $$
$B=P^{-1}AP$ implies the similarity of $A$ and $B$. 
Since $A$ and $B$ are similar, $B$ has the same eigenvalues as $A$
Then how can we find the condition on $a$?

$(A-I)(A-3I)\not=0,(A-I)^2(A-3I)=0$ and $(B-I)(B-3I)=(a+2)\begin{pmatrix}0&0&0\\0&0&0\\-3&1&0\end{pmatrix},(B-I)^2(B-3I)=0$.
Thus $A,B$ are similar iff $a\not=-2$.
