TITLE: How to compute the similarity transformation matrix
QUESTION [6 upvotes]: Stuck on this question:

Let $$A=\begin{pmatrix}
2&1\\
-1&-1
\end{pmatrix}$$$$B=\begin{pmatrix}
-2&5\\
-1&3
\end{pmatrix}$$$$C=\begin{pmatrix}
5&2\\
4&1
\end{pmatrix}$$
  Show that A is similar to B, but that A is not similar to C.

I can do the second part of the question as $det(A)\neq\det(C)$, therefore as similar matrices have the same determinant $A\nsim C$. I also understand that I need to find $P$ such that $AP=PB$ for the first part but have no idea how I would go about finding it.Would anyone be able to provide an answer and explanation of the method used?
Thanks
Edit:Had a look at the solution from the textbook, it gives $$P=\begin{pmatrix}
2&3\\
1&1
\end{pmatrix}$$

REPLY [10 votes]: In order to find your $P$, you can do as follows:

First, you find a diagonal matrix $D$ to which both $A$ and $B$ are equivalent. For this, you need to find the eigenvalues of both matrices and if they coincide, they are equivalent. (The general case would be more involved: but in yours, both matrices diagonalize easily.)
Then you have to find bases of eigenvectors for both matrices and form with them change of bases matrices $S$ and $T$ such that

$$
D = S^{-1}A S \qquad \text{and} \qquad D = T^{-1}BT \ .
$$

Now you'll have

$$
S^{-1}A S = T^{-1}BT \qquad \text{and hence} \qquad AST^{-1} = ST^{-1}B \ .
$$
So $ST^{-1}$ will be your matrix $P$.