# Given similar matrices $A$ and $B$, how to find $M$ such that $B=M^{-1}AM$?

I am trying to teach myself linear algebra using Strang's Introduction to Linear Algebra. I would like to know what the most (or more) efficient way to solve this problem is by hand.

The question:

Show that A and B are similar by finding M so that $B = M^{-1} A M$:

$$A = \begin{bmatrix} 1 &&2\\ 3 &&4\end{bmatrix}$$

$$B = \begin{bmatrix} 4 &&3\\ 2 &&1\end{bmatrix}$$

The solution given by the textbook is:

$$B = \begin{bmatrix} 4 &&3\\ 2 &&1\end{bmatrix} = \begin{bmatrix} 0 &&1\\ 1 &&0\end{bmatrix}^{-1} \begin{bmatrix} 1 &&2\\ 3 &&4\end{bmatrix} \begin{bmatrix} 0 &&1\\ 1 &&0\end{bmatrix}$$

My impulse was to first try and diagonalize $A = S\Lambda S^{-1}$ and $B = J\Lambda J^{-1}$ to take $\Lambda = S^{-1}AS = J^{1}BJ$ => $B = JS^{-1}ASJ^{-1} = M^{-1}AM$. I found the eigenvalues to be $\frac {5 \pm \sqrt{33}}2$. I then tried to find the eigenvector matrix S for A and eigenvector J for B, whereupon I would take $J^{-1} = \frac 1{det(J)} J$ and multiply $SJ^{-1} = M$.

In matlab this seems like it would do the right thing, however on paper it is very laborious and as I am not very good at hand-calculating things, I worry that I would make computational mistakes or run out of time if I had to do this problem on an exam. What are some strategies for doing this kind of problem more efficiently? I assume that since I am self-studying, there is a strong possibility that I am doing this completely wrongheadedly and that there is a much simpler way available.

• you said you wanted to compute by hand. what is matlab doing there? – abel Dec 14 '14 at 3:22
• Sometimes doing things in the most general way possible (the way you did it, which is completely fine by the way) is not the best way to do it. In this case, you can tell that the numbers are somehow permuted. Looking to permutation matrices is should be the first approach here. – Cameron Williams Dec 14 '14 at 3:24
• Finding a similarity transformation, even when one knows (e.g. by checking the eigenvalues) that two matrices are similar, is not always an easy task. The case you asked about is special in that the entries of $A$ and $B$ are the same, just rearranged. That would be a clue to try the permutation matrices shown in the book's answer. – hardmath Dec 14 '14 at 3:32
• Thanks all! I see now that I could have arrived at the book's solution by trying the permutation matrices. (I was just using matlab to check the work I had done by hand since I had it open for something else already anyway.) – qirindash Dec 14 '14 at 5:20