Course contents 04 / 16

04 / 16 · Linear Algebra

Determinants and eigenvalues

How much a square matrix scales volume, and which directions it only stretches: the determinant and its computation by elimination, eigenvalues and diagonalization, matrix powers in a Markov chain, and what goes wrong without enough eigenvectors.

On this page 6

Apply the matrix

A=(4123)A = \begin{pmatrix} 4 & 1 \\ 2 & 3 \end{pmatrix}

to x=(1,0)x = (1, 0) again and again: Ax=(4,2)Ax = (4, 2), A2x=(18,14)A^2x = (18, 14), A3x=(86,78)A^3x = (86, 78). Does AkxA^k x grow, shrink or settle? In which direction does it point for large kk, and how fast does it get there? The entries of AA do not say. A Markov chain asks the same questions about its distribution after kk steps, a recurrent network about its gradient after kk time steps, and gradient descent about its error after kk iterations.

Unlike the orthogonal matrices of the previous note, a general square matrix stretches some directions, squeezes others and turns most of them. Two kinds of numbers attached to it answer the questions. The determinant says how the map scales volume, and it is zero exactly when the map cannot be undone. The eigenvalues are the stretch factors along the directions that the map does not turn, and in those directions repeated application is the power of a number.

The determinant: how a map scales volume#

A linear map sends the unit square, spanned by e1e_1 and e2e_2, to the parallelogram spanned by the columns Ae1=a1Ae_1 = a_1 and Ae2=a2Ae_2 = a_2. Every other square of the grid goes to a shifted copy of the same parallelogram, because A(x+e1)=Ax+a1A(x + e_1) = Ax + a_1. So the map multiplies the area of every grid square, and therefore of every region that the grid approximates, by the same factor. That factor, with a sign that records whether the map keeps or reverses orientation, is the determinant.

Figure

The determinant is the factor by which a map scales area

The determinant is the factor by which a map scales areaThree panels, each with a blue unit square and an amber parallelogram spanned by the columns of a matrix. Left: A with columns (4, 2) and (1, 3), area 10, the turn from the first column to the second counterclockwise, det A = 10. Middle: C with columns (1, 2) and (2, 1), area 3, the turn clockwise, det C = −3. Right: D with columns (2, 4) and (1, 2) on one line; the square is flattened onto a segment, det D = 0.Ae₁ = (4, 2)Ae₂ = (1, 3)area 10det A = 10Ce₁ = (1, 2)Ce₂ = (2, 1)area 3det C = −3De₁ = (2, 4)De₂ = (1, 2)area 0det D = 0The determinant is the factor by which a map scales areaThree panels, each with a blue unit square and an amber parallelogram spanned by the columns of a matrix. Left: A with columns (4, 2) and (1, 3), area 10, the turn from the first column to the second counterclockwise, det A = 10. Middle: C with columns (1, 2) and (2, 1), area 3, the turn clockwise, det C = −3. Right: D with columns (2, 4) and (1, 2) on one line; the square is flattened onto a segment, det D = 0.Ae₁ = (4, 2)Ae₂ = (1, 3)area 10det A = 10(1, 2)(2, 1)area 3det C = −3(2, 4)(1, 2)area 0det D = 0
The unit square (blue) and its image (amber), the parallelogram spanned by the columns; all panels share one scale. A = [[4, 1], [2, 3]] multiplies areas by 10 and keeps the orientation. C = [[1, 2], [2, 1]] multiplies them by 3 and mirrors the plane: det C = −3. D = [[2, 1], [4, 2]] flattens the square: det D = 0.

Three properties of signed area pin the determinant down, and they are its definition in any dimension:

  1. det⁡I=1\det I = 1: the unit cube has volume 1.
  2. det⁡\det is linear in each column when the other columns are fixed. Scaling one edge of a parallelogram by cc scales its area by cc, and two parallelograms that share all edges but one, placed side by side, have areas that add.
  3. det⁡\det is zero when two columns are equal: the parallelogram is flat.

Adding a multiple of one column to another does not change the determinant, by linearity in that column and property 3; geometrically it is a shear, which slides the parallelogram along one edge without changing its area. Swapping two columns flips the sign: expanding det⁡(a+b,a+b)=0\det(a + b, a + b) = 0 by linearity leaves det⁡(a,b)+det⁡(b,a)=0\det(a, b) + \det(b, a) = 0. The sign is the orientation. A positive determinant keeps the turn from e1e_1 to e2e_2 counterclockwise; a negative one makes it clockwise, as a mirror does.

The formula for 2-by-2 matrices#

Expand each column in the standard basis and use linearity. Every term then has either a repeated basis vector, which gives 0, or the two basis vectors in some order, which gives ±1\pm 1:

det⁡(ae1+ce2,  be1+de2)=addet⁡(e1,e2)+cbdet⁡(e2,e1)=addet⁡(e1,e2)−cbdet⁡(e1,e2)swap=ad−bcdet⁡I=1.\begin{aligned} \det(ae_1 + ce_2,\; be_1 + de_2) &= ad\det(e_1, e_2) + cb\det(e_2, e_1) \\ &= ad\det(e_1, e_2) - cb\det(e_1, e_2) && \text{swap} \\ &= ad - bc && \det I = 1 . \end{aligned}

The terms abdet⁡(e1,e1)ab\det(e_1, e_1) and cddet⁡(e2,e2)cd\det(e_2, e_2) of the expansion vanish by property 3. The three matrices of the figure are

A=(4123),C=(1221),D=(2142).\begin{aligned} A &= \begin{pmatrix} 4 & 1 \\ 2 & 3 \end{pmatrix}, \\ C &= \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix}, \\ D &= \begin{pmatrix} 2 & 1 \\ 4 & 2 \end{pmatrix} . \end{aligned}

det⁡A=4⋅3−1⋅2=10\det A = 4 \cdot 3 - 1 \cdot 2 = 10: the unit square becomes a parallelogram of area 10, and the turn from Ae1=(4,2)Ae_1 = (4, 2) to Ae2=(1,3)Ae_2 = (1, 3) is still counterclockwise. det⁡C=1−4=−3\det C = 1 - 4 = -3: the area is 3, and the turn from (1,2)(1, 2) to (2,1)(2, 1) is clockwise, so CC mirrors the plane. det⁡D=4−4=0\det D = 4 - 4 = 0: the columns are parallel, the square is flattened onto a segment, and two different points, such as (1,0)(1, 0) and (0,2)(0, 2), land on the same image (2,4)(2, 4). DD has no inverse.

For n×nn \times n matrices, expanding all nn columns in the same way gives the Leibniz formula, a sum of n!n! signed products, one per permutation σ\sigma of 1,…,n1, \dots, n:

det⁡A=∑σsign⁡(σ) aσ(1)1⋯aσ(n)n.\det A = \sum_{\sigma} \operatorname{sign}(\sigma)\, a_{\sigma(1)1} \cdots a_{\sigma(n)n} .

Here sign⁡(σ)=(−1)N\operatorname{sign}(\sigma) = (-1)^N, where NN counts the pairs that σ\sigma puts out of order. The expansion uses only the three properties, so at most one function has them, and the formula itself has them, so exactly one does; both steps are in the folded derivation. The formula is useless for computation: for n=20n = 20 it has 2.4⋅10182.4 \cdot 10^{18} terms.

Derivation: the Leibniz formula

Write column jj as aj=∑iaijeia_j = \sum_i a_{ij} e_i and expand by linearity in each column in turn:

det⁡(a1,…,an)=∑i1,…,inai11⋯ainndet⁡(ei1,…,ein).\det(a_1, \dots, a_n) = \sum_{i_1, \dots, i_n} a_{i_1 1} \cdots a_{i_n n} \det(e_{i_1}, \dots, e_{i_n}) .

A term with two equal indices has two equal columns and vanishes by property 3. In every other term the indices form a permutation σ\sigma. Swapping columns two at a time sorts eσ(1),…,eσ(n)e_{\sigma(1)}, \dots, e_{\sigma(n)} into e1,…,ene_1, \dots, e_n, and each swap flips the sign. One swap of two entries changes NN by an odd number (Axler, 2024, 9.34), so every sorting uses a number of swaps with the parity of NN, and det⁡(eσ(1),…,eσ(n))=(−1)Ndet⁡I=sign⁡(σ)\det(e_{\sigma(1)}, \dots, e_{\sigma(n)}) = (-1)^N \det I = \operatorname{sign}(\sigma).

Conversely, the formula has the three properties. Each product takes one entry from every column, so the sum is linear in each column; for A=IA = I only the identity permutation survives, giving 1. If columns kk and ll are equal, pair each σ\sigma with the permutation that swaps its values at kk and ll: the two products are equal, the signs are opposite by the same parity fact, and the sum is 0 (Axler, 2024, 9.32–9.37).

Properties used everywhere#

Each follows from the three properties (Strang, 2011, lecture 18; Axler, 2024, 9.48–9.50 and 9.56). The short ones are proved in the list, the longer ones in the fold after it:

  • det⁡(AB)=det⁡Adet⁡B\det(AB) = \det A \det B. Geometrically, the map ABAB applies BB and then AA, so volumes are scaled by det⁡B\det B and then by det⁡A\det A, and two orientation reversals cancel.
  • AA is invertible exactly when det⁡A≠0\det A \ne 0, and then det⁡A−1=1/det⁡A\det A^{-1} = 1/\det A, since det⁡Adet⁡A−1=det⁡I\det A \det A^{-1} = \det I. If AA is singular, its columns are dependent, so one column is a combination of the others; subtracting that combination from it leaves a zero column without changing the determinant, and linearity in the zero column, 0=0⋅00 = 0 \cdot 0, gives det⁡A=0\det A = 0.
  • det⁡A⊤=det⁡A\det A^\top = \det A, so everything said about columns holds for rows.
  • A triangular matrix has the product of its diagonal as determinant.
  • det⁡(cA)=cndet⁡A\det(cA) = c^n \det A, because each of the nn columns is scaled. Doubling a 3×33 \times 3 matrix multiplies its determinant by 8.
  • An orthogonal matrix has det⁡Q=±1\det Q = \pm 1, from (det⁡Q)2=det⁡(Q⊤Q)=1(\det Q)^2 = \det(Q^\top Q) = 1. The rotation of the plane by θ\theta has determinant cos⁡2θ+sin⁡2θ=1\cos^2\theta + \sin^2\theta = 1. A Householder reflection has −1-1: in a basis of vv and n−1n - 1 vectors orthogonal to vv it is diag⁡(−1,1,…,1)\operatorname{diag}(-1, 1, \dots, 1), and a change of basis keeps the determinant, det⁡(S−1HS)=det⁡H\det(S^{-1}HS) = \det H, by the product rule.
Proofs: triangular matrices, products, transposes

Triangular. Let UU be upper triangular. If some ukk=0u_{kk} = 0, the first kk columns lie in the span of e1,…,ek−1e_1, \dots, e_{k-1}, so they are dependent and det⁡U=0\det U = 0, the product of the diagonal. Otherwise column 1 is u11e1u_{11} e_1, and subtracting u12/u11u_{12}/u_{11} times it from column 2 clears u12u_{12}. Working from left to right clears everything above the diagonal without changing the determinant. What remains is diag⁡(u11,…,unn)\operatorname{diag}(u_{11}, \dots, u_{nn}), whose determinant is u11⋯unndet⁡Iu_{11} \cdots u_{nn} \det I by linearity in each column. A lower triangular matrix is cleared in the same way from the right.

Products. Fix AA and let f(B)=det⁡(AB)f(B) = \det(AB). Column jj of ABAB is AbjAb_j, so ff is linear in each column of BB, vanishes when two columns of BB are equal, and has f(I)=det⁡Af(I) = \det A. The expansion that gave the Leibniz formula used nothing else, so it gives f(B)=f(I)det⁡B=det⁡Adet⁡Bf(B) = f(I) \det B = \det A \det B.

Transposes. If AA is singular, so is A⊤A^\top, which has the same rank, and both determinants are 0. Otherwise take PA=LUPA = LU; the permutation matrix is orthogonal, so A=P⊤LUA = P^\top LU and A⊤=U⊤L⊤PA^\top = U^\top L^\top P, and by the product rule

det⁡A=det⁡P⊤det⁡Ldet⁡U,det⁡A⊤=det⁡U⊤det⁡L⊤det⁡P.\begin{aligned} \det A &= \det P^\top \det L \det U , \\ \det A^\top &= \det U^\top \det L^\top \det P . \end{aligned}

Transposing a triangular matrix keeps its diagonal, so det⁡U⊤=det⁡U\det U^\top = \det U and det⁡L⊤=det⁡L=1\det L^\top = \det L = 1. The columns of PP are distinct standard basis vectors, so det⁡P=±1\det P = \pm 1 by the swap rule, and det⁡P⊤=1/det⁡P=det⁡P\det P^\top = 1/\det P = \det P. The two lines agree.

The determinant of a sum is not the sum of the determinants; there is no rule for it.

Computing a determinant by elimination#

Gaussian elimination turns AA into an upper triangular matrix with two kinds of row operations. By the transpose rule the column rules hold for rows: adding a multiple of one row to another leaves the determinant unchanged, and a row swap flips its sign. With ss swaps, the factorization PA=LUPA = LU has det⁡P=(−1)s\det P = (-1)^s, det⁡L=1\det L = 1 (ones on the diagonal) and det⁡U=u11⋯unn\det U = u_{11} \cdots u_{nn}, the product of the pivots. Taking determinants of both sides,

det⁡Pdet⁡A=det⁡Ldet⁡U(−1)sdet⁡A=u11u22⋯unndet⁡A=(−1)s u11u22⋯unn.\begin{aligned} \det P \det A &= \det L \det U \\ (-1)^s \det A &= u_{11} u_{22} \cdots u_{nn} \\ \det A &= (-1)^s\, u_{11} u_{22} \cdots u_{nn} . \end{aligned}

For

M=(211433879),M = \begin{pmatrix} 2 & 1 & 1 \\ 4 & 3 & 3 \\ 8 & 7 & 9 \end{pmatrix},

subtracting twice row 1 from row 2 and four times row 1 from row 3 gives the rows (2,1,1)(2, 1, 1), (0,1,1)(0, 1, 1) and (0,3,5)(0, 3, 5). Subtracting three times the new row 2 from row 3 gives (0,0,2)(0, 0, 2). No swaps were needed, the pivots are 2, 1 and 2, and det⁡M=4\det M = 4. Elimination costs about n3/3n^3/3 multiply–adds against the n!n! terms of the Leibniz formula: for n=20n = 20, about 2,500 instead of 2.4⋅10182.4 \cdot 10^{18}.

The log-determinant#

In machine learning the determinant rarely appears alone; its logarithm does. The density of a multivariate Gaussian contains ∣Σ∣−1/2\lvert \Sigma \rvert^{-1/2}, so its log-likelihood contains minus half of log⁡det⁡Σ\log \det \Sigma. A normalizing flow pays log⁡∣det⁡J∣\log \lvert \det J \rvert for every layer, the change-of-variables correction that the multiple integrals note derives. Flows use layers with triangular Jacobians because then the determinant is the product of the diagonal.

The log-determinant is computed as a sum of logarithms of the pivots, never as the logarithm of their product. The determinant of 0.1 I0.1\,I in 1,000 dimensions is 10−100010^{-1000}, which underflows to 0 in floating point, while its logarithm, −2302.6-2302.6, is an ordinary number. NumPy’s slogdet returns the sign and the logarithm for that reason, and Gaussian processes take it from a Cholesky factor, the subject of the next note.

Eigenvectors: directions the map only stretches#

A nonzero vector vv is an eigenvector of AA with eigenvalue λ\lambda if

Av=λv.Av = \lambda v .

Any nonzero multiple of an eigenvector is again one, so it is the direction that matters, the line through vv. On that line the map is multiplication by λ\lambda: a stretch for λ>1\lambda \gt 1, a squeeze for 0<λ<10 \lt \lambda \lt 1, a flip for negative λ\lambda, and a collapse to 00 for λ=0\lambda = 0. Most vectors are turned by the map; the eigenvectors are the exceptions.

Figure

Eigenvectors: the directions a map only stretches

Eigenvectors: the directions a map only stretchesThe unit circle (dashed) and its image under A = [[4, 1], [2, 3]], an ellipse. Blue line along (1, 1): the unit vector v₁ goes to 5v₁ on the same line. Green line along (1, −2): v₂ goes to 2v₂. The red vector e₁ goes to (4, 2) and is turned by 26.6 degrees.v₁v₂x = e₁Av₁ = 5v₁Av₂ = 2v₂Ax = (4, 2)λ₁ = 5λ₂ = 2Eigenvectors: the directions a map only stretchesThe unit circle (dashed) and its image under A = [[4, 1], [2, 3]], an ellipse. Blue line along (1, 1): the unit vector v₁ goes to 5v₁ on the same line. Green line along (1, −2): v₂ goes to 2v₂. The red vector e₁ goes to (4, 2) and is turned by 26.6 degrees.v₁v₂x5v₁2v₂Axλ₁ = 5λ₂ = 2
A = [[4, 1], [2, 3]] maps the unit circle (dashed) onto an ellipse. e₁ goes to (4, 2), turned by 26.6°. The lines along (1, 1) and (1, −2) are not turned: v₁ goes to 5v₁ and v₂ to 2v₂. The two eigenvectors are not orthogonal.

The characteristic polynomial#

How do we find the eigenvalues? λ\lambda is one exactly when A−λIA - \lambda I sends some nonzero vector to zero, that is, when it is singular, and singularity is what the determinant detects:

Av=λv for some v≠0  ⟺   (A−λI)v=0 for some v≠0  ⟺   A−λI is not invertible  ⟺   det⁡(A−λI)=0.\begin{aligned} & Av = \lambda v \text{ for some } v \ne 0 \\ \iff\ & (A - \lambda I)v = 0 \text{ for some } v \ne 0 \\ \iff\ & A - \lambda I \text{ is not invertible} \\ \iff\ & \det(A - \lambda I) = 0 . \end{aligned}

The second step uses that a square matrix is invertible exactly when its kernel is {0}\{0\} (matrices note). det⁡(A−λI)\det(A - \lambda I) is a polynomial of degree nn in λ\lambda, the characteristic polynomial: in the Leibniz formula every entry of A−λIA - \lambda I is a number or a number minus λ\lambda, so each product has degree at most nn, and only the product of the diagonal reaches λn\lambda^n, with the coefficient (−1)n(-1)^n. The eigenvalues are its roots. Once λ\lambda is known, its eigenvectors are the nonzero vectors of the kernel of A−λIA - \lambda I, found by elimination. For a 2×22 \times 2 matrix,

det⁡(a−λbcd−λ)=(a−λ)(d−λ)−bc=λ2−(a+d)λ+(ad−bc),\begin{aligned} \det\begin{pmatrix} a - \lambda & b \\ c & d - \lambda \end{pmatrix} &= (a - \lambda)(d - \lambda) - bc \\ &= \lambda^2 - (a + d)\lambda + (ad - bc) , \end{aligned}

that is, λ2−(tr⁡A)λ+det⁡A\lambda^2 - (\operatorname{tr} A)\lambda + \det A, where the trace tr⁡A\operatorname{tr} A is the sum of the diagonal entries.

For the opening matrix the trace is 7 and the determinant 10, so the characteristic polynomial is λ2−7λ+10=(λ−5)(λ−2)\lambda^2 - 7\lambda + 10 = (\lambda - 5)(\lambda - 2), with eigenvalues λ1=5\lambda_1 = 5 and λ2=2\lambda_2 = 2. The eigenvectors come from

A−5I=(−112−2),A−2I=(2121).\begin{aligned} A - 5I &= \begin{pmatrix} -1 & 1 \\ 2 & -2 \end{pmatrix}, \\ A - 2I &= \begin{pmatrix} 2 & 1 \\ 2 & 1 \end{pmatrix} . \end{aligned}

Both rows of A−5IA - 5I say x1=x2x_1 = x_2, so v1=(1,1)v_1 = (1, 1), and indeed Av1=(5,5)=5v1Av_1 = (5, 5) = 5v_1. Both rows of A−2IA - 2I say 2x1+x2=02x_1 + x_2 = 0, so v2=(1,−2)v_2 = (1, -2), and Av2=(2,−4)=2v2Av_2 = (2, -4) = 2v_2. The two eigenvectors are not orthogonal, v1⊤v2=−1v_1^\top v_2 = -1; for a non-symmetric matrix that is the normal case.

An eigenvector of AA is also an eigenvector of the matrices built from AA: if Av=λvAv = \lambda v, then A2v=λ2vA^2 v = \lambda^2 v, A−1v=λ−1vA^{-1}v = \lambda^{-1} v and (A+cI)v=(λ+c)v(A + cI)v = (\lambda + c)v (Strang, 2016, section 6.1). Apply AA once more; multiply by λ−1A−1\lambda^{-1}A^{-1}, for an invertible AA, whose eigenvalues are nonzero; add cvcv. No other eigenvalues appear, since A+cI−μI=A−(μ−c)IA + cI - \mu I = A - (\mu - c)I and, for μ≠0\mu \ne 0, A−1−μI=−μA−1(A−μ−1I)A^{-1} - \mu I = -\mu A^{-1}(A - \mu^{-1} I). For the opening matrix, A+3IA + 3I has eigenvalues 8 and 5, and A−1A^{-1} has 0.20.2 and 0.50.5. The shift is what ridge regression does to X⊤XX^\top X: adding λI\lambda I raises every eigenvalue by λ\lambda and keeps the eigenvectors. Eigenvalues of a sum or a product of two different matrices follow no such rule.

Not every real matrix has a real eigenvector. The rotation by 90°90°,

R=(0−110),R = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix},

turns every direction. Its characteristic polynomial is λ2+1\lambda^2 + 1, with roots ±i\pm i. By the fundamental theorem of algebra, every polynomial of degree nn has nn complex roots counted with multiplicity (Axler, 2024, 4.12–4.13), so every n×nn \times n matrix has nn eigenvalues in C\mathbb C. Its proof needs some analysis: ∣p(z)∣\lvert p(z)\rvert grows without bound as ∣z∣→∞\lvert z\rvert \to \infty, so it has a smallest value, and at a point where p≠0p \ne 0 a small step always makes ∣p∣\lvert p\rvert smaller, so the smallest value is 0.

A real matrix has its complex eigenvalues in conjugate pairs: conjugating p(λ)=0p(\lambda) = 0 for a polynomial with real coefficients gives p(λˉ)=0p(\bar\lambda) = 0 (Axler, 2024, 4.14). Each pair describes a rotation within a plane. If λ=a+bi\lambda = a + bi with b≠0b \ne 0 has the eigenvector x+iyx + iy, the real and imaginary parts of A(x+iy)=λ(x+iy)A(x + iy) = \lambda(x + iy) give Ax=ax−byAx = ax - by and Ay=bx+ayAy = bx + ay: on the plane of xx and yy the map is a rotation scaled by ∣λ∣\lvert\lambda\rvert. The next note shows that symmetric matrices never have them.

Trace and determinant from the eigenvalues#

Let λ1,…,λn\lambda_1, \dots, \lambda_n be the nn eigenvalues counted with multiplicity, possibly complex. Then

tr⁡A=λ1+λ2+⋯+λn,det⁡A=λ1λ2⋯λn.\begin{aligned} \operatorname{tr} A &= \lambda_1 + \lambda_2 + \dots + \lambda_n, \\ \det A &= \lambda_1 \lambda_2 \cdots \lambda_n . \end{aligned}

To see why, compare two expansions of p(λ)=det⁡(λI−A)p(\lambda) = \det(\lambda I - A), which has leading coefficient 1 and the same roots as det⁡(A−λI)\det(A - \lambda I). Factored over its roots, which the fundamental theorem of algebra allows, and multiplied out, it is

p(λ)=(λ−λ1)⋯(λ−λn)=λn−(λ1+⋯+λn)λn−1+⋯+(−1)nλ1⋯λn.\begin{aligned} p(\lambda) &= (\lambda - \lambda_1)\cdots(\lambda - \lambda_n) \\ &= \lambda^n - (\lambda_1 + \dots + \lambda_n)\lambda^{n-1} + \dots + (-1)^n \lambda_1 \cdots \lambda_n . \end{aligned}

Expanded by the Leibniz formula, the product of the diagonal entries is one term, and every other term leaves out at least two diagonal entries, so it has at most n−2n - 2 factors of λ\lambda. A permutation that moves one index moves at least two: if σ(i)=j≠i\sigma(i) = j \ne i, then σ(j)≠j\sigma(j) \ne j, since σ(j)=j=σ(i)\sigma(j) = j = \sigma(i) would contradict that σ\sigma is one-to-one. So

p(λ)=(λ−a11)⋯(λ−ann)+(degree≤n−2)=λn−(a11+⋯+ann)λn−1+…\begin{aligned} p(\lambda) &= (\lambda - a_{11})\cdots(\lambda - a_{nn}) + (\text{degree} \le n - 2) \\ &= \lambda^n - (a_{11} + \dots + a_{nn})\lambda^{n-1} + \dots \end{aligned}

The coefficients of λn−1\lambda^{n-1} give the trace. For the determinant, set λ=0\lambda = 0: p(0)=det⁡(−A)=(−1)ndet⁡Ap(0) = \det(-A) = (-1)^n \det A, and the first expansion gives p(0)=(−1)nλ1⋯λnp(0) = (-1)^n\lambda_1\cdots\lambda_n.

For the opening matrix, 5+2=7=4+35 + 2 = 7 = 4 + 3 and 5⋅2=10=det⁡A5 \cdot 2 = 10 = \det A. For the rotation RR, i+(−i)=0=tr⁡Ri + (-i) = 0 = \operatorname{tr} R and i⋅(−i)=1=det⁡Ri \cdot (-i) = 1 = \det R. Two consequences follow at once: a matrix is singular exactly when 0 is one of its eigenvalues, and the total variance tr⁡Σ\operatorname{tr}\Sigma of a covariance matrix is the sum of its eigenvalues, the identity behind explained variance in PCA.

Diagonalization and matrix powers#

Write the nn eigenvector equations Avi=λiviAv_i = \lambda_i v_i side by side as the columns of one matrix equation. With V=[v1 ⋯ vn]V = [v_1 \ \cdots \ v_n] and the diagonal Λ=diag⁡(λ1,…,λn)\Lambda = \operatorname{diag}(\lambda_1, \dots, \lambda_n), multiplying VV by Λ\Lambda on the right scales its columns, so

AV=VΛ.AV = V\Lambda .

If the nn eigenvectors are independent, VV is invertible, and multiplying by V−1V^{-1} on the right gives A=VΛV−1A = V\Lambda V^{-1}: in the basis of its eigenvectors, AA is diagonal. Every power then reduces to a power of Λ\Lambda, because each inner V−1VV^{-1}V is II:

Ak=(VΛV−1)(VΛV−1)⋯(VΛV−1)=VΛkV−1,\begin{aligned} A^k &= (V\Lambda V^{-1})(V\Lambda V^{-1})\cdots(V\Lambda V^{-1}) \\ &= V\Lambda^k V^{-1} , \end{aligned}

and Λk\Lambda^k is diagonal with entries λik\lambda_i^k. Read from right to left, Akx=VΛkV−1xA^k x = V\Lambda^k V^{-1}x finds the coordinates c=V−1xc = V^{-1}x of xx in the eigenvector basis, multiplies the ii-th by λik\lambda_i^k, and goes back:

Akx=c1λ1kv1+⋯+cnλnkvn.A^k x = c_1\lambda_1^k v_1 + \dots + c_n\lambda_n^k v_n .

So, for a diagonalizable AA, Ak→0A^k \to 0 exactly when every ∣λi∣<1\lvert \lambda_i \rvert \lt 1 (Strang, 2011, lecture 22): AkA^k tends to 0 exactly when Λk=V−1AkV\Lambda^k = V^{-1}A^kV does, and ∣λik∣=∣λi∣k\lvert\lambda_i^k\rvert = \lvert\lambda_i\rvert^k. For the opening example, x=(1,0)x = (1, 0) has the coordinates c1=2/3c_1 = 2/3 and c2=1/3c_2 = 1/3 in the basis v1=(1,1)v_1 = (1, 1), v2=(1,−2)v_2 = (1, -2), and

Akx=23 5k(11)+13 2k(1−2),A3x=2503(11)+83(1−2)=(8678).\begin{aligned} A^k x &= \frac23\, 5^k \begin{pmatrix} 1 \\ 1 \end{pmatrix} + \frac13\, 2^k \begin{pmatrix} 1 \\ -2 \end{pmatrix} , \\ A^3 x &= \frac{250}{3} \begin{pmatrix} 1 \\ 1 \end{pmatrix} + \frac83 \begin{pmatrix} 1 \\ -2 \end{pmatrix} = \begin{pmatrix} 86 \\ 78 \end{pmatrix} . \end{aligned}

The opening questions now have answers. AkxA^kx grows like 5k5^k, and its direction approaches (1,1)(1, 1). The other component shrinks relative to it by the factor (2/5)k(2/5)^k, about 10−410^{-4} after 10 steps. The ratio of the second-largest to the largest eigenvalue sets the speed in every iteration of this kind: power iteration for the leading eigenvector, PageRank, and the mixing of Markov chains below. It also explains the vanishing and exploding gradients of recurrent networks, whose gradient through kk time steps contains kk factors of the recurrent weight matrix, and why the error of gradient descent on a quadratic shrinks along each eigenvector at its own rate.

Are there always enough independent eigenvectors? Distinct eigenvalues are sufficient, because eigenvectors with different eigenvalues are independent (Axler, 2024, 5.11). For two of them: if c1v1+c2v2=0c_1v_1 + c_2v_2 = 0, applying AA gives c1λ1v1+c2λ2v2=0c_1\lambda_1v_1 + c_2\lambda_2v_2 = 0. Subtracting λ2\lambda_2 times the first equation leaves c1(λ1−λ2)v1=0c_1(\lambda_1 - \lambda_2)v_1 = 0, so c1=0c_1 = 0, and then c2=0c_2 = 0.

Proof for any number of eigenvectors

Suppose v1,…,vmv_1, \dots, v_m have distinct eigenvalues and are dependent, with mm the smallest number for which this happens, so any m−1m - 1 of them are independent. Take c1v1+⋯+cmvm=0c_1v_1 + \dots + c_mv_m = 0 with not all cic_i zero. Applying A−λmIA - \lambda_m I gives

∑i<mci(λi−λm)vi=0.\sum_{i \lt m} c_i(\lambda_i - \lambda_m)v_i = 0 .

The first m−1m - 1 vectors are independent, so every ci(λi−λm)=0c_i(\lambda_i - \lambda_m) = 0, and since the eigenvalues are distinct, c1=⋯=cm−1=0c_1 = \dots = c_{m-1} = 0. Then cmvm=0c_mv_m = 0 forces cm=0c_m = 0, a contradiction.

Repeated eigenvalues may or may not come with enough eigenvectors; the last section shows a case where they do not.

Powers of a Markov transition matrix#

The Markov chains note of the probability course models the weather (sunny, cloudy, rainy) with the transition matrix

P=(0.70.20.10.30.40.30.20.30.5),P = \begin{pmatrix} 0.7 & 0.2 & 0.1 \\ 0.3 & 0.4 & 0.3 \\ 0.2 & 0.3 & 0.5 \end{pmatrix} ,

where row ii holds the probabilities of moving from state ii. A distribution over states is a row vector π\pi that evolves as πt=π0Pt\pi_t = \pi_0 P^t. That note stated two facts that diagonalization explains: the distribution converges to the stationary π=(21,13,12)/46\pi = (21, 13, 12)/46, and the distance to it shrinks like 0.473t0.473^t.

Every row of PP sums to 1, so P(1,1,1)⊤=(1,1,1)⊤P(1, 1, 1)^\top = (1, 1, 1)^\top and 1 is an eigenvalue. A matrix and its transpose have the same characteristic polynomial, since P⊤−λIP^\top - \lambda I is the transpose of P−λIP - \lambda I and transposing keeps the determinant, so 1 is also an eigenvalue of P⊤P^\top. Its eigenvector, written as a row, satisfies πP=π\pi P = \pi: the stationary distribution is a left eigenvector of PP.

The trace gives 1+λ2+λ3=1.61 + \lambda_2 + \lambda_3 = 1.6, so λ2+λ3=0.6\lambda_2 + \lambda_3 = 0.6. Elimination without swaps, as in the section above, gives the pivots 0.70.7, 11/3511/35 and 3/113/11, so det⁡P=0.06\det P = 0.06 and λ2λ3=0.06\lambda_2 \lambda_3 = 0.06. The two eigenvalues are therefore the roots of λ2−0.6λ+0.06\lambda^2 - 0.6\lambda + 0.06:

λ2=0.3+0.03≈0.473,λ3=0.3−0.03≈0.127.\begin{aligned} \lambda_2 &= 0.3 + \sqrt{0.03} \approx 0.473 , \\ \lambda_3 &= 0.3 - \sqrt{0.03} \approx 0.127 . \end{aligned}

As a check, (0.3+0.03)(0.3−0.03)=0.09−0.03=0.06(0.3 + \sqrt{0.03})(0.3 - \sqrt{0.03}) = 0.09 - 0.03 = 0.06. The three eigenvalues are distinct, so P⊤P^\top is diagonalizable, and by the formula for AkxA^kx applied to P⊤P^\top and π0⊤\pi_0^\top, the distribution after tt steps is a combination of 1t1^t, 0.473t0.473^t and 0.127t0.127^t times the left eigenvectors. The first term is the stationary distribution, and it is the only one that survives:

πt=π+α2 0.473t w2⊤+α3 0.127t w3⊤,\pi_t = \pi + \alpha_2\, 0.473^t\, w_2^\top + \alpha_3\, 0.127^t\, w_3^\top ,

where w2,w3w_2, w_3 are the other left eigenvectors and α2,α3\alpha_2, \alpha_3 depend on the starting distribution. Why is the first term exactly π\pi? A left eigenvector ww with eigenvalue μ≠1\mu \ne 1 has entries summing to 0: with 1=(1,1,1)⊤\mathbf 1 = (1, 1, 1)^\top, w⊤1=w⊤P1=μ w⊤1w^\top \mathbf 1 = w^\top P \mathbf 1 = \mu\, w^\top \mathbf 1. Every πt\pi_t sums to 1, so the term along the eigenvalue 1 sums to 1, and the only multiple of π\pi that does is π\pi. The distance to π\pi therefore shrinks by a factor approaching ∣λ2∣=0.473\lvert \lambda_2 \rvert = 0.473 per step, whatever the start with α2≠0\alpha_2 \ne 0. From a sunny day the total absolute difference ∥πt−π∥1\lVert \pi_t - \pi \rVert_1 is 1.0871.087 at t=0t = 0, 0.4870.487 at t=1t = 1 and 5.7⋅10−45.7 \cdot 10^{-4} at t=10t = 10:

Figure

The distance to the stationary distribution shrinks like |λ₂|ᵗ

The distance to the stationary distribution shrinks like |λ₂|ᵗLog scale vertically, step t from 0 to 20 horizontally. Three nearly parallel lines, from a sunny, a cloudy and a rainy first day, fall from about 1 to about 3·10⁻⁷. A dashed line with slope 0.473 per step runs along them.110⁻²10⁻⁴10⁻⁶05101520step t‖πₜ − π‖₁ (log scale)× 0.473 per stepfrom sunnyfrom cloudyfrom rainyThe distance to the stationary distribution shrinks like |λ₂|ᵗLog scale vertically, step t from 0 to 20 horizontally. Three nearly parallel lines, from a sunny, a cloudy and a rainy first day, fall from about 1 to about 3·10⁻⁷. A dashed line with slope 0.473 per step runs along them.110⁻²10⁻⁴10⁻⁶05101520step t‖πₜ − π‖₁ (log scale)× 0.473 per stepfrom sunnyfrom cloudyfrom rainy
The weather chain: the total absolute difference between the distribution after t steps and the stationary one, on a log scale, from three starting states. The curves become parallel lines with slope |λ₂| ≈ 0.473 per step (dashed); the start only shifts them, and λ₃ ≈ 0.127 matters only for the first steps.

The gap between 1 and ∣λ2∣\lvert \lambda_2 \rvert, the spectral gap, decides whether a chain mixes fast or slowly, and MCMC samplers try to keep it large.

Where it breaks#

When diagonalization fails#

The shear

J=(1101)J = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}

has characteristic polynomial (1−λ)2(1 - \lambda)^2, so its only eigenvalue is 1, a double root. Its eigenvectors form the kernel of

J−I=(0100),J - I = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix},

which is the line through (1,0)(1, 0) alone. The geometric multiplicity of the eigenvalue, the dimension of its eigenvector space, is 1; its algebraic multiplicity, the multiplicity as a root, is 2. There is no basis of eigenvectors, and JJ cannot be diagonalized; this is the standard defective example (Oseledets, 2024, lecture 6).

The eigenvalues then no longer predict the powers. Both eigenvalues of JJ have absolute value 1, yet

Jk=(1k01)J^k = \begin{pmatrix} 1 & k \\ 0 & 1 \end{pmatrix}

grows without bound, linearly in kk: multiplying JkJ^k by JJ on the right adds the first column to the second, which raises the corner from kk to k+1k + 1.

Every square matrix can still be brought, over C\mathbb C, to an almost diagonal form, the Jordan form, with blocks λI+N\lambda I + N on the diagonal (Axler, 2024, 8.46). In a block of size mm, NN has ones just above the diagonal, shifts each basis vector to the previous one, and so has Nm=0N^m = 0. The proof is beyond this note; the shear is the picture: a repeated eigenvalue short of eigenvectors leaves a chain of vectors that the map pushes into one another. Because λI\lambda I and NN commute, the binomial theorem applies:

(λI+N)k=∑j=0m−1(kj)λk−jNj.(\lambda I + N)^k = \sum_{j=0}^{m-1} \binom{k}{j} \lambda^{k-j} N^j .

The entries are polynomials in kk of degree below mm times powers of λ\lambda. So the eigenvalues still decide whether Ak→0A^k \to 0, exactly when every ∣λ∣<1\lvert\lambda\rvert \lt 1, since kj∣λ∣k→0k^j \lvert\lambda\rvert^k \to 0 (the ratio of consecutive terms tends to ∣λ∣\lvert\lambda\rvert), but only up to such polynomial factors.

Exactly defective matrices are rare in practice, since an arbitrarily small change separates the repeated eigenvalue. Nearly defective ones are common and cause the real trouble. Adding ε\varepsilon to the corner of JJ gives distinct eigenvalues 1 and 1+ε1 + \varepsilon, the diagonal entries of a triangular matrix, since det⁡(Jε−λI)=(1−λ)(1+ε−λ)\det(J_\varepsilon - \lambda I) = (1 - \lambda)(1 + \varepsilon - \lambda) by the triangular rule, with eigenvectors (1,0)(1, 0) and (1,ε)(1, \varepsilon), almost parallel. For ε=10−8\varepsilon = 10^{-8} the condition number of VV is 2⋅1082 \cdot 10^8, and VΛkV−1V\Lambda^kV^{-1}, computed from a nearly singular basis, loses about eight digits in floating point, a relative error of about κ(V) u=2⋅108⋅10−16\kappa(V)\, u = 2 \cdot 10^8 \cdot 10^{-16} with the rounding unit uu; the conditioning note derives this bound. Symmetric matrices avoid the problem with an orthonormal basis of eigenvectors (next note), and every matrix has a decomposition with orthonormal bases on both sides, the singular value decomposition.

The determinant does not measure near-singularity#

det⁡(0.1 I)=10−100\det(0.1\,I) = 10^{-100} in 100 dimensions, yet 0.1 I0.1\,I is as easy to invert as II. The matrix with rows (1,1)(1, 1) and (1,1+10−12)(1, 1 + 10^{-12}) has a determinant of about 10−1210^{-12} too, and it is nearly singular: a change of 10−1210^{-12} in one entry makes it singular. A small determinant can come from scale alone. The right measure is the condition number of the conditioning note, the ratio of the largest to the smallest singular value: 1 for 0.1 I0.1\,I, and 4⋅10124 \cdot 10^{12} for the second matrix.

Eigenvalues are not computed from the polynomial#

The characteristic polynomial is a tool for proofs and small examples. For n≥5n \ge 5 there is no general formula for the roots of a polynomial in radicals, the Abel–Ruffini theorem of Galois theory: such a formula exists only when the group of permutations of the roots that respect their algebraic relations is solvable, and for n≥5n \ge 5 it need not be. Every polynomial with leading coefficient (−1)n(-1)^n is the characteristic polynomial of some n×nn \times n matrix, its companion matrix, so no such formula can give the eigenvalues of every 5×55 \times 5 matrix, and every eigenvalue algorithm is iterative (Trefethen and Bau, 1997, lecture 25). The roots of the characteristic polynomial are also badly conditioned functions of its coefficients. The diagonal matrix with entries 1,2,…,201, 2, \dots, 20 has eigenvalues 1,…,201, \dots, 20, which an eigenvalue routine returns exactly. Its characteristic polynomial has coefficients up to about 101910^{19}, which double precision rounds, and the roots of the rounded polynomial are off by up to 0.0390.039. Libraries work on the matrix itself, with the QR algorithm.

What you should remember#

  • det⁡A\det A is the signed factor by which AA scales volume, ad−bcad - bc in 2D; it is zero exactly when AA is singular, and det⁡(AB)=det⁡Adet⁡B\det(AB) = \det A \det B.
  • Compute it by elimination, as (−1)s(-1)^s times the product of the pivots, and use the log-determinant in likelihoods.
  • Eigenvalues are the roots of det⁡(A−λI)\det(A - \lambda I); tr⁡A\operatorname{tr} A is their sum and det⁡A\det A their product.
  • With nn independent eigenvectors, A=VΛV−1A = V\Lambda V^{-1} and Ak=VΛkV−1A^k = V\Lambda^kV^{-1}; distinct eigenvalues guarantee it.
  • The largest ∣λ∣\lvert\lambda\rvert dominates AkA^k, and ∣λ2/λ1∣\lvert\lambda_2/\lambda_1\rvert sets the speed; a Markov chain approaches π\pi like ∣λ2∣t\lvert\lambda_2\rvert^t.
  • A shear has one eigenvector for a double eigenvalue, and its powers grow although ∣λ∣=1\lvert\lambda\rvert = 1.

Code#

The note’s examples checked with NumPy: the determinant by elimination against the library, the log-determinant that does not underflow, the eigenvalues, trace and determinant identities, shifts and powers, matrix powers through diagonalization, the weather chain, and the three failures. It runs in well under a second; exact digits in the last places can differ across platforms and library versions.

import math
import numpy as np

# 1. 2x2 determinants: area 10, a mirror with -3, a flattened square with 0
A = np.array([[4.0, 1.0], [2.0, 3.0]])
C = np.array([[1.0, 2.0], [2.0, 1.0]])
D = np.array([[2.0, 1.0], [4.0, 2.0]])
print([round(float(np.linalg.det(m)), 6) for m in (A, C, D)])
# [10.0, -3.0, 0.0]

# 2. the determinant from the pivots of elimination with partial pivoting: (-1)^swaps times their product
def det_by_elimination(M):
    U = M.astype(float).copy(); n = len(U); sign = 1.0
    for k in range(n):
        p = k + np.argmax(np.abs(U[k:, k]))          # the largest pivot candidate, for stability
        if U[p, k] == 0: return 0.0
        if p != k: U[[k, p]] = U[[p, k]]; sign = -sign
        U[k + 1:] -= np.outer(U[k + 1:, k] / U[k, k], U[k])
    return sign * np.prod(np.diag(U))
M = np.array([[2.0, 1.0, 1.0], [4.0, 3.0, 3.0], [8.0, 7.0, 9.0]])
rng = np.random.default_rng(0)
R = rng.normal(size=(6, 6))
print(round(det_by_elimination(M), 6), round(det_by_elimination(R), 6), round(float(np.linalg.det(R)), 6))
# 4.0 -2.340511 -2.340511
# (the hand elimination of the note used no swaps; partial pivoting swaps rows but the determinant is the same)
print(sum((20 - k) ** 2 for k in range(1, 20)), f'{math.factorial(20):.1e}')   # 2470 2.4e+18: elimination against Leibniz

# 3. properties: products, transposes, scaling, inverses
B = rng.normal(size=(6, 6))
print(np.isclose(np.linalg.det(R @ B), np.linalg.det(R) * np.linalg.det(B)),
      np.isclose(np.linalg.det(R.T), np.linalg.det(R)),
      np.isclose(np.linalg.det(2 * R), 2**6 * np.linalg.det(R)),
      np.isclose(np.linalg.det(np.linalg.inv(R)), 1 / np.linalg.det(R)))
# True True True True

# 4. the determinant underflows, the log-determinant does not
S = 0.1 * np.eye(1000)
sign, logdet = np.linalg.slogdet(S)
print(np.linalg.det(S), float(sign), round(float(logdet), 4))
# 0.0 1.0 -2302.5851

# 5. eigenvalues and eigenvectors of A; trace = sum and det = product, also for a random matrix
lam, V = np.linalg.eig(A)
lam, V = lam.real, V.real                            # real here; NumPy may return a complex type
print(lam, (V / V[0]).round(6).T.tolist())          # eigenvectors scaled so their first entry is 1
print(np.isclose(lam.sum(), np.trace(A)), np.isclose(lam.prod(), np.linalg.det(A)))
lr = np.linalg.eigvals(R)                            # complex in general, in conjugate pairs
print(np.isclose(lr.sum(), np.trace(R)), np.isclose(lr.prod(), np.linalg.det(R)), np.iscomplexobj(lr))
# [5. 2.] [[1.0, 1.0], [1.0, -2.0]]
# True True
# True True True
# shifts and inverses keep the eigenvectors and move the eigenvalues
print(np.sort(np.linalg.eigvals(A + 3 * np.eye(2)).real), np.sort(np.linalg.eigvals(np.linalg.inv(A)).real))
# [5. 8.] [0.2 0.5]

# 6. powers through diagonalization: A^k x = V Lambda^k V^-1 x, and A^3 x = (86, 78)
x = np.array([1.0, 0.0])
c = np.linalg.solve(V, x)
for k in (3, 10):
    print(k, np.linalg.matrix_power(A, k) @ x, (V @ (lam**k * c)).round(6))
print((np.linalg.solve(np.array([[1.0, 1.0], [1.0, -2.0]]), x)).round(6))   # coordinates in the basis (1, 1), (1, -2)
# 3 [86. 78.] [86. 78.]
# 10 [6510758. 6509734.] [6510758. 6509734.]
# [0.666667 0.333333]

# 7. the weather chain: eigenvalues, the stationary distribution, and convergence like 0.473^t
P = np.array([[0.7, 0.2, 0.1], [0.3, 0.4, 0.3], [0.2, 0.3, 0.5]])
mu, W = np.linalg.eig(P.T)                           # left eigenvectors of P
order = np.argsort(-np.abs(mu)); mu, W = mu[order].real, W[:, order].real
pi = W[:, 0] / W[:, 0].sum()
print(mu.round(4), (0.3 + np.sqrt(0.03)).round(4), round(float(np.linalg.det(P)), 6), (pi * 46).round(6))
p, dist = np.array([1.0, 0.0, 0.0]), []
for t in range(21):
    dist.append(np.abs(p - pi).sum()); p = p @ P
print([f'{dist[t]:.3g}' for t in (0, 1, 2, 10, 20)], round(dist[20] / dist[19], 4))
# [1.     0.4732 0.1268] 0.4732 0.06 [21. 13. 12.]
# ['1.09', '0.487', '0.227', '0.000567', '3.19e-07'] 0.4732

# 8. the shear: one eigenvector for a double eigenvalue, and powers that grow although |lambda| = 1
J = np.array([[1.0, 1.0], [0.0, 1.0]])
print(np.linalg.eigvals(J).real, np.linalg.matrix_rank(J - np.eye(2)), np.linalg.matrix_power(J, 50).tolist())
eps = 1e-8
lam_e, V_e = np.linalg.eig(np.array([[1.0, 1.0], [0.0, 1.0 + eps]]))
print(lam_e.real, f'{np.linalg.cond(V_e):.2g}')          # nearly parallel eigenvectors: V is nearly singular
# [1. 1.] 1 [[1.0, 50.0], [0.0, 1.0]]
# [1.         1.00000001] 2e+08

# 9. a small determinant is not near-singularity; the condition number is
N = np.array([[1.0, 1.0], [1.0, 1.0 + 1e-12]])
print(f'{np.linalg.det(0.1 * np.eye(100)):.0e} {np.linalg.cond(0.1 * np.eye(100)):.0f} {np.linalg.det(N):.0e} {np.linalg.cond(N):.0e}')
# 1e-100 1 1e-12 4e+12

# 10. eigenvalues from the characteristic polynomial: rounding its coefficients moves the roots
lam20 = np.arange(1.0, 21.0)
roots = np.sort(np.roots(np.poly(lam20)).real)
print(f'{np.abs(np.poly(lam20)).max():.1e}', round(np.abs(roots - lam20).max(), 3), np.abs(np.sort(np.linalg.eigvals(np.diag(lam20)).real) - lam20).max())
# 1.4e+19 0.039 0.0

Next#

The eigenvectors of the opening matrix were not orthogonal, the rotation had none in real space, and the shear had too few. The matrices that machine learning builds most often, covariance matrices, Hessians, kernel matrices and X⊤XX^\top X, have none of these problems because they are symmetric. The next note proves that a symmetric matrix always has real eigenvalues and an orthonormal basis of eigenvectors, and uses them to read the shape of a quadratic form, to test positive definiteness and to find the directions of largest and smallest curvature.

References#

  • G. Strang. Introduction to Linear Algebra, 5th ed. Wellesley-Cambridge Press, 2016. Section 6.1 (introduction to eigenvalues: det⁡(A−λI)=0\det(A - \lambda I) = 0, trace and determinant checks, powers, shifts and inverses).
  • G. Strang. 18.06SC Linear Algebra, MIT OpenCourseWare, 2011. Lecture summaries: properties of determinants (lecture 18) and diagonalization and powers of A (lecture 22).
  • S. Axler. Linear Algebra Done Right, 4th ed. Springer, 2024 (open access). 4.12–4.14 (the fundamental theorem of algebra; real polynomials have nonreal zeros in pairs), section 5A, 5.11 (eigenvectors of distinct eigenvalues are independent), 8.46 (Jordan form), section 9C, 9.32–9.37 (the sign of a permutation and the formula for alternating forms), 9.48–9.50 and 9.56 (triangular matrices, products, invertibility, transposes), 9.61 (the volume factor ∣det⁡T∣\lvert\det T\rvert).
  • L. N. Trefethen, D. Bau III. Numerical Linear Algebra. SIAM, 1997. Lecture 25 (overview of eigenvalue algorithms: why every eigenvalue solver must be iterative).
  • I. Oseledets. Numerical Linear Algebra, course notebooks, 2024. Lecture 6 (eigenvalues and eigenvectors, diagonalizability and the defective matrix with a double eigenvalue, PageRank as an eigenproblem).