Tutorials › Linear Algebra › A Workshop on Comparing Operator Matrices

Similarity and Change of Basis for Operators · Tutorial 480 of 1000

A Workshop on Comparing Operator Matrices

Learn how to screen matrix pairs with invariants, choose a useful basis change, and verify a proposed similarity matrix exactly.

Intermediate 10 min read

What You'll Learn

  • Use rank, trace, determinant, and characteristic polynomial to rule out similarity.
  • Explain why matching invariants do not, by themselves, establish similarity.
  • Interpret the columns of a change-of-basis matrix in the equation AP = PB.
  • Compute and verify a similarity using a strategically chosen basis.
  • Solve AP = PB for a candidate change-of-basis matrix and check invertibility.
  • Use powers of similar matrices to distinguish matrix pairs that pass basic tests.

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)\).

Definition: Two matrices \(\mathbf{A},\mathbf{B}\in\mathbb{R}^{n\times n}\) are similar if there is an invertible matrix \(\mathbf{P}\in\mathbb{R}^{n\times n}\) such that \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\). The matrix \(\mathbf{P}\) records a change of coordinates; its columns specify the new basis vectors in the coordinates used for \(\mathbf{A}\).

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.

Theorem: For \(\mathbf{A},\mathbf{B},\mathbf{P}\in\mathbb{R}^{n\times n}\) with \(\mathbf{P}\) invertible, \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\) if and only if \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\).

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

$$ \mathbf{A}=\begin{bmatrix}1&0&0\\0&1&0\\0&0&0\end{bmatrix}, \qquad \mathbf{B}=\begin{bmatrix}2&0&0\\0&0&0\\0&0&0\end{bmatrix} $$

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

$$ \mathbf{B}=\begin{bmatrix}2&1&0\\0&2&1\\0&0&3\end{bmatrix}, \qquad \mathbf{P}=\begin{bmatrix}1&1&0\\0&1&0\\0&0&1\end{bmatrix}. $$

The columns of \(\mathbf{P}\) are the basis vectors in ambient coordinates. First check that the basis change is invertible by computing

$$ \mathbf{P}^{-1}=\begin{bmatrix}1&-1&0\\0&1&0\\0&0&1\end{bmatrix}, \qquad \mathbf{P}\mathbf{P}^{-1}=\mathbf{I}_3. $$

To find the matrix in ambient coordinates, compute \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\). The first multiplication is

$$ \mathbf{P}\mathbf{B} = \begin{bmatrix}1&1&0\\0&1&0\\0&0&1\end{bmatrix} \begin{bmatrix}2&1&0\\0&2&1\\0&0&3\end{bmatrix} = \begin{bmatrix}2&3&1\\0&2&1\\0&0&3\end{bmatrix}. $$

Multiplying by \(\mathbf{P}^{-1}\) gives

$$ \mathbf{A} = \begin{bmatrix}2&3&1\\0&2&1\\0&0&3\end{bmatrix} \begin{bmatrix}1&-1&0\\0&1&0\\0&0&1\end{bmatrix} = \begin{bmatrix}2&1&1\\0&2&1\\0&0&3\end{bmatrix}. $$

Now check the defining equation directly. Multiplication on the right by \(\mathbf{P}\) gives

$$ \mathbf{A}\mathbf{P} = \begin{bmatrix}2&1&1\\0&2&1\\0&0&3\end{bmatrix} \begin{bmatrix}1&1&0\\0&1&0\\0&0&1\end{bmatrix} = \begin{bmatrix}2&3&1\\0&2&1\\0&0&3\end{bmatrix}. $$

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

$$ \mathbf{A}=\begin{bmatrix}2&1\\0&2\end{bmatrix}, \qquad \mathbf{B}=\begin{bmatrix}2&0\\1&2\end{bmatrix}, $$

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

$$ \mathbf{A}\mathbf{P} = \begin{bmatrix}2a+c&2b+d\\2c&2d\end{bmatrix}, \qquad \mathbf{P}\mathbf{B} = \begin{bmatrix}2a+b&2b\\2c+d&2d\end{bmatrix}. $$

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

$$ \mathbf{P}=\begin{bmatrix}0&1\\1&0\end{bmatrix}, \qquad \det\mathbf{P}=0\cdot0-1\cdot1=-1\ne0. $$

So \(\mathbf{P}\) is invertible. Verify the equation with the selected entries:

$$ \mathbf{A}\mathbf{P} = \begin{bmatrix}2&1\\0&2\end{bmatrix} \begin{bmatrix}0&1\\1&0\end{bmatrix} = \begin{bmatrix}1&2\\2&0\end{bmatrix}, $$

and

$$ \mathbf{P}\mathbf{B} = \begin{bmatrix}0&1\\1&0\end{bmatrix} \begin{bmatrix}2&0\\1&2\end{bmatrix} = \begin{bmatrix}1&2\\2&0\end{bmatrix}. $$

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.

Theorem: If \(\mathbf{A},\mathbf{B}\in\mathbb{R}^{n\times n}\) are similar by an invertible \(\mathbf{P}\), then \(\mathbf{A}^k\mathbf{P}=\mathbf{P}\mathbf{B}^k\) for every integer \(k\geq 0\). In particular, if \(\mathbf{B}^k=\mathbf{O}\), then \(\mathbf{A}^k=\mathbf{O}\).

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

$$ \mathbf{C}=\begin{bmatrix}0&1&0&0\\0&0&1&0\\0&0&0&0\\0&0&0&0\end{bmatrix}, \qquad \mathbf{D}=\begin{bmatrix}0&1&0&0\\0&0&0&0\\0&0&0&1\\0&0&0&0\end{bmatrix}. $$

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

$$ \mathbf{C}^2=\begin{bmatrix}0&0&1&0\\0&0&0&0\\0&0&0&0\\0&0&0&0\end{bmatrix}\ne\mathbf{O}, \qquad \mathbf{D}^2=\mathbf{O}. $$

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:

  1. Confirm that the matrices are square and have the same size.
  2. Compare rank, trace, determinant, and characteristic polynomial. A mismatch proves non-similarity.
  3. If the tests agree, look for basis vectors or a structural reason that suggests \(\mathbf{P}\).
  4. Check that \(\mathbf{P}\) is invertible, then verify \(\mathbf{A}\mathbf{P}=\mathbf{P}\mathbf{B}\).
  5. 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.

  1. Two \(3\times3\) matrices have different ranks. What can you conclude about similarity?
  2. 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.
  3. If the columns of \(\mathbf{P}\) are proposed basis vectors, what do the columns of \(\mathbf{A}\mathbf{P}\) represent?
  4. Suppose \(\mathbf{B}^3=\mathbf{O}\) and \(\mathbf{A}\) is similar to \(\mathbf{B}\). What must \(\mathbf{A}^3\) equal?
  5. Why do matching trace, determinant, and rank not, by themselves, prove that two matrices are similar?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon