Tutorials › Linear Algebra › Similarity as an Equivalence Relation

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

Similarity as an Equivalence Relation

Learn the definition of similar matrices and prove that similarity satisfies all three properties of an equivalence relation.

Intermediate 9 min read

What You'll Learn

  • Define similarity for square matrices of the same size over the real numbers.
  • Prove reflexivity using the identity matrix.
  • Prove symmetry by reversing an invertible change of coordinates.
  • Prove transitivity by composing two changes of coordinates.
  • Describe similarity classes and explain how they partition the matrices.
  • Identify and correct a common mistake about which inverse to use.

Similarity Relates Matrices of the Same Size

A linear operator can have different matrices when it is described using different bases. The entries may change, but the underlying operator does not. Similarity gives a precise relation between matrices that can arise in this way: it says that one matrix is obtained from the other by an invertible change of coordinates. The relation is useful not only because it connects different matrix descriptions, but also because its three basic properties let us group matrices into well-defined classes.

For this tutorial, all matrices are in \(\mathbb{R}^{n\times n}\) for a fixed positive integer \(n\). The fixed size matters: the products in the definition below must be defined, and the relation compares matrices of the same size. A matrix \(\mathbf{P}\in\mathbb{R}^{n\times n}\) is invertible if there is a matrix \(\mathbf{P}^{-1}\) such that \(\mathbf{P}\mathbf{P}^{-1}=\mathbf{P}^{-1}\mathbf{P}=\mathbf{I}_n\).

Definition: 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{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\). The matrix \(\mathbf{P}\) is called a similarity matrix. We write \(\mathbf{A}\sim\mathbf{B}\) to mean that \(\mathbf{A}\) and \(\mathbf{B}\) are similar.

The order of the factors in this definition is important. In the change-of-basis setting, \(\mathbf{P}\) converts coordinates in one basis to coordinates in another, so the matrix in the new coordinates has the form \(\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\). Similarity is a relation between matrices, not a claim that the entries of the matrices are equal. In general, \(\mathbf{A}\sim\mathbf{B}\) does not imply \(\mathbf{A}=\mathbf{B}\).

The Three Properties

A relation on a set is an equivalence relation if it is reflexive, symmetric and transitive. Reflexivity means every object is related to itself. Symmetry means that if one object is related to another, the relation also holds in the reverse direction. Transitivity means that if the first object is related to the second and the second to the third, then the first is related to the third.

Theorem: Similarity is an equivalence relation on \(\mathbb{R}^{n\times n}\). In other words, for all \(\mathbf{A},\mathbf{B},\mathbf{C}\in\mathbb{R}^{n\times n}\):
  1. \(\mathbf{A}\sim\mathbf{A}\) (reflexivity);
  2. if \(\mathbf{A}\sim\mathbf{B}\), then \(\mathbf{B}\sim\mathbf{A}\) (symmetry);
  3. if \(\mathbf{A}\sim\mathbf{B}\) and \(\mathbf{B}\sim\mathbf{C}\), then \(\mathbf{A}\sim\mathbf{C}\) (transitivity).

Proof. For reflexivity, take \(\mathbf{P}=\mathbf{I}_n\), which is invertible and satisfies \(\mathbf{I}_n^{-1}\mathbf{A}\mathbf{I}_n=\mathbf{A}\). Thus \(\mathbf{A}\sim\mathbf{A}\).

For symmetry, suppose \(\mathbf{A}\sim\mathbf{B}\). By definition, some invertible \(\mathbf{P}\) satisfies \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\). Multiplying this equation on the left by \(\mathbf{P}\) and on the right by \(\mathbf{P}^{-1}\) gives \(\mathbf{P}\mathbf{B}\mathbf{P}^{-1}=\mathbf{A}\). The inverse of \(\mathbf{P}^{-1}\) is \(\mathbf{P}\), so this is exactly the form \(\mathbf{A}=(\mathbf{P}^{-1})^{-1}\mathbf{B}\mathbf{P}^{-1}\). Hence \(\mathbf{B}\sim\mathbf{A}\).

For transitivity, suppose \(\mathbf{A}\sim\mathbf{B}\) and \(\mathbf{B}\sim\mathbf{C}\). There are invertible matrices \(\mathbf{P}\) and \(\mathbf{Q}\) such that \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\) and \(\mathbf{C}=\mathbf{Q}^{-1}\mathbf{B}\mathbf{Q}\). Substituting the first equation into the second gives \(\mathbf{C}=\mathbf{Q}^{-1}\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\mathbf{Q}=(\mathbf{P}\mathbf{Q})^{-1}\mathbf{A}(\mathbf{P}\mathbf{Q})\). Here \((\mathbf{P}\mathbf{Q})^{-1}=\mathbf{Q}^{-1}\mathbf{P}^{-1}\): multiplying these two matrices in either order gives \(\mathbf{I}_n\). Also, \(\mathbf{P}\mathbf{Q}\) is invertible, with that inverse. Therefore \(\mathbf{A}\sim\mathbf{C}\). All three properties hold. \(\square\)

The proof uses only the definition of similarity, the identity matrix, and basic rules for inverses and matrix products. In particular, transitivity does not require the same similarity matrix to work in both steps: the two changes of coordinates combine into the single invertible matrix \(\mathbf{P}\mathbf{Q}\).

Worked Examples of the Relation

Worked Example: Reflexivity for a Specific Matrix

Let \(\mathbf{A}=\begin{bmatrix}2&-1\\3&0\end{bmatrix}\). Exhibit a similarity matrix showing that \(\mathbf{A}\sim\mathbf{A}\).

Choose \(\mathbf{P}=\mathbf{I}_2\). Its inverse is \(\mathbf{I}_2\), since multiplying the identity matrix by itself gives the identity. Then

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

Check: the product equals \(\mathbf{A}\) entry by entry, so the chosen invertible matrix satisfies the definition of similarity. This calculation illustrates reflexivity for this particular matrix; the proof above establishes reflexivity for every \(\mathbf{A}\in\mathbb{R}^{n\times n}\).

Worked Example: Reversing a Similarity

Let \(\mathbf{A}=\begin{bmatrix}1&0\\0&2\end{bmatrix}\) and \(\mathbf{P}=\begin{bmatrix}1&1\\0&1\end{bmatrix}\). First find \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\), then exhibit the similarity in the reverse direction.

The inverse is \(\mathbf{P}^{-1}=\begin{bmatrix}1&-1\\0&1\end{bmatrix}\), as both \(\mathbf{P}\mathbf{P}^{-1}\) and \(\mathbf{P}^{-1}\mathbf{P}\) equal \(\begin{bmatrix}1&0\\0&1\end{bmatrix}\). Compute the first product and then multiply by \(\mathbf{P}^{-1}\):

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

Now use \(\mathbf{P}\) on the left and \(\mathbf{P}^{-1}\) on the right to recover \(\mathbf{A}\):

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

Check: the reverse formula is \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\), or, in the defining form, \(\mathbf{A}=(\mathbf{P}^{-1})^{-1}\mathbf{B}\mathbf{P}^{-1}\). Since \(\mathbf{P}^{-1}\) is invertible, this proves \(\mathbf{B}\sim\mathbf{A}\), as symmetry requires.

Worked Example: Combining Two Similarities

Use \(\mathbf{A}=\begin{bmatrix}1&0\\0&2\end{bmatrix}\) and \(\mathbf{P}=\mathbf{Q}=\begin{bmatrix}1&1\\0&1\end{bmatrix}\). Compute \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\) and \(\mathbf{C}=\mathbf{Q}^{-1}\mathbf{B}\mathbf{Q}\), then verify the combined similarity directly.

The inverse of each of \(\mathbf{P}\) and \(\mathbf{Q}\) is \(\begin{bmatrix}1&-1\\0&1\end{bmatrix}\). The first step, computed in the preceding example, gives \(\mathbf{B}=\begin{bmatrix}1&-1\\0&2\end{bmatrix}\). For the second step, multiply in order:

$$ \mathbf{B}\mathbf{Q} = \begin{bmatrix}1&-1\\0&2\end{bmatrix} \begin{bmatrix}1&1\\0&1\end{bmatrix} = \begin{bmatrix}1&0\\0&2\end{bmatrix}, \qquad \mathbf{C} = \mathbf{Q}^{-1}\mathbf{B}\mathbf{Q} = \begin{bmatrix}1&-1\\0&1\end{bmatrix} \begin{bmatrix}1&0\\0&2\end{bmatrix} = \begin{bmatrix}1&-2\\0&2\end{bmatrix}. $$

The combined matrix is \(\mathbf{P}\mathbf{Q}=\begin{bmatrix}1&2\\0&1\end{bmatrix}\), whose inverse is \(\begin{bmatrix}1&-2\\0&1\end{bmatrix}\). Multiplying directly gives

$$ \mathbf{A}(\mathbf{P}\mathbf{Q}) = \begin{bmatrix}1&0\\0&2\end{bmatrix} \begin{bmatrix}1&2\\0&1\end{bmatrix} = \begin{bmatrix}1&2\\0&2\end{bmatrix}, \qquad (\mathbf{P}\mathbf{Q})^{-1}\mathbf{A}(\mathbf{P}\mathbf{Q}) = \begin{bmatrix}1&-2\\0&1\end{bmatrix} \begin{bmatrix}1&2\\0&2\end{bmatrix} = \begin{bmatrix}1&-2\\0&2\end{bmatrix} =\mathbf{C}. $$

Check: the direct calculation agrees with the two-step result. Thus \(\mathbf{A}\sim\mathbf{B}\) and \(\mathbf{B}\sim\mathbf{C}\) lead to \(\mathbf{A}\sim\mathbf{C}\), with the combined similarity matrix \(\mathbf{P}\mathbf{Q}\).

Equivalence Classes of Similar Matrices

An equivalence relation groups the objects in its underlying set into equivalence classes. For similarity, the class of \(\mathbf{A}\) is the collection of all matrices similar to \(\mathbf{A}\). This collection can contain matrices different from \(\mathbf{A}\), as the worked examples show. The equivalence-relation properties ensure that these classes do not overlap partially: two such classes are either identical or disjoint.

Definition: For \(\mathbf{A}\in\mathbb{R}^{n\times n}\), its similarity class is \([\mathbf{A}]=\{\mathbf{B}\in\mathbb{R}^{n\times n}:\mathbf{B}\sim\mathbf{A}\}\).
Theorem: The similarity classes partition \(\mathbb{R}^{n\times n}\): every matrix belongs to a similarity class, and any two similarity classes are either equal or disjoint.

Proof. Reflexivity gives \(\mathbf{A}\sim\mathbf{A}\), so \(\mathbf{A}\in[\mathbf{A}]\). Therefore every matrix belongs to at least one class. Now suppose two classes \([\mathbf{A}]\) and \([\mathbf{B}]\) have a matrix \(\mathbf{X}\) in common. Then \(\mathbf{X}\sim\mathbf{A}\) and \(\mathbf{X}\sim\mathbf{B}\). By symmetry, \(\mathbf{A}\sim\mathbf{X}\); by transitivity with \(\mathbf{X}\sim\mathbf{B}\), this gives \(\mathbf{A}\sim\mathbf{B}\). To prove the classes are equal, take any \(\mathbf{Y}\in[\mathbf{A}]\). Then \(\mathbf{Y}\sim\mathbf{A}\), and \(\mathbf{A}\sim\mathbf{B}\), so transitivity gives \(\mathbf{Y}\sim\mathbf{B}\). Hence \(\mathbf{Y}\in[\mathbf{B}]\), proving \([\mathbf{A}]\subseteq[\mathbf{B}]\). Reversing the roles of \(\mathbf{A}\) and \(\mathbf{B}\) gives \([\mathbf{B}]\subseteq[\mathbf{A}]\), so the classes are equal. Consequently, if two classes are not equal, they have no matrix in common. \(\square\)

This partition viewpoint changes the question from “Are these matrices equal?” to “Do these matrices belong to the same similarity class?” It does not by itself provide a method for deciding whether two arbitrary matrices are similar. The point here is the structure of the relation: once two matrices are related, symmetry and transitivity make their entire classes coincide.

Common Mistake: Reversing the Factors Incorrectly

A frequent error is to try to reverse \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\) by asserting \(\mathbf{A}=\mathbf{P}^{-1}\mathbf{B}\mathbf{P}\). That uses the same direction of change instead of reversing it. For the matrices in the symmetry example, this incorrect expression gives

$$ \mathbf{P}^{-1}\mathbf{B}\mathbf{P} = \begin{bmatrix}1&-1\\0&1\end{bmatrix} \begin{bmatrix}1&-1\\0&2\end{bmatrix} \begin{bmatrix}1&1\\0&1\end{bmatrix} = \begin{bmatrix}1&-2\\0&2\end{bmatrix}, $$

which is not \(\mathbf{A}=\begin{bmatrix}1&0\\0&2\end{bmatrix}\). The correction follows by isolating \(\mathbf{A}\) in the original equation: multiply on the left by \(\mathbf{P}\), and on the right by \(\mathbf{P}^{-1}\), to obtain \(\mathbf{A}=\mathbf{P}\mathbf{B}\mathbf{P}^{-1}\). The reversed similarity uses \(\mathbf{P}^{-1}\) as its similarity matrix, not \(\mathbf{P}\).

Another useful distinction is that “symmetric” in the phrase similarity is symmetric describes a property of a relation. It does not mean that either matrix must satisfy \(\mathbf{A}^{\top}=\mathbf{A}\). For example, the matrix \(\begin{bmatrix}1&-1\\0&2\end{bmatrix}\) above is similar to \(\begin{bmatrix}1&0\\0&2\end{bmatrix}\), regardless of whether the first matrix is symmetric.

Check Your Understanding

Use the definition and the three relation properties to answer each question.

  1. What matrix can be chosen to prove reflexivity for an arbitrary \(\mathbf{A}\in\mathbb{R}^{n\times n}\)?
  2. If \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\), write \(\mathbf{A}\) in terms of \(\mathbf{P}\), \(\mathbf{B}\) and \(\mathbf{P}^{-1}\).
  3. If \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\) and \(\mathbf{C}=\mathbf{Q}^{-1}\mathbf{B}\mathbf{Q}\), what invertible matrix gives \(\mathbf{C}\) directly from \(\mathbf{A}\)?
  4. Explain why the similarity classes of two matrices with a common member must be equal.
  5. Is the word “symmetric” in “similarity is symmetric” a claim that the matrices satisfy \(\mathbf{A}^{\top}=\mathbf{A}\)? Explain the distinction.

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