To show two matrices are conjugate to each other Given two matrices A and B
$$
A = 
\begin{pmatrix} 1 & 0 & 0 \\ 1 & 3 & 0 \\ 1 & 2 & 1 \end{pmatrix}, \quad
B =
\begin{pmatrix} 3 & 0 & 4 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix} 
$$
I have checked  basic properties such as trace, charatersitic polynomial and  are same .
I also realise that i need to find the  P
Such that $A=P^{-1}BP $
But how do i find P ? Thanks
 A: If the two matrix $A$ and $B$ are similar then they are similar to the same Jordan matrix $J$; so find the change matrices $S$ and $T$ such that
$$A=SJS^{-1}\quad;\quad B=TJT^{-1}$$
so
$$A=ST^{-1}BTS^{-1}$$
and then we have $P=TS^{-1}$.
A: Suppose, you have 
$$A=S^{-1}DS$$
and
$$B=T^{-1}DT$$
Then we have $$D=TBT^{-1}$$
So, we get
$$A=S^{-1}TBT^{-1}S$$
So, with $$P:=T^{-1}S$$
you have the required transformation.
A: Compute the eigenvalues of $A$ and $B$. These are of course $1, 1, 3$.
Compute eigenvectors of $A$. These are
$$
\begin{bmatrix}-2\\1\\0\end{bmatrix},
\begin{bmatrix}0\\0\\1\end{bmatrix},
\begin{bmatrix}0\\1\\1\end{bmatrix},
$$
where the first two are relative to $1$, and the third to $3$.
Simlarly for $B$ one has
$$
\begin{bmatrix}0\\1\\0\end{bmatrix},
\begin{bmatrix}-2\\0\\1\end{bmatrix},
\begin{bmatrix}1\\0\\0\end{bmatrix}.
$$
Then you build matrices with the eigenvectors as columns
$$
\alpha
=
\begin{bmatrix}-2&0&0\\1&0&1\\0&1&1\end{bmatrix},
$$
and
$$
\beta
=
\begin{bmatrix}0&-2&1\\1&0&1\\0&1&0\end{bmatrix}.
$$
You will have
$$
\alpha^{-1} A \alpha 
=
\begin{bmatrix}1\\&1\\&&3
\end{bmatrix}
=
\beta^{-1} B \beta,
$$
where I have omitted zeroes.
Therefore
$$
B = (\alpha \beta^{-1})^{-1} A \alpha \beta^{-1}.
$$
