# Checking if two matrices are similar

I have two matrices

$$\begin{pmatrix} 2 & 1 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix}$$

and $$\begin{pmatrix} 2 & 2 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix}$$

They are not diagonalizable. Share the same characteristic polynomial, the same trace, same determinant, eigenvalues, rank. What could I use more to say if they are similar or not?

• The matrices in this question are particularly simple, and similar by inspection as Henning Makholm shows. For the more general question of your title, you can compute their Rational Canonical Forms (which can be done using the Smith normal form over the ring $K[X]$ of polynomials) and see whether these are equal. Mar 4 '17 at 22:14

The first of your matrices is in Jordan canonical form, which must also be the Jordan canonical form of the second one (because the eigenvalue $2$ has algebraic multiplicity $2$ but geometric multiplicity $1$). So they are similar.
More concretely, we have $$\begin{pmatrix} 2 & 1 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} = \begin{pmatrix}1 \\ &2 \\ &&1 \end{pmatrix} \begin{pmatrix} 2 & 2 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{pmatrix} \begin{pmatrix}1 \\ &2 \\ &&1 \end{pmatrix}^{-1}$$
Although using Jordan Canonical forms are probably the fastest answer, it is possible to solve this question using brute force. We want to find out if there is an invertible matrix $P$ such that $$P \cdot \begin{pmatrix} 2 & 1 & 0\\ 0 & 2 & 0\\ 0 & 0 & 3 \end{pmatrix} = \begin{pmatrix} 2 & 2 & 0\\ 0 & 2 & 0\\ 0 & 0 & 3 \end{pmatrix} \cdot P.$$ Denoting $$P = \begin{pmatrix} a & b & c\\ d & e & f\\ g & h & i \end{pmatrix}$$ this is equivalent with stating that $$\begin{pmatrix} 2a & a + 2b & 3c\\ 2d & d + 2e & 3f\\ 2g & g + 2h & 3i \end{pmatrix} = \begin{pmatrix} 2a + 2d & 2b + 2e & 2c + 2f\\ 2d & 2e & 2f\\ 3g & 3h & 3i \end{pmatrix}.$$ Comparing corresponding entries, we find that: $$\begin{cases} 2a = 2a + 2d\\ a + 2b = 2b = 2e\\ 3c = 2c + 2f\\ 2d = 2d \\ d + 2e = 2e\\ 3f = 2f\\ 2g = 3g\\ g + 2h = 3h\\ 3i = 3i \end{cases}.$$ This is equivalent with $$\begin{cases} d = 0\\ a = 2e\\ c = 2f\\ 0 = 0\\ e = e\\ f = 0\\ g = 0\\ h = 0\\ 3i = 3i \end{cases}.$$ And from equation 3 and 6, we also have that $c = 0$. Therefore, we find that $$a = 2e, b = b, c = 0, d = 0, e = e, f = 0, g = 0, h = 0, i = i,$$ so we can take $b = 0$ and we find that $$P = \begin{pmatrix} 2 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{pmatrix}$$ since we had a free choice for $b, i$ but we want $P$ to be invertible, so we can't take $i = 0$ (but any other value will do) and we take $b = 0$ (so $P$ is clearly invertible).
So this is a way to find out if both matrices are similar or not (if you would have found a contradiction in the system, then they are not (or if the resulting matrix $P$ is not invertible they are also not similar). However, as I already mentioned: if you know about Jordan canonical form, always use this approach, since it is clearly much shorter!
• However, note that this was an easy case: your matrices contained a lot of zeros, which made it easy to solve this system of equations by inspection. However, in case there were less zeros, it would probably end up in a system of equations which you have to solve by row reducing (in this case) a $9 \times 9$- matrix. If you would have had two $4 \times 4$ matrices, you woud end up at reducing a $16 \times 16$ matrix, so this method becomes extremely awkward to perform whenever your matrices don't contain lots of zeros. Mar 4 '17 at 16:21