Tutorials › Linear Algebra › Rank, Determinant, and Trace Under Similarity

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

Rank, Determinant, and Trace Under Similarity

Prove that similarity preserves rank, determinant, and trace, and verify these invariants in concrete matrix calculations.

Intermediate 11 min read

What You'll Learn

  • Define similarity using an invertible change-of-basis matrix.
  • Prove rank is unchanged by invertible multiplication on either side.
  • Use determinant multiplicativity to establish determinant invariance.
  • Verify the entrywise identity tr(XY) = tr(YX).
  • Compute and check invariants for full-rank, rank-deficient, and nilpotent examples.
  • Correct a common error about how trace behaves under matrix multiplication.

Three Quantities That Do Not Depend on the Basis

A linear operator on a finite-dimensional vector space can be represented by different matrices when its basis changes. The entries may change, but certain features do not. This tutorial proves that similar matrices have the same rank, determinant, and trace. These quantities describe different aspects of a matrix: rank measures the dimension of its column space, the determinant is a scalar associated to a square matrix, and the trace is the sum of its diagonal entries.

All matrices here are over \(\mathbb{R}\), and the matrices related by similarity are square of the same size. Two \(n\times n\) matrices \(\mathbf{A}\) and \(\mathbf{B}\) 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}\) represents a change of coordinates; the particular direction of the coordinate change determines which matrix appears on each side. The results below use exactly this convention.

Definition: For a matrix \(\mathbf{A}\in\mathbb{R}^{m\times n}\), its column space is \(\operatorname{Col}\mathbf{A}=\{\mathbf{A}\mathbf{x}:\mathbf{x}\in\mathbb{R}^n\}\), and its rank is \(\operatorname{rank}\mathbf{A}=\dim(\operatorname{Col}\mathbf{A})\). For a square matrix \(\mathbf{A}\), its trace is \(\operatorname{tr}\mathbf{A}=\sum_{i=1}^n a_{ii}\).

The rank statement will follow from how invertible matrices act on column spaces. The determinant statement uses the product rule for determinants. The trace statement uses a different product rule: for compatible matrices, the trace of one product can be reversed. We establish these facts before applying them to similarity.

Rank and Invertible Multiplication

Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\), let \(\mathbf{L}\in\mathbb{R}^{m\times m}\) be invertible, and let \(\mathbf{Q}\in\mathbb{R}^{n\times n}\) be invertible. Left multiplication changes each column by applying the same invertible map. Right multiplication replaces the columns by combinations of the original columns. Neither operation changes the dimension of the column space.

Theorem: If \(\mathbf{A}\in\mathbb{R}^{m\times n}\), \(\mathbf{L}\in\mathbb{R}^{m\times m}\) is invertible, and \(\mathbf{Q}\in\mathbb{R}^{n\times n}\) is invertible, then \(\operatorname{rank}(\mathbf{L}\mathbf{A})=\operatorname{rank}\mathbf{A}\) and \(\operatorname{rank}(\mathbf{A}\mathbf{Q})=\operatorname{rank}\mathbf{A}\).

Proof. For left multiplication, \(\operatorname{Col}(\mathbf{L}\mathbf{A})=\mathbf{L}(\operatorname{Col}\mathbf{A})\): each column combination of \(\mathbf{L}\mathbf{A}\) has the form \(\mathbf{L}\mathbf{A}\mathbf{x}\), and each vector \(\mathbf{L}\mathbf{A}\mathbf{x}\) is such a column combination. The restriction of the invertible map \(\mathbf{x}\mapsto\mathbf{L}\mathbf{x}\) to \(\operatorname{Col}\mathbf{A}\) is one-to-one and maps onto \(\operatorname{Col}(\mathbf{L}\mathbf{A})\). These finite-dimensional spaces are therefore isomorphic and have equal dimension, so the ranks agree. For right multiplication, \(\operatorname{Col}(\mathbf{A}\mathbf{Q})\subseteq\operatorname{Col}\mathbf{A}\), since \(\mathbf{A}\mathbf{Q}\mathbf{x}=\mathbf{A}(\mathbf{Q}\mathbf{x})\). Conversely, for every \(\mathbf{z}\in\mathbb{R}^n\), \(\mathbf{A}\mathbf{z}=\mathbf{A}\mathbf{Q}(\mathbf{Q}^{-1}\mathbf{z})\), so \(\operatorname{Col}\mathbf{A}\subseteq\operatorname{Col}(\mathbf{A}\mathbf{Q})\). The column spaces are equal, and hence their dimensions and ranks are equal. \(\square\)

In particular, if \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\), both multipliers are invertible: \(\mathbf{P}^{-1}\) on the left and \(\mathbf{P}\) on the right. Applying the theorem twice gives \(\operatorname{rank}\mathbf{B}=\operatorname{rank}\mathbf{A}\). This argument works for rectangular \(\mathbf{A}\) with compatible invertible multipliers too, although similarity itself is defined here for square matrices.

Worked Example: Similarity Preserves Full Rank

Take \(\mathbf{A}=\begin{bmatrix}2&0\\0&3\end{bmatrix}\) and \(\mathbf{P}=\begin{bmatrix}1&1\\0&1\end{bmatrix}\). Since \(\mathbf{P}^{-1}=\begin{bmatrix}1&-1\\0&1\end{bmatrix}\), calculate \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\) in two multiplications:

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

Both \(\mathbf{A}\) and \(\mathbf{B}\) have two pivots, so each has rank \(2\). Their determinants are \(6\), and their traces are \(5\). To check the similarity calculation directly, \(\mathbf{P}\mathbf{B}=\begin{bmatrix}2&2\\0&3\end{bmatrix}=\mathbf{A}\mathbf{P}\). Since \(\mathbf{P}\) is invertible, this equation is equivalent to \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\).

Determinant Under Similarity

The determinant product rule states that for square matrices \(\mathbf{X}\) and \(\mathbf{Y}\) of the same size, \(\det(\mathbf{X}\mathbf{Y})=\det(\mathbf{X})\det(\mathbf{Y})\). Here is a proof from the alternating multilinear definition of the determinant. Multilinearity means that the determinant is linear in each column while the other columns are fixed; alternating means it is zero whenever two columns agree. Also, \(\det\mathbf{I}_n=1\).

Proposition (Determinant product rule): For \(\mathbf{X},\mathbf{Y}\in\mathbb{R}^{n\times n}\), \(\det(\mathbf{X}\mathbf{Y})=\det(\mathbf{X})\det(\mathbf{Y})\).

Proof. Write the columns of \(\mathbf{X}\) as \(\mathbf{x}_1,\dots,\mathbf{x}_n\). The \(j\)th column of \(\mathbf{X}\mathbf{Y}\) is \(\sum_{i=1}^n y_{ij}\mathbf{x}_i\). Expanding its determinant by multilinearity in all columns gives a sum over choices \(i_1,\dots,i_n\), with each term equal to \(\bigl(\prod_{j=1}^n y_{i_jj}\bigr)\det(\mathbf{x}_{i_1},\dots,\mathbf{x}_{i_n})\). If two chosen indices agree, the determinant in that term is zero by the alternating property. The remaining choices are permutations, say \(i_j=\pi(j)\). For such a choice, \(\det(\mathbf{x}_{\pi(1)},\dots,\mathbf{x}_{\pi(n)})=\operatorname{sgn}(\pi)\det\mathbf{X}\). Factoring out \(\det\mathbf{X}\), the remaining sum is \(\sum_{\pi}\operatorname{sgn}(\pi)\prod_{j=1}^n y_{\pi(j)j}=\det\mathbf{Y}\), by the permutation formula for the determinant. Therefore \(\det(\mathbf{X}\mathbf{Y})=\det(\mathbf{X})\det(\mathbf{Y})\). \(\square\)

Now apply the product rule twice to a similarity transform. Since \(\mathbf{P}^{-1}\mathbf{P}=\mathbf{I}_n\), the same rule gives \(\det(\mathbf{P}^{-1})\det(\mathbf{P})=\det(\mathbf{I}_n)=1\). Thus the factors contributed by the change of coordinates cancel.

Theorem: If \(\mathbf{A},\mathbf{B}\in\mathbb{R}^{n\times n}\) are similar, with \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\) and \(\mathbf{P}\) invertible, then \(\det\mathbf{B}=\det\mathbf{A}\).

Proof. By determinant multiplicativity, \(\det\mathbf{B}=\det(\mathbf{P}^{-1})\det(\mathbf{A})\det(\mathbf{P})\). Since \(\det(\mathbf{P}^{-1})\det(\mathbf{P})=1\), this equals \(\det\mathbf{A}\). \(\square\)

Worked Example: A Rank-One Similarity Transform

Let \(\mathbf{A}=\begin{bmatrix}1&0&0\\0&0&0\\0&0&0\end{bmatrix}\), and let \(\mathbf{P}=\begin{bmatrix}0&1&0\\1&0&0\\0&0&1\end{bmatrix}\). This permutation matrix is its own inverse, so \(\mathbf{P}^{-1}=\mathbf{P}\). First multiply on the right, then on the left:

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

The matrix \(\mathbf{A}\) has one nonzero column, and \(\mathbf{B}\) has one nonzero column, so both have rank \(1\). Both determinants are \(0\), since each matrix has a zero row. Both traces are \(1\). For a direct check, \(\mathbf{P}\mathbf{B}=\begin{bmatrix}0&1&0\\0&0&0\\0&0&0\end{bmatrix}=\mathbf{A}\mathbf{P}\), as required by the similarity relation.

Trace and Reversing a Product

The trace is a sum of diagonal entries, so its behavior under multiplication can be checked directly from entries. The identity below allows the two factors to be exchanged inside a trace. The matrices do not need to be square individually; they only need compatible sizes that make both products square.

Proposition (Cyclic trace identity): If \(\mathbf{X}\in\mathbb{R}^{m\times n}\) and \(\mathbf{Y}\in\mathbb{R}^{n\times m}\), then \(\operatorname{tr}(\mathbf{X}\mathbf{Y})=\operatorname{tr}(\mathbf{Y}\mathbf{X})\).

Proof. The \(i\)th diagonal entry of \(\mathbf{X}\mathbf{Y}\) is \(\sum_{j=1}^n x_{ij}y_{ji}\). Therefore \(\operatorname{tr}(\mathbf{X}\mathbf{Y})=\sum_{i=1}^m\sum_{j=1}^n x_{ij}y_{ji}\). The \(j\)th diagonal entry of \(\mathbf{Y}\mathbf{X}\) is \(\sum_{i=1}^m y_{ji}x_{ij}\), so \(\operatorname{tr}(\mathbf{Y}\mathbf{X})=\sum_{j=1}^n\sum_{i=1}^m y_{ji}x_{ij}\). These are the same finite sum, because real scalar multiplication commutes and the order of a finite sum may be exchanged. \(\square\)

For a similarity transform, take \(\mathbf{X}=\mathbf{P}^{-1}\mathbf{A}\) and \(\mathbf{Y}=\mathbf{P}\). Then \(\mathbf{X}\mathbf{Y}=\mathbf{B}\), while \(\mathbf{Y}\mathbf{X}=\mathbf{P}\mathbf{P}^{-1}\mathbf{A}=\mathbf{A}\). The cyclic trace identity immediately gives the trace invariance result.

Theorem: If \(\mathbf{A},\mathbf{B}\in\mathbb{R}^{n\times n}\) are similar, then \(\operatorname{tr}\mathbf{B}=\operatorname{tr}\mathbf{A}\).

Proof. Write \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\). Using the cyclic trace identity with \(\mathbf{X}=\mathbf{P}^{-1}\mathbf{A}\) and \(\mathbf{Y}=\mathbf{P}\), we obtain \(\operatorname{tr}\mathbf{B}=\operatorname{tr}(\mathbf{P}\mathbf{P}^{-1}\mathbf{A})=\operatorname{tr}(\mathbf{I}_n\mathbf{A})=\operatorname{tr}\mathbf{A}\). \(\square\)

Worked Example: A Similarity Transform with Zero Trace

Let \(\mathbf{A}=\begin{bmatrix}0&1\\0&0\end{bmatrix}\), \(\mathbf{P}=\begin{bmatrix}1&0\\1&1\end{bmatrix}\), and \(\mathbf{P}^{-1}=\begin{bmatrix}1&0\\-1&1\end{bmatrix}\). The inverse is verified by multiplication: \(\mathbf{P}\mathbf{P}^{-1}=\begin{bmatrix}1&0\\0&1\end{bmatrix}\). Compute:

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

The columns of \(\mathbf{B}\) are equal and nonzero, so its rank is \(1\); \(\mathbf{A}\) also has rank \(1\). Both determinants are \(0\): for \(\mathbf{B}\), \(1(-1)-1(-1)=0\), and for \(\mathbf{A}\), both terms in the \(2\times2\) determinant formula are zero. The traces are \(0+0=0\) and \(1+(-1)=0\), respectively. Finally, \(\mathbf{P}\mathbf{B}=\begin{bmatrix}1&1\\0&0\end{bmatrix}=\mathbf{A}\mathbf{P}\), confirming the similarity relation by multiplication.

A Common Mistake: Trace Is Not Multiplicative

The cyclic trace identity says that \(\operatorname{tr}(\mathbf{X}\mathbf{Y})=\operatorname{tr}(\mathbf{Y}\mathbf{X})\). It does not say that the trace of a product is the product of the traces. For a concrete counterexample, take \(\mathbf{A}=\begin{bmatrix}1&0\\0&0\end{bmatrix}\) and \(\mathbf{P}=\begin{bmatrix}2&0\\0&1\end{bmatrix}\). A mistaken calculation would treat the trace as multiplicative and claim \(\operatorname{tr}(\mathbf{P}\mathbf{A})=\operatorname{tr}\mathbf{P}\operatorname{tr}\mathbf{A}=3\cdot1=3\). In fact, \(\mathbf{P}\mathbf{A}=\begin{bmatrix}2&0\\0&0\end{bmatrix}\), so \(\operatorname{tr}(\mathbf{P}\mathbf{A})=2\), not \(3\).

The correction is to use the identity only in the form it proves: reversing two factors inside a trace, when both products are defined. Similarity has the particular structure \(\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\), which is why the cyclic identity applies and the inverse factors combine to give \(\mathbf{A}\). Arbitrary left or right multiplication does not generally preserve trace, determinant, or rank; the hypotheses matter.

What the Three Invariants Tell Us

Rank, determinant, and trace remain fixed when the matrix of an operator is changed by similarity. Their proofs use distinct mechanisms: invertibility preserves column-space dimension, determinant multiplicativity cancels the change-of-basis factors, and the entrywise cyclic trace identity moves the outer factors together. Keeping those mechanisms separate helps avoid assuming that all matrix quantities behave alike under multiplication.

These invariants are useful descriptions of a matrix, but they are not interchangeable. For instance, rank is a dimension, whereas determinant and trace are scalars; knowing one does not automatically determine the others. The key conclusion established here is precise: if two square matrices are related by an invertible conjugation, each of these three quantities agrees for the two matrices.

Check Your Understanding

Use the definitions and proved identities to justify each answer.

  1. Explain why \(\operatorname{rank}(\mathbf{A}\mathbf{Q})=\operatorname{rank}\mathbf{A}\) requires \(\mathbf{Q}\) to be invertible in the proof given.
  2. For \(\mathbf{A}=\begin{bmatrix}1&0\\0&0\end{bmatrix}\) and \(\mathbf{P}=\begin{bmatrix}0&1\\1&0\end{bmatrix}\), compute \(\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\) and compare rank, determinant, and trace.
  3. Write the entrywise double sum for \(\operatorname{tr}(\mathbf{X}\mathbf{Y})\) when \(\mathbf{X}\) is \(2\times3\) and \(\mathbf{Y}\) is \(3\times2\).
  4. Give a concrete reason that \(\operatorname{tr}(\mathbf{X}\mathbf{Y})=\operatorname{tr}(\mathbf{Y}\mathbf{X})\) does not imply \(\operatorname{tr}(\mathbf{X}\mathbf{Y})=\operatorname{tr}\mathbf{X}\operatorname{tr}\mathbf{Y}\).
  5. Suppose \(\mathbf{B}=\mathbf{P}^{-1}\mathbf{A}\mathbf{P}\). State the determinant product rule application that yields \(\det\mathbf{B}=\det\mathbf{A}\).

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