Unit 3, lesson 14

Trace, Determinant and Similarity

Why similar matrices share their trace, determinant and characteristic polynomial, proved from the cyclic property of the trace and the product rule, and the real volume factor of a complex matrix.

  • Video 14
  • Coordinate Invariants and Bilinear Forms

In the basis (1,0)(1, 0), (1,1)(1, 1) the operator on R2\mathbb{R}^2 with standard matrix diag⁡(2,3)\operatorname{diag}(2, 3) has the matrix with rows (2,−1)(2, -1) and (0,3)(0, 3). An entry changed, yet the trace is still 55 and the determinant is still 66. Is that a coincidence, and if two matrices share these numbers, must they describe the same operator? This lesson proves that the trace, the determinant and the characteristic polynomial are unchanged by similarity, shows that two matrices can share all three and still not be similar, and finds the factor by which a complex matrix scales real volume. Throughout, F\mathbb{F} is R\mathbb{R} or C\mathbb{C} and a tuple such as (1,2)(1, 2) stands for a column vector.

Key terms

Trace

Definition The trace of a square matrix A=[aij]∈Fn×nA = [a_{ij}] \in \mathbb{F}^{n \times n} is the sum of its diagonal entries,

tr⁡A=∑i=1naii.\operatorname{tr} A = \sum_{i=1}^{n} a_{ii}.

The trace is linear, with tr⁡(A+B)=tr⁡A+tr⁡B\operatorname{tr}(A + B) = \operatorname{tr} A + \operatorname{tr} B and tr⁡(cA)=ctr⁡A\operatorname{tr}(cA) = c \operatorname{tr} A, and tr⁡AT=tr⁡A\operatorname{tr} A^{\mathsf{T}} = \operatorname{tr} A. For columns u,v∈Fnu, v \in \mathbb{F}^n the iith diagonal entry of uvTuv^{\mathsf{T}} is uiviu_i v_i, so tr⁡(uvT)=vTu\operatorname{tr}(uv^{\mathsf{T}}) = v^{\mathsf{T}}u. Over C\mathbb{C} the matrix uv∗uv^{*} has trace v∗uv^{*}u, which is a different number in general.

In plain words The trace adds up the diagonal. That recipe plainly depends on the basis, so the fact that the answer does not is something to prove.

Example For u=(2,−1,1)u = (2, -1, 1) and v=(1,3,4)v = (1, 3, 4),

uvT=[268−1−3−4134],uv^{\mathsf{T}} = \begin{bmatrix} 2 & 6 & 8 \\ -1 & -3 & -4 \\ 1 & 3 & 4 \end{bmatrix},

with trace 2−3+4=32 - 3 + 4 = 3, which equals vTu=2−3+4v^{\mathsf{T}}u = 2 - 3 + 4. Over C\mathbb{C} take u=(1,i)u = (1, i) and v=(i,1)v = (i, 1). Then tr⁡(uvT)=vTu=2i\operatorname{tr}(uv^{\mathsf{T}}) = v^{\mathsf{T}}u = 2i, but tr⁡(uv∗)=v∗u=−i+i=0\operatorname{tr}(uv^{*}) = v^{*}u = -i + i = 0, so the transpose and the conjugate transpose cannot be swapped.

Cyclic property of the trace

Definition Let A∈Fm×nA \in \mathbb{F}^{m \times n} and B∈Fn×mB \in \mathbb{F}^{n \times m}. Then

tr⁡(AB)=tr⁡(BA),\operatorname{tr}(AB) = \operatorname{tr}(BA),

even though ABAB is m×mm \times m and BABA is n×nn \times n. The proof is a finite double sum whose order can be reversed, using that scalars commute,

tr⁡(AB)=∑i=1m∑j=1naijbji=∑j=1n∑i=1mbjiaij=tr⁡(BA).\begin{aligned} \operatorname{tr}(AB) &= \sum_{i=1}^{m} \sum_{j=1}^{n} a_{ij} b_{ji} \\[0.4em] &= \sum_{j=1}^{n} \sum_{i=1}^{m} b_{ji} a_{ij} \\[0.4em] &= \operatorname{tr}(BA). \end{aligned}

For three factors A∈Fm×nA \in \mathbb{F}^{m \times n}, B∈Fn×pB \in \mathbb{F}^{n \times p} and C∈Fp×mC \in \mathbb{F}^{p \times m}, grouping two of them gives tr⁡(ABC)=tr⁡(BCA)=tr⁡(CAB)\operatorname{tr}(ABC) = \operatorname{tr}(BCA) = \operatorname{tr}(CAB). Only these cyclic rotations are guaranteed to keep the trace. The identity is about traces and says nothing about ABAB and BABA being equal.

In plain words You may move the last factor to the front, as often as you like, without changing the trace. Any other reordering can change it.

Example For the row A=[123]A = \begin{bmatrix} 1 & 2 & 3 \end{bmatrix} and the column B=(4,5,6)B = (4, 5, 6), the product ABAB is the 1×11 \times 1 matrix [32][32], while BABA is 3×33 \times 3 with diagonal entries 44, 1010 and 1818, whose sum is 3232. A reordering that is not cyclic can change the trace. Let E12E_{12} have a single 11 in position (1,2)(1, 2), let E21E_{21} have a single 11 in position (2,1)(2, 1), and let C=diag⁡(1,2)C = \operatorname{diag}(1, 2). Then E12E21C=diag⁡(1,0)E_{12}E_{21}C = \operatorname{diag}(1, 0) has trace 11, while E12CE21=diag⁡(2,0)E_{12}CE_{21} = \operatorname{diag}(2, 0) has trace 22.

Similar matrices

Definition Matrices A,B∈Fn×nA, B \in \mathbb{F}^{n \times n} are similar over F\mathbb{F} if

B=S−1ASB = S^{-1} A S

for some invertible S∈Fn×nS \in \mathbb{F}^{n \times n}. Similarity is an equivalence relation, and similar matrices are exactly the matrices of one operator in two bases. If T ⁣:V→VT \colon V \to V is linear on a finite-dimensional space VV with ordered bases B\mathcal{B} and C\mathcal{C}, and S=PB←CS = P_{\mathcal{B} \leftarrow \mathcal{C}} is the matrix whose columns are the C\mathcal{C} vectors written in B\mathcal{B} coordinates, then PC←B=S−1P_{\mathcal{C} \leftarrow \mathcal{B}} = S^{-1} and

[T]C←C=S−1 [T]B←B S.[T]_{\mathcal{C} \leftarrow \mathcal{C}} = S^{-1}\, [T]_{\mathcal{B} \leftarrow \mathcal{B}}\, S.

Conversely, every invertible SS arises this way, from the basis whose B\mathcal{B} coordinate columns are the columns of SS.

In plain words Read the formula from right to left. Convert new coordinates to old ones with SS, apply the operator in old coordinates, and convert the result back with S−1S^{-1}. The operator stays fixed and only its description changes.

Example Let D=diag⁡(2,3)D = \operatorname{diag}(2, 3) act on R2\mathbb{R}^2 and take the new basis c1=(1,0)c_1 = (1, 0), c2=(1,1)c_2 = (1, 1), so that

S=[1101],S−1=[1−101].\begin{gathered} S = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}, \\[0.4em] S^{-1} = \begin{bmatrix} 1 & -1 \\ 0 & 1 \end{bmatrix}. \end{gathered}

Then

S−1DS=[2−103].S^{-1} D S = \begin{bmatrix} 2 & -1 \\ 0 & 3 \end{bmatrix}.

The second column can be checked directly. The operator sends c2c_2 to (2,3)(2, 3), and (2,3)=−c1+3c2(2, 3) = -c_1 + 3c_2.

Similarity invariant

Definition A function ff on Fn×n\mathbb{F}^{n \times n} is a similarity invariant if f(S−1AS)=f(A)f(S^{-1}AS) = f(A) for every A∈Fn×nA \in \mathbb{F}^{n \times n} and every invertible S∈Fn×nS \in \mathbb{F}^{n \times n}. The trace and the determinant are similarity invariants. For the trace, apply the cyclic property to the two factors S−1AS^{-1}A and SS,

tr⁡((S−1A)S)=tr⁡(S(S−1A))=tr⁡A.\begin{aligned} \operatorname{tr}\bigl((S^{-1}A)S\bigr) &= \operatorname{tr}\bigl(S(S^{-1}A)\bigr) \\[0.4em] &= \operatorname{tr} A. \end{aligned}

For the determinant, the product rule gives det⁡(S−1AS)=det⁡S−1det⁡Adet⁡S=det⁡A\det(S^{-1}AS) = \det S^{-1} \det A \det S = \det A, because det⁡S−1det⁡S=det⁡I=1\det S^{-1} \det S = \det I = 1. Neither proof needs SS to be orthogonal. The rank and the dimension of each eigenspace are similarity invariants too, since ker⁡(λI−S−1AS)=S−1ker⁡(λI−A)\ker(\lambda I - S^{-1}AS) = S^{-1}\ker(\lambda I - A). So the trace and the determinant of an operator TT on a finite-dimensional space are well defined as those of [T]B←B[T]_{\mathcal{B} \leftarrow \mathcal{B}} for any basis B\mathcal{B}. Equal trace, determinant and characteristic polynomial are necessary for similarity, but for n≥2n \ge 2 they are not sufficient.

In plain words An invariant belongs to the operator rather than to the coordinates. If two matrices differ in one invariant, they are not similar. If they agree in a few invariants such as the trace and the determinant, they still need not be similar. Watch for this. These statements are about matrices of operators. A matrix that records a two-input form follows a different rule, and its determinant can change. Writing x2+4y2x^2 + 4y^2 in the coordinates x=2ux = 2u, y=vy = v gives 4u2+4v24u^2 + 4v^2, and the determinant of the diagonal coefficient matrix goes from 44 to 1616.

Example The identity I2I_2 and the matrix

J=[1101]J = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}

both have trace 22, determinant 11 and characteristic polynomial (t−1)2(t - 1)^2. They are not similar, because S−1I2S=I2S^{-1}I_2S = I_2 for every invertible SS. The eigenspaces tell them apart as well. For the eigenvalue 11 the identity has the whole plane, while JJ has only the line spanned by e1e_1.

Characteristic polynomial

Definition The characteristic polynomial of A∈Fn×nA \in \mathbb{F}^{n \times n} is

χA(t)=det⁡(tI−A),\chi_A(t) = \det(tI - A),

where tt is a scalar variable and II is the n×nn \times n identity. In the permutation formula only the identity permutation contributes powers of tt above tn−2t^{n-2}, so χA\chi_A is monic of degree nn, the coefficient of tn−1t^{n-1} is −tr⁡A-\operatorname{tr} A, and the constant term is χA(0)=(−1)ndet⁡A\chi_A(0) = (-1)^n \det A. For n=2n = 2 this reads χA(t)=t2−(tr⁡A) t+det⁡A\chi_A(t) = t^2 - (\operatorname{tr} A)\,t + \det A. A scalar λ∈F\lambda \in \mathbb{F} is an eigenvalue of AA, meaning Av=λvAv = \lambda v for some nonzero v∈Fnv \in \mathbb{F}^n, exactly when λI−A\lambda I - A has a nonzero kernel, that is, exactly when χA(λ)=0\chi_A(\lambda) = 0. If B=S−1ASB = S^{-1}AS, then

tI−B=S−1(tI−A)StI - B = S^{-1}(tI - A)S

for every scalar tt, so χB(t)=χA(t)\chi_B(t) = \chi_A(t) at every tt. Two polynomials over R\mathbb{R} or C\mathbb{C} that agree at every scalar are equal, so χB=χA\chi_B = \chi_A. Evaluating the finished polynomial χA\chi_A at the matrix AA itself is a different question, settled later by the Cayley-Hamilton theorem.

In plain words The characteristic polynomial collects the eigenvalues into one similarity invariant, and up to sign its coefficients include the trace and the determinant.

Example For D=diag⁡(2,3)D = \operatorname{diag}(2, 3) and its similar matrix BB with rows (2,−1)(2, -1) and (0,3)(0, 3), both characteristic polynomials equal (t−2)(t−3)=t2−5t+6(t - 2)(t - 3) = t^2 - 5t + 6. For A=diag⁡(1,4)A = \operatorname{diag}(1, 4) and SS with rows (1,2)(1, 2) and (0,1)(0, 1),

S−1AS=[1−604],S^{-1}AS = \begin{bmatrix} 1 & -6 \\ 0 & 4 \end{bmatrix},

with trace 55, determinant 44 and characteristic polynomial (t−1)(t−4)=t2−5t+4(t - 1)(t - 4) = t^2 - 5t + 4, again matching AA. A real matrix need not have real eigenvalues. The quarter turn with rows (0,−1)(0, -1) and (1,0)(1, 0) has χ(t)=t2+1\chi(t) = t^2 + 1, with roots ±i\pm i in C\mathbb{C} and none in R\mathbb{R}.

Real volume factor of a complex matrix

Definition Let A∈Cn×nA \in \mathbb{C}^{n \times n} and write A=X+iYA = X + iY with X,Y∈Rn×nX, Y \in \mathbb{R}^{n \times n}. Identify Cn\mathbb{C}^n with R2n\mathbb{R}^{2n} by sending z=x+iyz = x + iy, with x,y∈Rnx, y \in \mathbb{R}^n, to the real column (x,y)(x, y). Since Az=(Xx−Yy)+i(Yx+Xy)Az = (Xx - Yy) + i(Yx + Xy), multiplication by AA becomes the real linear map with matrix

R(A)=[X−YYX]∈R2n×2n,R(A) = \begin{bmatrix} X & -Y \\ Y & X \end{bmatrix} \in \mathbb{R}^{2n \times 2n},

and its determinant is

det⁡R(A)=∣det⁡A∣2.\det R(A) = \lvert \det A \rvert^2.

So multiplication by AA scales 2n2n-dimensional real volume by ∣det⁡A∣2\lvert \det A \rvert^2, and when AA is invertible it preserves the orientation of R2n\mathbb{R}^{2n}. To prove it, work over C\mathbb{C} with the new variables z=x+iyz = x + iy and w=x−iyw = x - iy. This change of variables is invertible, with x=(z+w)/2x = (z + w)/2 and y=(z−w)/(2i)y = (z - w)/(2i). In the variables (z,w)(z, w) the map sends zz to AzAz and ww to A‾w\overline{A}w, so R(A)R(A) is similar over C\mathbb{C} to the block diagonal matrix with blocks AA and A‾\overline{A}. A block diagonal determinant is the product of the block determinants, and conjugation passes through the permutation formula, so

det⁡R(A)=det⁡A⋅det⁡A‾=∣det⁡A∣2.\begin{aligned} \det R(A) &= \det A \cdot \overline{\det A} \\[0.4em] &= \lvert \det A \rvert^2. \end{aligned}

The permutation formula gives the same value for the real matrix R(A)R(A) whether it is read over R\mathbb{R} or over C\mathbb{C}, so this is also the real determinant. The case of singular AA is included, with factor 00.

In plain words A complex determinant is not a volume. To talk about volume, view Cn\mathbb{C}^n as R2n\mathbb{R}^{2n}, and then the volume factor is the squared modulus of the complex determinant.

Example For n=1n = 1 and A=a+biA = a + bi the real matrix is

R(A)=[a−bba],R(A) = \begin{bmatrix} a & -b \\ b & a \end{bmatrix},

with determinant a2+b2=∣a+bi∣2a^2 + b^2 = \lvert a + bi \rvert^2. Multiplication by ii has complex determinant ii, while its real matrix, with rows (0,−1)(0, -1) and (1,0)(1, 0), is a quarter turn with area factor 1=∣i∣21 = \lvert i \rvert^2. Multiplication by 2+i2 + i scales areas by ∣2+i∣2=5\lvert 2 + i \rvert^2 = 5.

Check yourself

  1. Can the matrix with rows (1,2)(1, 2) and (3,4)(3, 4) be similar to the matrix with rows (2,0)(2, 0) and (1,3)(1, 3)?
Show the answer

No. Both have trace 55, but the determinants are 4−6=−24 - 6 = -2 and 6−0=66 - 0 = 6. The determinant is a similarity invariant, so the matrices are not similar. Their characteristic polynomials, t2−5t−2t^2 - 5t - 2 and t2−5t+6t^2 - 5t + 6, differ for the same reason.

  1. Show that there are no matrices A,B∈Fn×nA, B \in \mathbb{F}^{n \times n} with n≥1n \ge 1 and AB−BA=IAB - BA = I.
Show the answer

Take traces of both sides. By linearity and the cyclic property,

tr⁡(AB−BA)=tr⁡(AB)−tr⁡(BA)=0,\begin{aligned} &\operatorname{tr}(AB - BA) \\[0.4em] &\quad = \operatorname{tr}(AB) - \operatorname{tr}(BA) = 0, \end{aligned}

while tr⁡I=n\operatorname{tr} I = n. Over R\mathbb{R} or C\mathbb{C} the number n≥1n \ge 1 is not 00, so the equation is impossible.

  1. Multiplication by the matrix below is a complex linear map of C2\mathbb{C}^2, which can also be viewed as a real linear map of R4\mathbb{R}^4. By what factor does it scale 44-dimensional volume, and does it preserve orientation?
A=[2i11+i]A = \begin{bmatrix} 2 & i \\ 1 & 1 + i \end{bmatrix}
Show the answer

The complex determinant is

det⁡A=2(1+i)−i⋅1=2+i.\det A = 2(1 + i) - i \cdot 1 = 2 + i.

The real volume factor is ∣2+i∣2=4+1=5\lvert 2 + i \rvert^2 = 4 + 1 = 5. It is positive, so orientation is preserved. Neither ∣det⁡A∣=5\lvert \det A \rvert = \sqrt{5} nor the complex number 2+i2 + i is the answer. The squared modulus is what the real 4×44 \times 4 matrix R(A)R(A) has as its determinant.

How this lesson connects

It also uses similar matrices and eigenvalues from a first linear algebra course.