A Practical Strategy for Comparing Matrices
Two matrices can look different while describing the same linear operator in different bases. The useful question is not whether their entries match, but whether a change of coordinates relates them. In a matrix-pair problem, a good strategy is to test inexpensive invariants first, look for a basis change suggested by the operator or the matrices, and then verify the proposed change by multiplication.
Throughout, matrices are over \(\mathbb{R}\). Similarity is defined for square matrices of the same size. For an \(n\times n\) matrix \(\mathbf{A}\), its rank is the dimension of its column space, its trace is the sum of its diagonal entries, and its characteristic polynomial is \(p_{\mathbf{A}}(\lambda)=\det(\mathbf{A}-\lambda\mathbf{I}_n)\).
The earlier results on similarity show that similar matrices have the same rank, determinant, trace, and characteristic polynomial. These are necessary tests: if even one differs, the matrices are not similar. Passing all the tests does not prove similarity. For a positive conclusion, produce an invertible \(\mathbf{P}\) and check the defining equation.
Proof. If \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\), multiply on the right by \(\mathbf{P}\). Since \(\mathbf{P}^{-1}\mathbf{P}=\mathbf{I}_n\), this gives \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\). Conversely, suppose \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\). Multiplying on the right by \(\mathbf{P}^{-1}\) gives \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\), as required. The invertibility hypothesis is essential for both the similarity definition and the reverse step. \(\square\)
The equation \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\) is often easier to check than computing \(\mathbf{P}^{-1}\). It also explains the basis interpretation: if the columns of \(\mathbf{P}\) are basis vectors expressed in the coordinates used for \(\mathbf{A}\), then \(\mathbf{A}\mathbf{P}\) gives the images of those basis vectors. The columns of \(\mathbf{P}\mathbf{B}\) give the same images by first applying the coordinate matrix \(\mathbf{B}\), then translating the resulting coordinates into the ambient coordinates.
Screen First: Rejecting a Pair Efficiently
Worked Example: Equal Trace and Determinant Are Not Enough
Decide whether the matrices
are similar. Start with trace and determinant. The diagonal entries give \(\operatorname{tr}\mathbf{A}=1+1+0=2\) and \(\operatorname{tr}\mathbf{B}=2+0+0=2\). Both determinants are zero because each matrix has a zero row. Thus these two tests do not rule out similarity.
Now compare ranks. The columns of \(\mathbf{A}\) are \((1,0,0)^{\top}\), \((0,1,0)^{\top}\), and \(\mathbf{0}\), so \(\operatorname{rank}\mathbf{A}=2\). The columns of \(\mathbf{B}\) are \((2,0,0)^{\top}\), \(\mathbf{0}\), and \(\mathbf{0}\), so \(\operatorname{rank}\mathbf{B}=1\). Rank is preserved under similarity, so \(\mathbf{A}\) and \(\mathbf{B}\) are not similar.
Conclusion: Equal trace and determinant are compatible with non-similarity. The rank test rejects this pair, so there is no need to search for a change-of-basis matrix.
This is the efficient use of invariants: stop as soon as one necessary condition fails. If the basic tests agree, that is a reason to continue—not a reason to declare the matrices similar.
Use a Basis Change When Its Columns Are Available
A proposed basis change can come from a basis that makes the action of an operator easier to describe. Suppose \(\mathbf{B}\) is the matrix of an operator in that basis and \(\mathbf{A}\) is its matrix in the ambient coordinates. Put the basis vectors, written in ambient coordinates, into the columns of \(\mathbf{P}\). The coordinate interpretation gives \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\). The next example carries out both sides so the proposed relationship is checked rather than assumed.
Worked Example: Verify a Basis Change by Multiplication
Consider the matrices
The columns of \(\mathbf{P}\) are the basis vectors in ambient coordinates. First check that the basis change is invertible by computing
To find the matrix in ambient coordinates, compute \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\). The first multiplication is
Multiplying by \(\mathbf{P}^{-1}\) gives
Now check the defining equation directly. Multiplication on the right by \(\mathbf{P}\) gives
The product already computed is \(\mathbf{P}\mathbf{B}=\begin{bmatrix}2&3&1\\0&2&1\\0&0&3\end{bmatrix}\), so \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\). Since \(\mathbf{P}\) is invertible, the theorem proves that \(\mathbf{A}\) and \(\mathbf{B}\) are similar.
When the Change of Basis Is Not Obvious
If no useful basis is visible, the equation \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\) can be treated as a system of linear equations in the entries of \(\mathbf{P}\). A solution is only a candidate: it must also be invertible. If every solution is singular, this method has not produced a similarity. The next example shows the full check on a small pair.
Worked Example: Solve for a Similarity Matrix
For
let \(\mathbf{P}=\begin{bmatrix}a&b\\c&d\end{bmatrix}\) and solve \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\). The two products are
Equating corresponding entries gives \(c=b\), \(d=0\), and \(2c=2c+d\); the last equation is consistent with \(d=0\). Choose \(b=c=1\) and \(a=0\). Then
So \(\mathbf{P}\) is invertible. Verify the equation with the selected entries:
and
The products agree and \(\mathbf{P}\) is invertible, so \(\mathbf{A}\) and \(\mathbf{B}\) are similar.
More Tests After the Basic Invariants
Similarity also respects powers. This provides another way to compare matrices that survive the rank, trace, determinant, and characteristic-polynomial tests.
Proof. Similarity gives \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\). For \(k=0\), \(\mathbf{A}^0\mathbf{P}=\mathbf{I}_n\mathbf{P}=\mathbf{P}=\mathbf{P}\mathbf{I}_n=\mathbf{P}\mathbf{B}^0\). Now suppose \(\mathbf{A}^k\mathbf{P}=\mathbf{P}\mathbf{B}^k\). Then associativity of matrix multiplication gives \(\mathbf{A}^{k+1}\mathbf{P}=\mathbf{A}(\mathbf{A}^k\mathbf{P})=\mathbf{A}(\mathbf{P}\mathbf{B}^k)=(\mathbf{A}\mathbf{P})\mathbf{B}^k=(\mathbf{P}\mathbf{B})\mathbf{B}^k=\mathbf{P}\mathbf{B}^{k+1}\). Induction proves the identity for all \(k\geq0\). If \(\mathbf{B}^k=\mathbf{O}\), then \(\mathbf{A}^k\mathbf{P}=\mathbf{O}\). Multiplying on the right by \(\mathbf{P}^{-1}\) gives \(\mathbf{A}^k=\mathbf{O}\). \(\square\)
Worked Example: Matching Basic Invariants but Failing a Power Test
Consider
Both matrices have zero diagonal, so both traces are \(0\). Both are strictly upper triangular, have zero determinant, and have characteristic polynomial \(\lambda^4\): in each case \(\mathbf{C}-\lambda\mathbf{I}_4\) or \(\mathbf{D}-\lambda\mathbf{I}_4\) is upper triangular with diagonal entries \(-\lambda\), so its determinant is \((-\lambda)^4=\lambda^4\). Each matrix has rank \(2\): the nonzero columns of \(\mathbf{C}\) are \(\mathbf{e}_1,\mathbf{e}_2\), while those of \(\mathbf{D}\) are \(\mathbf{e}_1,\mathbf{e}_3\).
Now compute the squares. In \(\mathbf{C}^2\), the only nonzero entry is in row 1, column 3, because the product of the entries in positions \((1,2)\) and \((2,3)\) is \(1\). Thus
If \(\mathbf{C}\) and \(\mathbf{D}\) were similar, the power theorem would force \(\mathbf{C}^2=\mathbf{O}\) whenever \(\mathbf{D}^2=\mathbf{O}\). Since the computed \(\mathbf{C}^2\) is nonzero, they are not similar. The matching basic invariants were useful filters, but they did not settle the comparison.
Common Mistake and a Reliable Checklist
Common mistake: treating agreement of invariants as a proof. For the last pair, the calculation “both traces are \(0\), both determinants are \(0\), and both ranks are \(2\), therefore the matrices are similar” is invalid. Those equalities are necessary for similarity, not sufficient. The correction is to seek a further obstruction or an actual change-of-basis matrix. Here \(\mathbf{D}^2=\mathbf{O}\) but \(\mathbf{C}^2\ne\mathbf{O}\), so the pair is not similar.
For a new matrix pair, the following sequence keeps the work efficient:
- Confirm that the matrices are square and have the same size.
- Compare rank, trace, determinant, and characteristic polynomial. A mismatch proves non-similarity.
- If the tests agree, look for basis vectors or a structural reason that suggests \(\mathbf{P}\).
- Check that \(\mathbf{P}\) is invertible, then verify \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\).
- If no candidate is apparent, solve \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\) for its entries and test whether any solution is invertible.
The key distinction is between ruling out similarity and establishing it. Invariants can rule it out quickly. To establish it, the decisive evidence is an invertible change-of-basis matrix whose products agree exactly.
Check Your Understanding
For each problem, state which calculation would provide a decisive conclusion.
- Two \(3\times3\) matrices have different ranks. What can you conclude about similarity?
- State the condition on \(\mathbf{P}\) that turns \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\) into a proof that \(\mathbf{A}\) and \(\mathbf{B}\) are similar.
- If the columns of \(\mathbf{P}\) are proposed basis vectors, what do the columns of \(\mathbf{A}\mathbf{P}\) represent?
- Suppose \(\mathbf{B}^3=\mathbf{O}\) and \(\mathbf{A}\) is similar to \(\mathbf{B}\). What must \(\mathbf{A}^3\) equal?
- Why do matching trace, determinant, and rank not, by themselves, prove that two matrices are similar?