# How to tell if two matrices are similar? [duplicate]

Two n-by-n matrices A and B are called similar if $$\! B = P^{-1} A P$$ for some invertible n-by-n matrix P.

Similar matrices share many properties:

• Rank
• Determinant
• Trace
• Eigenvalues (though the eigenvectors will in general be different)
• Characteristic polynomial
• Minimal polynomial (among the other similarity invariants in the Smith normal form)
• Elementary divisors

Given two square matrices A and B, how would you tell if they are similar?

1. Constructing a $P$ in the definition seems difficult even if we know they are similar, does it? Not to mention, use this way to tell if they are similar.
2. Are there some properties of similar matrices that can characterize similar matrices?

Thanks!

-

## marked as duplicate by Timere, M Turgeon, Algebraic Pavel, user127.0.0.1, T. Bongers May 12 '14 at 22:15

You can have a look here: Frobenius noral form. – Dan Shved Nov 27 '12 at 15:36
@DanShved: Thanks! So decomposing each matrix into some canonical form, such as Jordan form, is a way, by definition. – Tim Nov 27 '12 at 15:38
I think for finite dimensional spaces characteristic polynomials are the best. – Hui Yu Nov 27 '12 at 15:41
@HuiYu They are OK, but they don't allow to characterize similarity completely. I.e. two non-similar matrices can have the same characteristic polynomial. – Dan Shved Nov 27 '12 at 15:43

See a pedagogical discussion here. The author essentially proposes a generalized eigenspace approach (see lemma 1), so that no matrix transformation is needed.

-

Two diagonalizable matrices are similar iff all of their eigenvalues are equal. To prove this, let $A = Q \Lambda Q^{-1}$ and $B = P^{-1}AP$, then $B = R \Lambda R^{-1}$ with $R = P^{-1}Q$. Conversely, $A = Q \Lambda Q^{-1}$ and $B = R \Lambda R^{-1}$ imply $B = RQ^{-1} A Q R^{-1} = P^{-1} A P$ and this completes the proof.

Thus, you can diagonalize $A$ and $B$ and verify that all of their eigenvalues are equal in order to determine whether or not the matrices are similar.

If $A$ and $B$ are similar, they will share properties such as the rank and trace as you mention. However, the converse statement is not true. Hence, you cannot use only properties such as the rank and trace to establish similarity between two matrices.

-
+1. Thanks! I wonder why Dan Shved said in his comment that characteristic polynomials "don't allow to characterize similarity completely"? Don't characteristic polynomials determine all eigenvalues with their algebraic multiplicities, and then by your reply, characteristic polynomials determine whether two matrices are similar? – Tim Dec 2 '12 at 1:09
I think the reason is that in general we need Jordan forms of the two matrices to tell if they are similar. Eigenvalues and their algebraic multiplicities are not enough. – Tim Dec 2 '12 at 1:47
@Tim: If the matrix is not diagonalizable, then you would need the Jordan canonical form. Since this form is also obtained via a similarity transformation, what I wrote above still applies (just consider $\Lambda$ as the Jordan form of the matrix). As you note, Dan Shved commented that characteristic polynomials "don't allow to characterize similarity completely". I am not sure about this neither, but if someone else can clarify then he or she would be helping us both. – Goku Dec 4 '12 at 3:13
This answer is wrong. For example, the identity matrix and [1, 1; 0 , 1] both have eigenvalues 1, but they are not similar. The issue is that same set of eigenvalues do NOT guarantee the same Jordan form. To get same Jordan form, you need same algebraic multiplicity and geometric multiplicity. Characteristic polynomial only carries information about algebraic multiplicity, but not the geometric one, thus is not sufficient to characterize similarity. – user27126 Dec 4 '12 at 3:18
In fact, (at least to me) one great thing about various canonical form is to allow you to identify similar matrices. If your field is algebraically closed, eg complex numbers, then Jordan canonical form is one such construction. Over an arbitrary field, you may read about the rational canonical form, that was mentioned by Dan Shved in the comments. – user27126 Dec 4 '12 at 3:22