linear-algebra · intermediate · 55 min read

Eigenvalues & Eigenvectors

Spectral theory and the geometry of symmetric operators

Abstract. Eigenvalues and eigenvectors organize a linear map by its invariant directions — the vectors a map merely stretches without rotating. We define eigenvalues via the equation Av = λv, develop the characteristic polynomial p_A(λ) = det(λI − A) as their generator, characterize diagonalizability as the existence of an eigenbasis, and prove the spectral theorem for symmetric matrices: every real symmetric matrix factors as A = QΛQᵀ with Q orthogonal and Λ diagonal-real. The geometric reading is that a symmetric matrix is a uniform scaling along a set of mutually perpendicular axes. From the spectral theorem we read off the classification of quadratic forms x^T A x as positive-definite, indefinite, or negative-definite by the signs of the eigenvalues, the Rayleigh quotient characterization of the largest and smallest eigenvalues as extrema on the unit sphere, and the Courant-Fischer min-max principle that captures every eigenvalue as a constrained extremum. The same eigenvalues are the variances along the principal axes of a data ellipsoid, the curvatures of a smooth loss surface at a critical point, and the decay rates of gradient descent — three apparently different ML quantities that are the same spectral object read three ways. The reader leaves with the spectral picture that every later optimization, PCA, SVD, and kernel-methods argument quietly assumes.

1. The Question of Invariant Directions

The Linear Algebra topic closed with a question we deliberately did not answer. Given a linear map T ⁣:VVT \colon V \to V — a function that sends straight lines to straight lines, parallels to parallels, and the origin to itself — are there directions in VV that TT does not rotate? Not directions TT fixes pointwise (that would be far too restrictive), but directions where the action of TT is purely a scaling: lines through the origin that get mapped to themselves, possibly stretched, possibly flipped, but never tilted off-axis.

The question is so geometric it deserves three pictures before any algebra. Picture a uniform scaling by some positive factor — say T(x)=2xT(\mathbf{x}) = 2\mathbf{x}. Every direction in VV is invariant: every line through the origin is mapped to itself, every arrow stretched by exactly two. The map has, in a strong sense, all directions as invariant directions. Picture next a rotation by π/4\pi/4 around the origin. No direction is invariant: every line through the origin tilts by 45°45° when you apply TT, so no line is mapped to itself. The map has no real invariant directions at all. Picture finally a horizontal shear, the linear map that sends (x,y)(x+0.5y,y)(x, y) \mapsto (x + 0.5\,y, y). Exactly one direction is invariant: the xx-axis, where vectors of the form (c,0)(c, 0) are mapped to themselves unchanged. Every other line through the origin is tilted by the shear.

Four-panel comparison: uniform scaling has every direction invariant, a 45° rotation has none, a horizontal shear has exactly one (the x-axis), a generic 2x2 has two distinct invariant directions
Four linear maps and their invariant directions. Uniform scaling: every direction. Rotation by 45°: none over the reals. Shear: exactly one. Generic 2×2: typically two distinct directions, drawn here as solid arrows mapped to dashed scaled copies.

Three maps, three answers: all, none, one. A generic 2×22 \times 2 matrix turns out to have two invariant directions, not three, not one. The question of how many invariant directions a linear map has — and which — is itself nontrivial, and the rest of this topic is the systematic theory that answers it.

We can write the question as a single equation. A nonzero vector v\mathbf{v} lies along an invariant direction of TT exactly when T(v)T(\mathbf{v}) is parallel to v\mathbf{v} — that is, when T(v)T(\mathbf{v}) is some scalar multiple of v\mathbf{v}:

T(v)=λv,λR.T(\mathbf{v}) = \lambda \mathbf{v}, \qquad \lambda \in \mathbb{R}.

The scalar λ\lambda records how TT scales the vector along the invariant direction. For the uniform scaling, λ=2\lambda = 2 for every direction. For the rotation, no real λ\lambda works for any nonzero real v\mathbf{v}. For the shear, λ=1\lambda = 1 for the xx-axis. This single equation — three symbols on the left, three on the right — is the rest of the topic in concentrated form.

ML aside. When a paper says “the dominant eigenvector of the Hessian points in the direction of largest curvature,” the noun eigenvector is the object this section is about to name: a direction the matrix doesn’t rotate, only stretches. The factor by which it stretches is the eigenvalue — the curvature in that direction. The Hessian topic invoked this picture without justification; this topic justifies it.

The viz below lets you build a 2×22 \times 2 matrix one entry at a time and see the invariant directions appear in real time. Drag the matrix entries, watch the eigenvectors slide around, and notice which preset matrices have zero, one, or two real invariant directions. The defective Jordan block and the rotation preset are the two cases where the eigenvector story is more interesting than “two distinct lines” — they motivate §5 (defective matrices) and §3 (complex eigenvalues), respectively.

Matrix A
Two distinct real eigenvalues — diagonalizable
Each eigenvalue has a one-dimensional eigenspace; the two eigenvectors form a basis.
Eigenvalues
  • λ = 3.00
  • λ = 2.00
Eigenvectors (unit-normalized)
  • v = (0.89, 0.45) for λ = 3.00
  • v = (0.71, 0.71) for λ = 2.00
Distinct eigenvalues: 2 · Real eigenvectors: 2

2. Eigenvalues, Eigenvectors, and Eigenspaces

The verbal question of §1 — which directions does a linear map merely scale? — becomes precise once we name the objects. A nonzero vector that gets only scaled is an eigenvector; the scaling factor is the eigenvalue; the set of all eigenvectors for a fixed eigenvalue, together with the zero vector, is the eigenspace. These three pieces of vocabulary will recur in every section below.

📐 Definition 1 (Eigenvalue, Eigenvector, Eigenspace)

Let VV be a real vector space and T ⁣:VVT \colon V \to V a linear map. A nonzero vector vV\mathbf{v} \in V is an eigenvector of TT with eigenvalue λR\lambda \in \mathbb{R} (or C\mathbb{C}, when we work in the complex setting) if

T(v)=λv.T(\mathbf{v}) = \lambda \mathbf{v}.

The set

Eλ={vV   ⁣:  T(v)=λv}E_\lambda = \{\mathbf{v} \in V \;\colon\; T(\mathbf{v}) = \lambda \mathbf{v}\}

is the eigenspace of TT corresponding to λ\lambda. The set of all eigenvalues of TT is the spectrum, written σ(T)\sigma(T).

A few features of the definition deserve immediate comment. First, the equation T(v)=λvT(\mathbf{v}) = \lambda \mathbf{v} is homogeneous of degree one in v\mathbf{v}: if v\mathbf{v} is an eigenvector with eigenvalue λ\lambda, so is cvc \mathbf{v} for any nonzero scalar cc — eigenvectors come in lines through the origin, not as isolated vectors. Second, the eigenvalue λ\lambda is determined by the eigenvector (apply TT, see how much it scales), but a single eigenvalue may have many eigenvectors — every nonzero element of EλE_\lambda is an eigenvector for λ\lambda. Third, although the definition is stated for an abstract linear map, in practice we will work with a fixed basis and identify TT with its matrix AA; the equation becomes Av=λvA \mathbf{v} = \lambda \mathbf{v}, and the eigenvectors and eigenvalues are properties of the matrix.

🔷 Proposition 1 (Eigenspaces Are Subspaces)

For any linear map T ⁣:VVT \colon V \to V and any scalar λ\lambda, the eigenspace EλE_\lambda is a subspace of VV. In particular, EλE_\lambda contains the zero vector and is closed under addition and scalar multiplication.

Proof.

Rewrite the eigenspace as Eλ=ker(TλI)E_\lambda = \ker(T - \lambda I), where TλI ⁣:VVT - \lambda I \colon V \to V is the linear map vT(v)λv\mathbf{v} \mapsto T(\mathbf{v}) - \lambda \mathbf{v}. To see the rewrite: vEλ\mathbf{v} \in E_\lambda if and only if T(v)=λvT(\mathbf{v}) = \lambda \mathbf{v}, which is equivalent to T(v)λv=0T(\mathbf{v}) - \lambda \mathbf{v} = \mathbf{0}, which is the statement (TλI)(v)=0(T - \lambda I)(\mathbf{v}) = \mathbf{0}. The kernel of any linear map is a subspace (Proposition 2 of Linear Algebra), so EλE_\lambda is a subspace.

Concretely: the zero vector satisfies T(0)λ0=00=0T(\mathbf{0}) - \lambda \mathbf{0} = \mathbf{0} - \mathbf{0} = \mathbf{0}, so 0Eλ\mathbf{0} \in E_\lambda. If u,vEλ\mathbf{u}, \mathbf{v} \in E_\lambda, then T(u+v)=T(u)+T(v)=λu+λv=λ(u+v)T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v}) = \lambda \mathbf{u} + \lambda \mathbf{v} = \lambda(\mathbf{u} + \mathbf{v}), so u+vEλ\mathbf{u} + \mathbf{v} \in E_\lambda. Scalar multiplication is analogous. \blacksquare

The eigenspace is a subspace, so it has a dimension; that number measures the “size” of the invariant direction (a line, a plane, all of VV) corresponding to λ\lambda.

📐 Definition 2 (Geometric Multiplicity)

The geometric multiplicity of an eigenvalue λ\lambda of TT is the dimension of its eigenspace:

geo.mult(λ)=dimEλ.\operatorname{geo.mult}(\lambda) = \dim E_\lambda.

For any actual eigenvalue λ\lambda, the eigenspace contains at least one nonzero eigenvector, so dimEλ1\dim E_\lambda \geq 1.

Three running examples will be referenced throughout the topic; each shows a different qualitative behavior of the eigenvalue equation.

📝 Example 1 (A diagonal matrix)

Let D=diag(d1,d2,,dn)D = \operatorname{diag}(d_1, d_2, \ldots, d_n) — the matrix with did_i on the diagonal and zeros elsewhere. For each standard-basis vector ei\mathbf{e}_i, direct computation gives Dei=dieiD \mathbf{e}_i = d_i \mathbf{e}_i. So ei\mathbf{e}_i is an eigenvector with eigenvalue did_i for every ii. The eigenvalues are exactly the diagonal entries (with their multiplicities), and the eigenspaces are the coordinate axes — or sums of coordinate axes, when entries are repeated. A diagonal matrix is the easiest possible eigenvalue picture: the standard basis is already an eigenbasis.

📝 Example 2 (A projection)

Let P ⁣:R2R2P \colon \mathbb{R}^2 \to \mathbb{R}^2 be orthogonal projection onto the xx-axis: P(x,y)=(x,0)P(x, y) = (x, 0). Then Pe1=(1,0)=1e1P \mathbf{e}_1 = (1, 0) = 1 \cdot \mathbf{e}_1 and Pe2=(0,0)=0e2P \mathbf{e}_2 = (0, 0) = 0 \cdot \mathbf{e}_2. The eigenvectors are e1\mathbf{e}_1 with eigenvalue 11 and e2\mathbf{e}_2 with eigenvalue 00. The eigenspace E1E_1 is the xx-axis (vectors that the projection leaves untouched), and E0E_0 is the yy-axis (vectors that the projection collapses to the origin). The map is fully described by the data “stretch by 11 along the xx-axis, kill the yy-axis” — and that data is exactly the eigenvalue / eigenspace pair. Example 15 of Linear Algebra used this projection to motivate change of basis; here it reappears as the prototypical eigenvalue example.

📝 Example 3 (Rotation by π/2)

Let R ⁣:R2R2R \colon \mathbb{R}^2 \to \mathbb{R}^2 be rotation by 90°90° counterclockwise: R(x,y)=(y,x)R(x, y) = (-y, x), with matrix (0110)\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}. No nonzero real vector is fixed up to scaling by a 90°90° rotation — every direction is mapped to the perpendicular direction, never to a scalar multiple of itself. So RR has no real eigenvalues at all.

Over the complex numbers, the situation changes. Try the candidate v=(1,i)\mathbf{v} = (1, -i)^\top: Rv=((i),1)=(i,1)=i(1,i)R \mathbf{v} = (-(-i), 1)^\top = (i, 1)^\top = i \cdot (1, -i)^\top, so v\mathbf{v} is a complex eigenvector with eigenvalue λ=i\lambda = i. The conjugate v=(1,i)\overline{\mathbf{v}} = (1, i)^\top is an eigenvector with eigenvalue λ=i\overline\lambda = -i. Real matrices can have complex eigenvalues — and when they do, the eigenvalues come in complex conjugate pairs. The real-vs-complex distinction will return in §3 when we develop the characteristic polynomial.

The three examples already span the qualitative behaviors we will need to organize: every direction invariant (Example 1 with d1=d2d_1 = d_2), exactly two directions invariant (Example 2, and generic 2×22 \times 2 matrices), and no real direction invariant (Example 3). The first nontrivial structural fact about eigenvectors — the one that drives diagonalizability in §4 — is that eigenvectors for distinct eigenvalues cannot be linearly dependent.

🔷 Proposition 2 (Distinct Eigenvalues Imply Independent Eigenvectors)

Let T ⁣:VVT \colon V \to V be a linear map and let v1,v2,,vk\mathbf{v}_1, \mathbf{v}_2, \ldots, \mathbf{v}_k be eigenvectors of TT with eigenvalues λ1,λ2,,λk\lambda_1, \lambda_2, \ldots, \lambda_k. If the eigenvalues are pairwise distinct, then the eigenvectors are linearly independent.

Proof.

We induct on kk. For k=1k = 1, the claim is just v10\mathbf{v}_1 \neq \mathbf{0}, which is part of the definition of eigenvector.

For the induction step, assume the result for any k1k - 1 eigenvectors with distinct eigenvalues, and suppose

c1v1+c2v2++ckvk=0()c_1 \mathbf{v}_1 + c_2 \mathbf{v}_2 + \cdots + c_k \mathbf{v}_k = \mathbf{0} \qquad (\star)

for some scalars c1,,ckc_1, \ldots, c_k. Apply TT to both sides. Since TT is linear and each vi\mathbf{v}_i is an eigenvector with eigenvalue λi\lambda_i,

c1λ1v1+c2λ2v2++ckλkvk=0.()c_1 \lambda_1 \mathbf{v}_1 + c_2 \lambda_2 \mathbf{v}_2 + \cdots + c_k \lambda_k \mathbf{v}_k = \mathbf{0}. \qquad (\star\star)

Now multiply ()(\star) by λk\lambda_k and subtract from ()(\star\star) to eliminate the vk\mathbf{v}_k term:

c1(λ1λk)v1+c2(λ2λk)v2++ck1(λk1λk)vk1=0.c_1 (\lambda_1 - \lambda_k) \mathbf{v}_1 + c_2 (\lambda_2 - \lambda_k) \mathbf{v}_2 + \cdots + c_{k-1} (\lambda_{k-1} - \lambda_k) \mathbf{v}_{k-1} = \mathbf{0}.

The first k1k - 1 eigenvectors have pairwise distinct eigenvalues (since all kk are pairwise distinct), so by the inductive hypothesis they are linearly independent. Each coefficient must therefore vanish:

ci(λiλk)=0for every i=1,,k1.c_i (\lambda_i - \lambda_k) = 0 \quad \text{for every } i = 1, \ldots, k - 1.

Since λiλk\lambda_i \neq \lambda_k, we conclude ci=0c_i = 0 for i<ki < k. Plugging back into ()(\star) leaves ckvk=0c_k \mathbf{v}_k = \mathbf{0}, and since vk0\mathbf{v}_k \neq \mathbf{0}, ck=0c_k = 0 as well. So every cic_i vanishes — the eigenvectors are linearly independent. \blacksquare

🔷 Corollary 1 (At most dim V distinct eigenvalues)

A linear map T ⁣:VVT \colon V \to V on a finite-dimensional vector space has at most dimV\dim V distinct eigenvalues.

Proof.

A linearly independent set in VV has at most dimV\dim V elements (Proposition 5 of Linear Algebra). Choose one eigenvector from each distinct eigenvalue: by Proposition 2, the resulting list is linearly independent, so its length — the number of distinct eigenvalues — is at most dimV\dim V. \blacksquare

The corollary is the structural ceiling that makes diagonalization possible. If a 3×33 \times 3 matrix has three distinct eigenvalues, we automatically get three linearly independent eigenvectors — and by §4, that means we can change basis to make the matrix diagonal. Repeated eigenvalues may still allow a basis of eigenvectors (Example 1 with d1=d2d_1 = d_2 and the scalar matrix 2I2I are textbook cases) but the guarantee comes only with distinctness.

💡 Remark 1 (Why we exclude the zero vector)

The definition insists that v0\mathbf{v} \neq \mathbf{0} for an eigenvector. The reason is bookkeeping: if we allowed v=0\mathbf{v} = \mathbf{0}, then T(0)=0=λ0T(\mathbf{0}) = \mathbf{0} = \lambda \cdot \mathbf{0} would hold for every scalar λ\lambda. The zero vector would be an “eigenvector for every eigenvalue,” and the notion of “the eigenvalue of 0\mathbf{0}” would be meaningless. By excluding it, each eigenvector pins down a unique eigenvalue, and the eigenvalue equation T(v)=λvT(\mathbf{v}) = \lambda \mathbf{v} becomes a constraint on the direction of v\mathbf{v} rather than a triviality. Note that the eigenspace EλE_\lambda does contain 0\mathbf{0} — otherwise it would not be a subspace — but 0\mathbf{0} is not itself called an eigenvector.

ML aside. When you decompose a weight matrix WW as W=iσiuiviW = \sum_i \sigma_i \mathbf{u}_i \mathbf{v}_i^\top (the singular value decomposition, which we will not develop here), the σi\sigma_i are not eigenvalues of WW — they are eigenvalues of WWW^\top W, which is symmetric and therefore covered by the spectral theorem in §6. The eigenvalues of WW itself are typically complex and less useful in ML practice. The reason the symmetric case dominates ML applications is that the matrices that actually matter (covariance, Hessian, WWW^\top W, kernel Gram) are all symmetric. The symmetric story is the headline of this topic; the general case (§§3–5) is the warm-up that prepares it.

Three-panel figure: a diagonal matrix with coordinate axes as eigenspaces, a projection with x-axis as E_1 and y-axis as E_0, a 90-degree rotation showing no real invariant directions
Three eigenspace pictures from Examples 1–3. The diagonal matrix has the coordinate axes as its two eigenspaces. The projection has E₁ = x-axis and E₀ = y-axis. The 90° rotation has no real eigenvectors — every line through the origin rotates by 90°, so none is invariant.

3. The Characteristic Polynomial

Definition 1 names the eigenvalue equation T(v)=λvT(\mathbf{v}) = \lambda \mathbf{v}, but it does not yet tell us how to find the eigenvalues of a given matrix. The bridge from “what is an eigenvalue?” to “compute the eigenvalues” is the characteristic polynomial: a single polynomial in one variable λ\lambda whose roots are exactly the eigenvalues, and whose degree is the dimension of the underlying space.

The construction starts with a rewriting of the eigenvalue equation. The condition T(v)=λvT(\mathbf{v}) = \lambda \mathbf{v} is the same as T(v)λv=0T(\mathbf{v}) - \lambda \mathbf{v} = \mathbf{0}, which is the same as (TλI)(v)=0(T - \lambda I)(\mathbf{v}) = \mathbf{0}. So v\mathbf{v} is a nonzero element of ker(TλI)\ker(T - \lambda I). By the invertibility characterization of Linear Algebra (Corollary 1 of §8), a square matrix is non-invertible exactly when its determinant is zero. Therefore λ\lambda is an eigenvalue if and only if det(TλI)=0\det(T - \lambda I) = 0 — which is a single equation in the single variable λ\lambda.

📐 Definition 3 (Characteristic Polynomial)

For an n×nn \times n matrix AA, the characteristic polynomial of AA is

pA(λ)=det(λIA).p_A(\lambda) = \det(\lambda I - A).

It is a monic polynomial in λ\lambda of degree nn with real coefficients (assuming AA is real). The characteristic equation is pA(λ)=0p_A(\lambda) = 0.

🔷 Theorem 1 (Eigenvalues Are Roots of the Characteristic Polynomial)

For any n×nn \times n matrix AA and any scalar λC\lambda \in \mathbb{C}:

λ is an eigenvalue of ApA(λ)=0.\lambda \text{ is an eigenvalue of } A \quad \Longleftrightarrow \quad p_A(\lambda) = 0.

Proof.

λ\lambda is an eigenvalue of AA iff there exists a nonzero v\mathbf{v} with (AλI)v=0(A - \lambda I)\mathbf{v} = \mathbf{0}, i.e. ker(AλI){0}\ker(A - \lambda I) \neq \{\mathbf{0}\}. By the invertibility characterization (Corollary 1 of §8 of Linear Algebra), this is equivalent to AλIA - \lambda I being non-invertible, which is equivalent to det(AλI)=0\det(A - \lambda I) = 0.

Finally, det(λIA)=(1)ndet(AλI)\det(\lambda I - A) = (-1)^n \det(A - \lambda I) — multiplying every row of a matrix by 1-1 multiplies the determinant by (1)n(-1)^n — so the two determinants vanish together. Therefore pA(λ)=det(λIA)=0p_A(\lambda) = \det(\lambda I - A) = 0 if and only if λ\lambda is an eigenvalue. \blacksquare

Theorem 1 changes the entire character of the eigenvalue problem. We no longer have to guess eigenvalues — we compute them by finding roots of a polynomial. The polynomial has degree nn, so by the Fundamental Theorem of Algebra it has exactly nn roots over C\mathbb{C}, counted with multiplicity. A real n×nn \times n matrix therefore has exactly nn eigenvalues over the complex numbers, though fewer may be real.

📐 Definition 4 (Algebraic Multiplicity)

The algebraic multiplicity of an eigenvalue λ\lambda of AA is its multiplicity as a root of the characteristic polynomial: the largest integer m1m \geq 1 such that (λλ0)m(\lambda - \lambda_0)^m divides pA(λ)p_A(\lambda) when λ0\lambda_0 is the eigenvalue in question. We write ma(λ)m_a(\lambda) for this number.

A natural question follows immediately. We have two notions of “multiplicity” for an eigenvalue: the geometric one (Definition 2, the dimension of EλE_\lambda) and the algebraic one we just named. How do they relate? The answer is that geometric multiplicity is bounded above by algebraic multiplicity, and the gap between them is the source of all the eigenvalue pathology to come.

🔷 Proposition 3 (Geometric ≤ Algebraic Multiplicity)

For any eigenvalue λ\lambda of AA, the geometric multiplicity is at most the algebraic multiplicity:

dimEλ=mg(λ)    ma(λ).\dim E_\lambda = m_g(\lambda) \;\leq\; m_a(\lambda).

Proof.

Let k=dimEλk = \dim E_\lambda be the geometric multiplicity. Choose a basis {v1,,vk}\{\mathbf{v}_1, \ldots, \mathbf{v}_k\} of the eigenspace EλE_\lambda, and extend it to a basis B={v1,,vk,w1,,wnk}\mathcal{B} = \{\mathbf{v}_1, \ldots, \mathbf{v}_k, \mathbf{w}_1, \ldots, \mathbf{w}_{n - k}\} of VV (using the basis-extension lemma from §3 of Linear Algebra). In this basis, the matrix of AA has block form

[A]B=(λIkB0C)[A]_{\mathcal{B}} = \begin{pmatrix} \lambda I_k & B \\ 0 & C \end{pmatrix}

for some k×(nk)k \times (n-k) block BB and (nk)×(nk)(n-k) \times (n-k) block CC. The reason: Avi=λviA \mathbf{v}_i = \lambda \mathbf{v}_i for each iki \leq k, so the first kk columns of [A]B[A]_{\mathcal{B}} are λ\lambda times the corresponding standard basis vectors. The bottom-left block is zero because the eigenvectors vi\mathbf{v}_i have no wj\mathbf{w}_j components. The remaining columns are arbitrary, filling out the blocks BB and CC.

Similar matrices share the characteristic polynomial (Lemma 1 below), so

pA(λ)=det(λI[A]B)=det((λλ)IkB0λInkC)=(λλ)kdet(λInkC),p_A(\lambda') = \det(\lambda' I - [A]_{\mathcal{B}}) = \det\begin{pmatrix} (\lambda' - \lambda) I_k & -B \\ 0 & \lambda' I_{n-k} - C \end{pmatrix} = (\lambda' - \lambda)^k \cdot \det(\lambda' I_{n-k} - C),

using the block-triangular determinant formula. The factor (λλ)k(\lambda' - \lambda)^k contributes at least kk to the multiplicity of λ\lambda as a root, so ma(λ)k=mg(λ)m_a(\lambda) \geq k = m_g(\lambda). \blacksquare

The proof used a fact we now make explicit: similar matrices have the same characteristic polynomial. The intuition is that similarity corresponds to a change of basis, and the characteristic polynomial is a property of the underlying linear map — not of the matrix that happens to represent it in a particular basis.

🔶 Lemma 1 (Similar Matrices Have the Same Characteristic Polynomial)

If AA and AA' are similar — meaning A=P1APA' = P^{-1} A P for some invertible PP — then pA(λ)=pA(λ)p_{A'}(\lambda) = p_A(\lambda).

Proof.

Using the multiplicativity of the determinant (Theorem 6 of Linear Algebra) and det(P1)det(P)=1\det(P^{-1}) \det(P) = 1:

pA(λ)=det(λIP1AP)=det(P1(λIA)P).p_{A'}(\lambda) = \det(\lambda I - P^{-1} A P) = \det\bigl(P^{-1}(\lambda I - A) P\bigr).

Pulling the determinants apart and rearranging gives

det(P1)det(λIA)det(P)=det(λIA)=pA(λ).\det(P^{-1}) \det(\lambda I - A) \det(P) = \det(\lambda I - A) = p_A(\lambda).

So pA(λ)=pA(λ)p_{A'}(\lambda) = p_A(\lambda). \blacksquare

In particular, AA and AA' have the same eigenvalue multiset (with algebraic multiplicities), the same trace (sum of eigenvalues), and the same determinant (product of eigenvalues) — all because the characteristic polynomial is a similarity invariant.

The next examples compute pA(λ)p_A(\lambda) for small matrices and illustrate the three qualitatively different scenarios: distinct real roots, a repeated real root, and a complex conjugate pair.

📝 Example 4 (Characteristic polynomial of a 2×2 matrix)

For A=(abcd)A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}:

pA(λ)=det(λabcλd)=(λa)(λd)bc=λ2(a+d)λ+(adbc).p_A(\lambda) = \det\begin{pmatrix} \lambda - a & -b \\ -c & \lambda - d \end{pmatrix} = (\lambda - a)(\lambda - d) - bc = \lambda^2 - (a + d)\lambda + (ad - bc).

The coefficients are familiar: a+d=tr(A)a + d = \operatorname{tr}(A) and adbc=detAad - bc = \det A, so

pA(λ)=λ2tr(A)λ+detA.p_A(\lambda) = \lambda^2 - \operatorname{tr}(A)\,\lambda + \det A.

Solving the quadratic gives the eigenvalues

λ=tr(A)±tr(A)24detA2.\lambda = \frac{\operatorname{tr}(A) \pm \sqrt{\operatorname{tr}(A)^2 - 4 \det A}}{2}.

Apply to A=(4211)A = \begin{pmatrix} 4 & -2 \\ 1 & 1 \end{pmatrix}: tr(A)=5\operatorname{tr}(A) = 5, detA=6\det A = 6, so pA(λ)=λ25λ+6=(λ2)(λ3)p_A(\lambda) = \lambda^2 - 5\lambda + 6 = (\lambda - 2)(\lambda - 3). Eigenvalues λ1=3\lambda_1 = 3, λ2=2\lambda_2 = 2.

📝 Example 5 (A 2×2 matrix with complex eigenvalues)

For the 90° rotation A=(0110)A = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} from Example 3: tr(A)=0\operatorname{tr}(A) = 0, detA=1\det A = 1, so pA(λ)=λ2+1p_A(\lambda) = \lambda^2 + 1. The roots are λ=±i\lambda = \pm ino real eigenvalues. Over the complex numbers the eigenvectors are v+i=(1,i)\mathbf{v}_{+i} = (1, -i)^\top and vi=(1,i)\mathbf{v}_{-i} = (1, i)^\top. A real matrix can have complex eigenvalues; when it does, they come in complex conjugate pairs (because the characteristic polynomial has real coefficients, so non-real roots arise in conjugate pairs).

📝 Example 6 (A 3×3 characteristic polynomial)

For A=(210021003)A = \begin{pmatrix} 2 & 1 & 0 \\ 0 & 2 & 1 \\ 0 & 0 & 3 \end{pmatrix} — upper-triangular, so the characteristic polynomial factors immediately:

pA(λ)=(λ2)(λ2)(λ3)=(λ2)2(λ3).p_A(\lambda) = (\lambda - 2)(\lambda - 2)(\lambda - 3) = (\lambda - 2)^2 (\lambda - 3).

Eigenvalues: λ=2\lambda = 2 with algebraic multiplicity 2 and λ=3\lambda = 3 with algebraic multiplicity 1. Whether λ=2\lambda = 2‘s geometric multiplicity is 1 or 2 depends on the off-diagonal entries — this matrix happens to be defective (geometric multiplicity 1), so it is not diagonalizable. We return to this in §5.

💡 Remark 2 (Real vs. complex eigenvalues)

Over the real numbers, a polynomial of degree nn may have fewer than nn real roots: as Example 5 showed, λ2+1\lambda^2 + 1 has no real roots even though its degree is 2. The Fundamental Theorem of Algebra guarantees that over the complex numbers, every degree-nn polynomial has exactly nn roots counted with multiplicity. So a real n×nn \times n matrix always has nn complex eigenvalues (with multiplicity), but possibly fewer real ones.

Real eigenvalues correspond to invariant directions in the geometric sense of §1 — directions the map stretches without rotating. Complex eigenvalues correspond to rotational behavior: when λ=a+bi\lambda = a + bi is complex, the action of AA on the real 2-plane spanned by the real and imaginary parts of the complex eigenvector is a rotation by angle arctan(b/a)\arctan(b/a) combined with a scaling by λ=a2+b2|\lambda| = \sqrt{a^2 + b^2}. The 90° rotation in Example 5 has λ=1|\lambda| = 1 (pure rotation, no scaling) and angle π/2\pi/2. Real symmetric matrices — the headline case of §6 — never have complex eigenvalues, because their characteristic polynomials factor over the reals.

💡 Remark 3 (Computational reality)

Computing eigenvalues by writing down pA(λ)p_A(\lambda) and factoring it works fine for n=2n = 2 and n=3n = 3 and is unusable for n5n \geq 5. Wilkinson’s polynomial — the characteristic polynomial of a deliberately constructed 20×2020 \times 20 matrix — is so ill-conditioned that floating-point errors of order 2232^{-23} in the coefficients move the roots by order 1. Even for benign-looking matrices, the polynomial coefficients accumulate cancellation error and the roots become hopelessly inaccurate.

Production eigenvalue solvers use the QR algorithm (Francis, 1961) — an iterative orthogonal-similarity transformation that converges to a Schur form, from which eigenvalues read off the diagonal — and the Lanczos / Arnoldi iterations for sparse matrices when only a few extremal eigenvalues are needed. Both algorithms bypass the characteristic polynomial entirely. We cite this without developing the numerical theory; Trefethen & Bau, Numerical Linear Algebra (Lectures 24–30) is the right reference. The notebook for this topic uses np.linalg.eig and np.linalg.eigh for matrices larger than 3×33 \times 3 — and so, in practice, do you.

ML aside. When the Hessian topic spoke of “the eigenvalues of HH,” it implicitly used the characteristic polynomial to define them. For low-dimensional examples (e.g., a 2×22 \times 2 Hessian of a 2-feature regression), you can write pH(λ)=λ2tr(H)λ+detHp_H(\lambda) = \lambda^2 - \operatorname{tr}(H) \lambda + \det H and solve. For real ML problems with HRp×pH \in \mathbb{R}^{p \times p} for pp in the millions, the characteristic polynomial is unreachable, and practitioners use truncated iterative methods (Lanczos for the top-kk eigenvalues of a sparse PSD Hessian) to extract just the eigenvalues that matter — typically the largest few (governing the loss landscape’s dominant curvatures) and the smallest few (governing convergence-limiting slow modes).

The viz below plots pA(λ)p_A(\lambda) as a curve in the (λ,pA)(\lambda, p_A) plane for a user-controlled 2×22 \times 2 or 3×33 \times 3 matrix. Real eigenvalues appear as filled circles where the curve crosses zero; complex roots appear in an inset Argand plane.

Matrix size:
Matrix A
pA(λ) =
λ² − 5.00λ + 6.00
Eigenvalues (real roots and complex conjugate pairs)
  • λ = 3.00
  • λ = 2.00
Two-panel figure: a 2x2 matrix and its characteristic polynomial plotted alongside, with eigenvalues highlighted as filled circles where the curve crosses zero
The characteristic polynomial of a 2×2 matrix is a downward-opening parabola. Its roots — the points where it crosses the λ-axis — are the eigenvalues.
Two-panel figure: a 3x3 matrix and its cubic characteristic polynomial with three real roots highlighted
The characteristic polynomial of a 3×3 matrix is a cubic. For a generic real matrix it has either three real roots or one real and a complex conjugate pair.

4. Diagonalizability and Similarity

The characteristic polynomial tells us how many eigenvalues a matrix has and what they are. The next question is whether the eigenvectors form a basis of VV — because when they do, the matrix becomes diagonal in that basis, and most calculations involving the matrix (powers, exponentials, system solutions) collapse to trivial scalar arithmetic along the eigenbasis.

📐 Definition 5 (Diagonalizable Matrix)

An n×nn \times n matrix AA is diagonalizable (over the field F\mathbb{F}, typically R\mathbb{R} or C\mathbb{C}) if there exists an invertible PP and a diagonal matrix DD — both with entries in F\mathbb{F} — such that

A=PDP1.A = P D P^{-1}.

Equivalently, AA is similar to a diagonal matrix.

The factorization A=PDP1A = P D P^{-1} is the eigendecomposition. Geometrically: change of basis to the eigenbasis (apply P1P^{-1}), scale along each eigendirection independently (apply DD), change back to the standard basis (apply PP). Algebraically: every action of AA on a vector reduces to nn independent scalar scalings in the eigenbasis.

🔷 Theorem 2 (Diagonalizability and Eigenbases)

An n×nn \times n matrix AA is diagonalizable if and only if there exists a basis of Rn\mathbb{R}^n (or Cn\mathbb{C}^n, depending on the field) consisting of eigenvectors of AA. In that case, the columns of PP are the eigenvectors, and the diagonal entries of DD are the corresponding eigenvalues.

Proof.

(\Rightarrow) Suppose A=PDP1A = P D P^{-1} with D=diag(λ1,,λn)D = \operatorname{diag}(\lambda_1, \ldots, \lambda_n) and PP invertible with columns p1,,pn\mathbf{p}_1, \ldots, \mathbf{p}_n. Multiply both sides on the right by PP to clear the inverse: AP=PDA P = P D. Reading column jj of both sides: Apj=λjpjA \mathbf{p}_j = \lambda_j \mathbf{p}_j. So each column of PP is an eigenvector with eigenvalue equal to the corresponding diagonal entry of DD. Since PP is invertible, its columns are linearly independent, hence a basis of Rn\mathbb{R}^n.

(\Leftarrow) Suppose {p1,,pn}\{\mathbf{p}_1, \ldots, \mathbf{p}_n\} is a basis of eigenvectors with eigenvalues λ1,,λn\lambda_1, \ldots, \lambda_n. Form the matrix PP whose columns are these eigenvectors; PP is invertible because its columns are linearly independent. Form D=diag(λ1,,λn)D = \operatorname{diag}(\lambda_1, \ldots, \lambda_n). Then AP=PDA P = P D by column-by-column computation (each column of APA P is Apj=λjpjA \mathbf{p}_j = \lambda_j \mathbf{p}_j, and each column of PDP D is λjpj\lambda_j \mathbf{p}_j). Multiply both sides on the right by P1P^{-1} to conclude A=PDP1A = P D P^{-1}. \blacksquare

The most useful immediate consequence is that distinct eigenvalues are enough to guarantee diagonalizability. We never have to check geometric vs. algebraic multiplicities for distinct-eigenvalue matrices.

🔷 Corollary 2 (Distinct Eigenvalues Imply Diagonalizable)

If an n×nn \times n matrix AA has nn distinct eigenvalues (each with algebraic multiplicity 1), then AA is diagonalizable.

Proof.

Pick one eigenvector vi\mathbf{v}_i from each eigenspace EλiE_{\lambda_i}. By Proposition 2 (§2), eigenvectors for distinct eigenvalues are linearly independent. So {v1,,vn}\{\mathbf{v}_1, \ldots, \mathbf{v}_n\} is a list of nn linearly independent vectors in Rn\mathbb{R}^n, hence a basis. By Theorem 2, AA is diagonalizable. \blacksquare

For repeated eigenvalues, diagonalizability is no longer automatic. The criterion is multiplicity-by-multiplicity equality: every repeated eigenvalue must have a geometric multiplicity that matches its algebraic multiplicity.

🔷 Theorem 3 (Diagonalizability Criterion via Multiplicities)

An n×nn \times n matrix AA is diagonalizable (over a field containing all its eigenvalues) if and only if, for every eigenvalue λ\lambda, the geometric multiplicity equals the algebraic multiplicity:

mg(λ)=ma(λ)for every λσ(A).m_g(\lambda) = m_a(\lambda) \quad \text{for every } \lambda \in \sigma(A).

Proof.

(\Leftarrow) Suppose mg(λ)=ma(λ)m_g(\lambda) = m_a(\lambda) for every eigenvalue. The eigenspaces EλiE_{\lambda_i} for distinct eigenvalues are linearly independent subspaces (extending Proposition 2 from single eigenvectors to whole eigenspaces — the same induction works with bases of EλiE_{\lambda_i} in place of single vectors). The total dimension of the direct sum is

img(λi)=ima(λi)=degpA=n,\sum_i m_g(\lambda_i) = \sum_i m_a(\lambda_i) = \deg p_A = n,

so the eigenspaces span all of Rn\mathbb{R}^n (assuming the field contains all the eigenvalues). Concatenating bases of each eigenspace gives a basis of Rn\mathbb{R}^n consisting of eigenvectors; by Theorem 2, AA is diagonalizable.

(\Rightarrow) Suppose A=PDP1A = P D P^{-1} with D=diag(d1,,dn)D = \operatorname{diag}(d_1, \ldots, d_n). The eigenspace EλE_\lambda in this representation is the span of the standard basis vectors ej\mathbf{e}_j for which dj=λd_j = \lambda — so mg(λ)m_g(\lambda) equals the count of diagonal entries equal to λ\lambda. The characteristic polynomial is pA(λ)=j(λdj)p_A(\lambda') = \prod_j (\lambda' - d_j) (the diagonal makes this immediate), so ma(λ)m_a(\lambda) is also the count of diagonal entries equal to λ\lambda. The two counts agree. \blacksquare

📝 Example 7 (Diagonalization of a 2×2 matrix)

Continue with A=(4211)A = \begin{pmatrix} 4 & -2 \\ 1 & 1 \end{pmatrix}. Eigenvalues λ1=3\lambda_1 = 3 and λ2=2\lambda_2 = 2 (Example 4) — distinct, so AA is diagonalizable by Corollary 2. Find eigenvectors:

  • For λ1=3\lambda_1 = 3: solve (A3I)v=0(A - 3I)\mathbf{v} = \mathbf{0}, i.e. (1212)v=0\begin{pmatrix} 1 & -2 \\ 1 & -2 \end{pmatrix}\mathbf{v} = \mathbf{0}. The kernel is spanned by v1=(2,1)\mathbf{v}_1 = (2, 1)^\top.
  • For λ2=2\lambda_2 = 2: solve (A2I)v=0(A - 2I)\mathbf{v} = \mathbf{0}, i.e. (2211)v=0\begin{pmatrix} 2 & -2 \\ 1 & -1 \end{pmatrix}\mathbf{v} = \mathbf{0}. The kernel is spanned by v2=(1,1)\mathbf{v}_2 = (1, 1)^\top.

Form P=(2111)P = \begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix} and D=(3002)D = \begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix}. Verify by direct multiplication that AP=PDA P = P D. Then A=PDP1A = P D P^{-1} where P1=(1112)P^{-1} = \begin{pmatrix} 1 & -1 \\ -1 & 2 \end{pmatrix}. In the eigenbasis, AA is the pair of independent scalings — by 3 along v1\mathbf{v}_1 and by 2 along v2\mathbf{v}_2.

When two matrices represent the same linear map in different bases, they are similar — and similarity preserves every invariant of the underlying map. The list of similarity invariants is exactly the data we can read off from the eigenvalue picture.

🔷 Theorem 4 (Similarity Invariants)

If AA and AA' are similar matrices, they share:

(a) the characteristic polynomial (and hence the eigenvalue multiset with algebraic multiplicities),

(b) the trace,

(c) the determinant,

(d) the rank,

(e) the nullity,

(f) the geometric multiplicity of each eigenvalue.

Proof.

(a) is Lemma 1 (§3). (b) Trace equals minus the coefficient of λn1\lambda^{n-1} in pA(λ)p_A(\lambda) (this is the elementary-symmetric-polynomial identity), so trace is determined by the characteristic polynomial, hence invariant. (c) Determinant equals (1)n(-1)^n times the constant term of pA(λ)p_A(\lambda), so it too is determined by the characteristic polynomial. (d) The column space of PAP1P A P^{-1} has the same dimension as the column space of AA: P1P^{-1} on the right doesn’t change dimension (it’s a bijection from Rn\mathbb{R}^n to itself), and PP on the left maps the column space isomorphically. So rank is preserved. (e) Nullity equals nrankn - \operatorname{rank}, so it follows from (d) by rank-nullity. (f) The geometric multiplicity of λ\lambda is

mg(λ)=dimker(AλI)=dimker(P1(AλI)P)=dimker(AλI),m_g(\lambda) = \dim \ker(A - \lambda I) = \dim \ker(P^{-1}(A - \lambda I) P) = \dim \ker(A' - \lambda I),

the same in both bases. \blacksquare

💡 Remark 4 (Powers and exponentials via diagonalization)

For diagonalizable A=PDP1A = P D P^{-1} with D=diag(λ1,,λn)D = \operatorname{diag}(\lambda_1, \ldots, \lambda_n):

Ak=(PDP1)k=PDkP1whereDk=diag(λ1k,,λnk).A^k = (P D P^{-1})^k = P D^k P^{-1} \quad \text{where} \quad D^k = \operatorname{diag}(\lambda_1^k, \ldots, \lambda_n^k).

The P1PP^{-1} P pairs telescope. The same identity holds for any function ff defined on the spectrum:

f(A)=Pf(D)P1wheref(D)=diag(f(λ1),,f(λn)).f(A) = P f(D) P^{-1} \quad \text{where} \quad f(D) = \operatorname{diag}(f(\lambda_1), \ldots, f(\lambda_n)).

In particular,

eA=PeDP1=Pdiag(eλ1,,eλn)P1.e^A = P \, e^D \, P^{-1} = P \operatorname{diag}(e^{\lambda_1}, \ldots, e^{\lambda_n}) P^{-1}.

This is the spectral mapping observation: functions of a diagonalizable matrix are computed by applying the function to the diagonal of DD, then sandwich-wrapping. Closed-form matrix exponentials, square roots of positive-definite matrices, and whitening transformations are all instances.

ML aside. When the Linear Systems topic wrote eAt=PeDtP1e^{At} = P e^{Dt} P^{-1} for the solution of y=Ay\mathbf{y}' = A \mathbf{y}, it was applying exactly Remark 4. The matrix exponential of a diagonalizable matrix reduces to nn independent scalar exponentials along the eigenbasis. The continuous-time gradient flow θ˙=Hθ\dot{\boldsymbol{\theta}} = -H \boldsymbol{\theta} has solution θ(t)=eHtθ0=PeDtP1θ0\boldsymbol{\theta}(t) = e^{-Ht} \boldsymbol{\theta}_0 = P e^{-Dt} P^{-1} \boldsymbol{\theta}_0, and each eigencomponent yi(t)=eλityi(0)y_i(t) = e^{-\lambda_i t} y_i(0) decays independently. The eigenbasis is the basis in which the dynamics decouple — that is the actual reason eigenvalues control convergence.

Decomposition stage
Current: x
= (1.50, 1.00)
P (eigenvectors as columns)
   0.89    0.71
   0.45    0.71
D (eigenvalues on diagonal)
   3.00    0.00
   0.00    2.00
P⁻¹
   2.24   -2.24
  -1.41    2.83
Drag the open red circle to move x. Eigenvector lines are dashed (blue, emerald).
Three-panel figure: the action of A on a vector x decomposed as change to eigenbasis, scale, change back
The eigendecomposition A = PDP⁻¹ as a three-step action: change to the eigenbasis via P⁻¹, scale along each eigenvector by the eigenvalue (D), change back via P.

5. Defective Matrices — A Brief Detour

Not every matrix is diagonalizable. When an eigenvalue’s algebraic multiplicity strictly exceeds its geometric multiplicity — the eigenspace is “smaller than it should be” — the matrix is called defective. The defective case is structurally important enough to name and exhibit, but the full theory of canonical forms for defective matrices (Jordan canonical form) is mathematically heavy and rarely needed in ML practice. We name the form, give one example, and forward the full development to a future topic.

📐 Definition 6 (Defective Matrix)

An n×nn \times n matrix AA is defective if it has an eigenvalue whose geometric multiplicity is strictly less than its algebraic multiplicity. Equivalently, AA has fewer than nn linearly independent eigenvectors, so it admits no eigenbasis and is not diagonalizable.

📝 Example 8 (A defective 2×2 matrix)

Let J2=(2102)J_2 = \begin{pmatrix} 2 & 1 \\ 0 & 2 \end{pmatrix}. Characteristic polynomial: pJ2(λ)=(λ2)2p_{J_2}(\lambda) = (\lambda - 2)^2. So λ=2\lambda = 2 is the only eigenvalue, with algebraic multiplicity 2.

Compute the eigenspace by solving (J22I)v=0(J_2 - 2I)\mathbf{v} = \mathbf{0}:

(J22I)=(0100),ker(J22I)=span{(1,0)}.(J_2 - 2I) = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}, \qquad \ker(J_2 - 2I) = \operatorname{span}\{(1, 0)^\top\}.

The eigenspace is one-dimensional. Geometric multiplicity 1, algebraic multiplicity 2: J2J_2 is defective. There is no basis of R2\mathbb{R}^2 consisting of eigenvectors of J2J_2, so J2J_2 is not diagonalizable. The matrix is already in Jordan form — it is a Jordan block.

📐 Definition 7 (Jordan Block (informal))

A Jordan block of size kk with eigenvalue λ\lambda is the k×kk \times k matrix

Jk(λ)=(λ1λ1λ1λ)J_k(\lambda) = \begin{pmatrix} \lambda & 1 & & \\ & \lambda & 1 & \\ & & \ddots & \ddots \\ & & & \lambda & 1 \\ & & & & \lambda \end{pmatrix}

with λ\lambda on the diagonal, 11s on the immediate superdiagonal, and 00s elsewhere. The matrix J2J_2 in Example 8 is the Jordan block of size 2 with eigenvalue 2.

🔷 Theorem 5 (Jordan Canonical Form (stated, not proved))

Every n×nn \times n matrix AA over the complex numbers is similar to a block-diagonal matrix JJ whose blocks are Jordan blocks Jki(λi)J_{k_i}(\lambda_i). The list of Jordan blocks — their sizes and eigenvalues — is unique up to ordering, and is the Jordan canonical form of AA. The Jordan form is the canonical generalization of diagonalization: diagonalizable matrices are exactly those whose Jordan form has all 1×11 \times 1 blocks.

💡 Remark 5 (Why we don't develop Jordan form)

The proof of Theorem 5 (see Hoffman-Kunze Chapter 7 or Horn-Johnson Chapter 3) requires generalized eigenvectors, Jordan chains, and a careful induction on the algebraic multiplicity of each eigenvalue. The development is mathematically beautiful but long, and the practical payoff is modest: defective matrices are rare in clean applications, and when they do arise (linear-systems repeated eigenvalues, bifurcation analysis), the relevant techniques can be developed locally on a case-by-case basis.

We treat Linear Systems & Matrix Exponential as the place where case-by-case handling for 2×22 \times 2 defective systems lives; the full Jordan theory belongs to a future topic on canonical forms or numerical linear algebra. For the rest of this topic, we proceed as if all matrices are diagonalizable — a working assumption that holds for the symmetric matrices §6 puts at the center, and for generic random matrices in general.

💡 Remark 6 (Defective matrices are measure-zero but not negligible)

The set of n×nn \times n matrices with all distinct eigenvalues is open and dense in the space of all matrices Rn×n\mathbb{R}^{n \times n}; its complement, where some eigenvalues coincide, is a set of measure zero (the discriminant of the characteristic polynomial vanishes on a hypersurface). So a random matrix is diagonalizable with probability 1.

But defective matrices live on the boundary between qualitatively different behaviors — e.g. the boundary between a stable spiral and a stable node in a 2D phase portrait, or the boundary between under-damped and over-damped oscillation in a second-order linear system. Bifurcation theory studies exactly what happens at such boundaries, and there defectiveness is the central object, not an exception. ML reality: repeated eigenvalues of the Hessian at a critical point are a measure-zero coincidence in a generic loss landscape, but at symmetric critical points (e.g. loss invariant under permutation of neurons in a wide network) they become structural rather than accidental.

Two-panel figure: the Jordan block J_2 acting on a unit square, showing shear-like distortion with one fixed direction
The defective Jordan block J₂ = [[2, 1], [0, 2]] acts on the unit square as a stretch-and-shear. The only invariant direction is the x-axis (eigenspace for λ = 2). The other direction is “almost” an eigenvector but not quite — it shears as it stretches.

6. Symmetric Matrices and the Spectral Theorem

The defective case in §5 is the bad news about the general eigenvalue picture. The good news is that the matrices ML actually cares about — the Hessian of a smooth loss, the covariance of a random vector, the Gram matrix XXX^\top X, the kernel Gram, the graph Laplacian — are all symmetric. And real symmetric matrices have the cleanest possible eigenvalue behavior: real eigenvalues, orthogonal eigenvectors, always diagonalizable, and a factorization A=QΛQA = Q \Lambda Q^\top where QQ is orthogonal and Λ\Lambda is diagonal-real. This is the spectral theorem, the centerpiece of the topic.

📐 Definition 8 (Symmetric Matrix)

A real n×nn \times n matrix AA is symmetric if A=AA^\top = A, i.e. aij=ajia_{ij} = a_{ji} for every pair of indices (i,j)(i, j).

Three structural facts about symmetric matrices, in increasing order of strength: all eigenvalues are real (Lemma 2), eigenvectors for distinct eigenvalues are automatically orthogonal (Lemma 3), and the eigenspaces span all of Rn\mathbb{R}^n — so a symmetric matrix always has an orthonormal eigenbasis (Theorem 6). Each fact’s proof is a short computation; together they give the spectral theorem.

🔶 Lemma 2 (Symmetric Matrices Have Real Eigenvalues)

Every eigenvalue of a real symmetric matrix AA is real.

Proof.

Let λC\lambda \in \mathbb{C} be an eigenvalue of the real symmetric matrix AA, with a corresponding (possibly complex) eigenvector vCn\mathbf{v} \in \mathbb{C}^n: Av=λvA \mathbf{v} = \lambda \mathbf{v}.

Take the conjugate transpose (v=v\mathbf{v}^* = \overline{\mathbf{v}}^\top, A=AA^* = \overline{A}^\top): vA=λˉv\mathbf{v}^* A^* = \bar\lambda \mathbf{v}^*. Since AA is real and symmetric, A=A=AA^* = A^\top = A. So vA=λˉv\mathbf{v}^* A = \bar\lambda \mathbf{v}^*.

Multiply the eigenvalue equation Av=λvA \mathbf{v} = \lambda \mathbf{v} on the left by v\mathbf{v}^*: vAv=λvv\mathbf{v}^* A \mathbf{v} = \lambda \mathbf{v}^* \mathbf{v}. Multiply vA=λˉv\mathbf{v}^* A = \bar\lambda \mathbf{v}^* on the right by v\mathbf{v}: vAv=λˉvv\mathbf{v}^* A \mathbf{v} = \bar\lambda \mathbf{v}^* \mathbf{v}.

Equate the two expressions: λvv=λˉvv\lambda \mathbf{v}^* \mathbf{v} = \bar\lambda \mathbf{v}^* \mathbf{v}. Since v0\mathbf{v} \neq \mathbf{0}, vv=v2>0\mathbf{v}^* \mathbf{v} = \|\mathbf{v}\|^2 > 0. Divide both sides by v2\|\mathbf{v}\|^2 to get λ=λˉ\lambda = \bar\lambda, hence λR\lambda \in \mathbb{R}. \blacksquare

🔶 Lemma 3 (Symmetric Matrices Have Orthogonal Eigenspaces)

If AA is real symmetric and v1,v2\mathbf{v}_1, \mathbf{v}_2 are eigenvectors of AA corresponding to distinct eigenvalues λ1λ2\lambda_1 \neq \lambda_2, then v1v2\mathbf{v}_1 \perp \mathbf{v}_2.

Proof.

Compute Av1,v2\langle A \mathbf{v}_1, \mathbf{v}_2 \rangle two ways. First, using Av1=λ1v1A \mathbf{v}_1 = \lambda_1 \mathbf{v}_1:

Av1,v2=λ1v1,v2=λ1v1,v2.\langle A \mathbf{v}_1, \mathbf{v}_2 \rangle = \langle \lambda_1 \mathbf{v}_1, \mathbf{v}_2 \rangle = \lambda_1 \langle \mathbf{v}_1, \mathbf{v}_2 \rangle.

Second, pushing the AA across the inner product using A=AA^\top = A (a property of the symmetric case, see §10 of Linear Algebra on inner products and adjoints): Av1,v2=v1,Av2=v1,λ2v2=λ2v1,v2.\langle A \mathbf{v}_1, \mathbf{v}_2 \rangle = \langle \mathbf{v}_1, A \mathbf{v}_2 \rangle = \langle \mathbf{v}_1, \lambda_2 \mathbf{v}_2 \rangle = \lambda_2 \langle \mathbf{v}_1, \mathbf{v}_2 \rangle.

Equating: λ1v1,v2=λ2v1,v2\lambda_1 \langle \mathbf{v}_1, \mathbf{v}_2 \rangle = \lambda_2 \langle \mathbf{v}_1, \mathbf{v}_2 \rangle, i.e. (λ1λ2)v1,v2=0(\lambda_1 - \lambda_2) \langle \mathbf{v}_1, \mathbf{v}_2 \rangle = 0. Since λ1λ2\lambda_1 \neq \lambda_2, the inner product v1,v2=0\langle \mathbf{v}_1, \mathbf{v}_2 \rangle = 0. \blacksquare

With both lemmas in hand, the spectral theorem is the inductive payoff. The structure of the proof is the heart of the topic: find one eigenvalue/eigenvector pair using Lemma 2, peel off its 1-dimensional eigenspace, and recurse on the (n1)(n-1)-dimensional orthogonal complement — which remains symmetric.

🔷 Theorem 6 (Spectral Theorem for Real Symmetric Matrices)

Let AA be a real n×nn \times n symmetric matrix. Then there exists an orthogonal matrix QQ (i.e. QQ=IQ^\top Q = I) and a real diagonal matrix Λ=diag(λ1,,λn)\Lambda = \operatorname{diag}(\lambda_1, \ldots, \lambda_n) such that

A=QΛQ.A = Q \, \Lambda \, Q^\top.

The columns of QQ form an orthonormal basis of Rn\mathbb{R}^n consisting of eigenvectors of AA; the diagonal entries of Λ\Lambda are the corresponding eigenvalues (with algebraic multiplicities, conventionally listed in non-increasing order λ1λ2λn\lambda_1 \geq \lambda_2 \geq \cdots \geq \lambda_n).

Proof.

Induction on nn.

Base case (n=1n = 1). A 1×11 \times 1 matrix A=(a11)A = (a_{11}) is trivially symmetric and diagonal: take Q=(1)Q = (1) and Λ=(a11)\Lambda = (a_{11}).

Inductive step. Assume the spectral theorem holds for (n1)×(n1)(n-1) \times (n-1) symmetric matrices. Let AA be an n×nn \times n real symmetric matrix.

By Lemma 2, the characteristic polynomial pA(λ)p_A(\lambda) has at least one real root λ1\lambda_1 (in fact, all its roots are real, but we only need one for the induction). By Theorem 1, λ1\lambda_1 is a real eigenvalue. Pick a corresponding real unit eigenvector q1Rn\mathbf{q}_1 \in \mathbb{R}^n with q1=1\|\mathbf{q}_1\| = 1.

Extend {q1}\{\mathbf{q}_1\} to an orthonormal basis {q1,w2,,wn}\{\mathbf{q}_1, \mathbf{w}_2, \ldots, \mathbf{w}_n\} of Rn\mathbb{R}^n via Gram-Schmidt (§10 of Linear Algebra). Form the orthogonal matrix Q~\tilde Q whose columns are these vectors; orthogonal because the columns are orthonormal.

Consider the matrix Q~AQ~\tilde Q^\top A \tilde Q. Two things are true about it.

First, it is symmetric: (Q~AQ~)=Q~AQ~=Q~AQ~(\tilde Q^\top A \tilde Q)^\top = \tilde Q^\top A^\top \tilde Q = \tilde Q^\top A \tilde Q (using A=AA^\top = A).

Second, its first column equals λ1e1\lambda_1 \mathbf{e}_1: the jj-th column of Q~AQ~\tilde Q^\top A \tilde Q is \tilde Q^\top A (\text{j-th column of } \tilde Q). For j=1j = 1, this is Q~Aq1=Q~(λ1q1)=λ1Q~q1=λ1e1\tilde Q^\top A \mathbf{q}_1 = \tilde Q^\top (\lambda_1 \mathbf{q}_1) = \lambda_1 \tilde Q^\top \mathbf{q}_1 = \lambda_1 \mathbf{e}_1, since Q~q1=e1\tilde Q^\top \mathbf{q}_1 = \mathbf{e}_1 by construction (the first column of Q~\tilde Q is q1\mathbf{q}_1).

Combining symmetry with the first column being λ1e1\lambda_1 \mathbf{e}_1 forces the first row to be λ1e1\lambda_1 \mathbf{e}_1^\top as well. So

Q~AQ~=(λ100B)\tilde Q^\top A \tilde Q = \begin{pmatrix} \lambda_1 & \mathbf{0}^\top \\ \mathbf{0} & B \end{pmatrix}

for some (n1)×(n1)(n-1) \times (n-1) block BB. The block BB is symmetric (symmetry of the full matrix passes to the lower-right block). By the inductive hypothesis, B=QBΛBQBB = Q_B \Lambda_B Q_B^\top with QBQ_B orthogonal and ΛB\Lambda_B diagonal real.

Define

Q=(100QB),Λ=(λ100ΛB).Q' = \begin{pmatrix} 1 & \mathbf{0}^\top \\ \mathbf{0} & Q_B \end{pmatrix}, \qquad \Lambda = \begin{pmatrix} \lambda_1 & \mathbf{0}^\top \\ \mathbf{0} & \Lambda_B \end{pmatrix}.

Then QQ' is orthogonal (block-diagonal with orthogonal blocks) and Λ\Lambda is diagonal. A direct computation gives Q~AQ~=QΛQ\tilde Q^\top A \tilde Q = Q' \Lambda Q'^\top. Set Q=Q~QQ = \tilde Q Q' — orthogonal as a product of orthogonals. Then A=Q~(Q~AQ~)Q~=Q~QΛQQ~=QΛQA = \tilde Q (\tilde Q^\top A \tilde Q) \tilde Q^\top = \tilde Q Q' \Lambda Q'^\top \tilde Q^\top = Q \Lambda Q^\top, completing the induction. \blacksquare

🔷 Corollary 3 (Spectral Decomposition as a Sum of Rank-One Projectors)

Under the spectral theorem, AA has the outer-product expansion

A=i=1nλiqiqi,A = \sum_{i=1}^n \lambda_i \mathbf{q}_i \mathbf{q}_i^\top,

where each qiqi\mathbf{q}_i \mathbf{q}_i^\top is the rank-one orthogonal projector onto span(qi)\operatorname{span}(\mathbf{q}_i). The matrix AA is therefore a weighted sum of rank-one projectors onto its eigendirections, weighted by the eigenvalues.

Proof.

Direct expansion of QΛQQ \Lambda Q^\top. The matrix ΛQ\Lambda Q^\top scales the ii-th row of QQ^\top (which is qi\mathbf{q}_i^\top) by λi\lambda_i. Multiplying by QQ on the left forms the outer product iλiqiqi\sum_i \lambda_i \mathbf{q}_i \mathbf{q}_i^\top. \blacksquare

📝 Example 9 (Diagonalizing a 2×2 symmetric matrix)

Let A=(4221)A = \begin{pmatrix} 4 & 2 \\ 2 & 1 \end{pmatrix}. Trace = 5, determinant = 0. Characteristic polynomial: λ25λ=λ(λ5)\lambda^2 - 5\lambda = \lambda(\lambda - 5). Eigenvalues: λ1=5\lambda_1 = 5 and λ2=0\lambda_2 = 0.

For λ1=5\lambda_1 = 5: solve (A5I)v=0(A - 5I)\mathbf{v} = \mathbf{0}, i.e. (1224)v=0\begin{pmatrix} -1 & 2 \\ 2 & -4 \end{pmatrix} \mathbf{v} = \mathbf{0}. The kernel is spanned by (2,1)(2, 1)^\top; normalize to q1=(2,1)/5\mathbf{q}_1 = (2, 1)^\top / \sqrt{5}.

For λ2=0\lambda_2 = 0: solve Av=0A \mathbf{v} = \mathbf{0}. The kernel is spanned by (1,2)(1, -2)^\top; normalize to q2=(1,2)/5\mathbf{q}_2 = (1, -2)^\top / \sqrt{5}.

Verify orthogonality: q1q2=(21+1(2))/5=0\mathbf{q}_1 \cdot \mathbf{q}_2 = (2 \cdot 1 + 1 \cdot (-2))/5 = 0 ✓, exactly as Lemma 3 promised.

Spectral decomposition: A=5q1q1+0q2q2=5q1q1A = 5 \mathbf{q}_1 \mathbf{q}_1^\top + 0 \cdot \mathbf{q}_2 \mathbf{q}_2^\top = 5 \mathbf{q}_1 \mathbf{q}_1^\top — a rank-one matrix, consistent with detA=0\det A = 0. The image of AA is the line spanned by q1\mathbf{q}_1; the null space is the line spanned by q2\mathbf{q}_2.

💡 Remark 7 (Why symmetric is so much cleaner)

The proof of Theorem 6 uses no polynomial algebra. It does not factor the characteristic polynomial or count multiplicities. The induction step finds one eigenvalue–eigenvector pair (Lemma 2 guarantees the eigenvalue is real), restricts to the orthogonal complement (which inherits symmetry), and recurses. The argument is purely geometric: find an invariant line, peel it off, repeat. The same argument generalizes verbatim to compact self-adjoint operators on infinite-dimensional Hilbert spaces — the proof in Hilbert Spaces of the infinite-dim spectral theorem is structurally identical to ours.

💡 Remark 8 (Real-symmetric vs. complex-Hermitian)

The complex analogue of a real symmetric matrix is a Hermitian matrix: A=AA^* = A where A=AA^* = \overline{A}^\top. The complex spectral theorem says every Hermitian matrix factors as A=UΛUA = U \Lambda U^* with UU unitary (UU=IU^* U = I) and Λ\Lambda real diagonal. The proof is structurally identical to ours; only the inner product changes (u,v=uv\langle \mathbf{u}, \mathbf{v} \rangle = \mathbf{u}^* \mathbf{v}, conjugate-linear in the first slot). Quantum mechanics lives in this setting — observables are Hermitian operators, and their real eigenvalues are the measurable values. For ML the real symmetric case suffices.

💡 Remark 9 (The Hessian, revisited)

Recall from the Hessian topic that the Hessian 2f\nabla^2 f of a C2C^2 function is symmetric (Clairaut’s theorem). The spectral theorem now applies: 2f=QΛQ\nabla^2 f = Q \Lambda Q^\top with real eigenvalues. The principal curvatures of the loss surface in the directions qi\mathbf{q}_i are exactly the eigenvalues λi\lambda_i. The second-derivative test reads off the critical-point type from the signs of the λi\lambda_i: all positive ⟹ local minimum, all negative ⟹ local maximum, mixed signs ⟹ saddle. We now have the rigorous spectral foundation for that test; §7 makes it formal as Theorem 7.

ML aside. A covariance matrix Σ=E[(Xμ)(Xμ)]\Sigma = \mathbb{E}[(X - \mu)(X - \mu)^\top] is symmetric by construction (the outer-product structure forces Σij=Σji\Sigma_{ij} = \Sigma_{ji}). The spectral theorem gives Σ=QΛQ\Sigma = Q \Lambda Q^\top with QQ orthogonal and Λ\Lambda diagonal-real-non-negative. The columns of QQ are the principal components of the distribution; the diagonal entries of Λ\Lambda are the variances along those directions. PCA is literally the spectral theorem applied to a covariance matrix. The whitening transformation Σ1/2=QΛ1/2Q\Sigma^{-1/2} = Q \Lambda^{-1/2} Q^\top (well-defined when Σ\Sigma is positive-definite) maps the distribution to one with identity covariance — the precondition for Mahalanobis distance and for well-conditioned gradient descent. multivariate-distributions → pca-and-spectral-methods →

Mode:
Matrix A (off-diagonal entries mirror; warning shown if asymmetric)
positive definite
λ₁ = 3.00, q₁ ≈ (0.71, 0.71)
λ₂ = 1.00, q₂ ≈ (-0.71, 0.71)
A = λ₁ q₁ q₁ᵀ + λ₂ q₂ q₂ᵀ (spectral decomposition)
Two-panel figure: unit circle on the left and its image ellipse under a symmetric matrix on the right, with eigenvectors as principal axes and eigenvalues as semi-axis lengths
The spectral theorem geometrically: a symmetric positive-definite matrix maps the unit circle to an ellipse whose principal axes are the eigenvectors and whose semi-axis lengths are the eigenvalues.

7. Quadratic Forms and Positive-Definiteness

The spectral theorem unlocks the classification of quadratic forms — scalar functions of the form q(x)=xAxq(\mathbf{x}) = \mathbf{x}^\top A \mathbf{x} with AA symmetric. In the eigenbasis, qq becomes spectacularly simple: q(x)=iλiyi2q(\mathbf{x}) = \sum_i \lambda_i y_i^2 where yi=qixy_i = \mathbf{q}_i^\top \mathbf{x} are the coordinates of x\mathbf{x} in the eigenbasis. The sign and growth behavior of qq are then entirely determined by the signs of the eigenvalues. This is the framework in which every convexity statement, every second-derivative test, and every covariance-matrix property on the rest of the site is phrased.

📐 Definition 9 (Quadratic Form)

A quadratic form on Rn\mathbb{R}^n is a function q:RnRq : \mathbb{R}^n \to \mathbb{R} of the form q(x)=xAxq(\mathbf{x}) = \mathbf{x}^\top A \mathbf{x} for some symmetric matrix AA. (Any matrix BB in xBx\mathbf{x}^\top B \mathbf{x} can be replaced by its symmetric part (B+B)/2(B + B^\top)/2 without changing the form, so we may take AA symmetric without loss of generality.)

📐 Definition 10 (Definiteness)

A symmetric matrix AA is

  • positive-definite (written A0A \succ 0) if xAx>0\mathbf{x}^\top A \mathbf{x} > 0 for every x0\mathbf{x} \neq \mathbf{0};
  • positive-semidefinite (written A0A \succeq 0) if xAx0\mathbf{x}^\top A \mathbf{x} \geq 0 for every x\mathbf{x};
  • negative-definite if A0-A \succ 0;
  • negative-semidefinite if A0-A \succeq 0;
  • indefinite if xAx\mathbf{x}^\top A \mathbf{x} takes both positive and negative values.

🔷 Theorem 7 (Definiteness via Eigenvalues)

A symmetric matrix AA is positive-definite iff all eigenvalues are strictly positive; positive-semidefinite iff all eigenvalues are non-negative; negative-definite iff all eigenvalues are strictly negative; indefinite iff it has both positive and negative eigenvalues.

Proof.

By the spectral theorem, A=QΛQA = Q \Lambda Q^\top with QQ orthogonal and Λ=diag(λ1,,λn)\Lambda = \operatorname{diag}(\lambda_1, \ldots, \lambda_n). Substitute y=Qx\mathbf{y} = Q^\top \mathbf{x}:

xAx=xQΛQx=yΛy=i=1nλiyi2.\mathbf{x}^\top A \mathbf{x} = \mathbf{x}^\top Q \Lambda Q^\top \mathbf{x} = \mathbf{y}^\top \Lambda \mathbf{y} = \sum_{i=1}^n \lambda_i y_i^2.

Since QQ is orthogonal, the map xy\mathbf{x} \mapsto \mathbf{y} is a bijection, and x0\mathbf{x} \neq \mathbf{0} iff y0\mathbf{y} \neq \mathbf{0}. The form iλiyi2\sum_i \lambda_i y_i^2 is strictly positive for every y0\mathbf{y} \neq \mathbf{0} iff every λi>0\lambda_i > 0 (because we can choose y=ej\mathbf{y} = \mathbf{e}_j to isolate λj\lambda_j). Non-negativity, negativity, etc. follow analogously. Indefiniteness corresponds to mixed eigenvalue signs because choosing y=ej\mathbf{y} = \mathbf{e}_j for the positive eigenvalue makes the form positive, and y=ek\mathbf{y} = \mathbf{e}_k for the negative eigenvalue makes it negative. \blacksquare

🔷 Corollary 4 (Positive-Definite Matrices Are Invertible)

If A0A \succ 0, then detA=λi>0\det A = \prod \lambda_i > 0, so AA is invertible. The inverse is also positive-definite, with eigenvalues 1/λi1/\lambda_i.

🔷 Theorem 8 (Sylvester's Criterion)

A symmetric matrix AA is positive-definite iff all leading principal minors — the determinants of the upper-left k×kk \times k submatrices, for k=1,2,,nk = 1, 2, \ldots, n — are strictly positive.

Proof.

(\Rightarrow) If A0A \succ 0, then for any nonzero xk=(x1,,xk)Rk\mathbf{x}_k = (x_1, \ldots, x_k)^\top \in \mathbb{R}^k, the extended vector x=(x1,,xk,0,,0)Rn\mathbf{x} = (x_1, \ldots, x_k, 0, \ldots, 0)^\top \in \mathbb{R}^n satisfies xAx=xkAkxk\mathbf{x}^\top A \mathbf{x} = \mathbf{x}_k^\top A_k \mathbf{x}_k where AkA_k is the leading k×kk \times k submatrix. Since A0A \succ 0 and x0\mathbf{x} \neq \mathbf{0}, this is positive; so Ak0A_k \succ 0 as well, hence detAk>0\det A_k > 0 by Corollary 4.

(\Leftarrow) The converse uses induction on kk: the LDLᵀ decomposition with all positive diagonal entries can be built incrementally from the leading principal minors. The full argument is in Horn & Johnson Theorem 7.2.5; the key idea is that positive leading minors force the pivots in symmetric Gaussian elimination to remain positive, which is equivalent to positive-definiteness. \blacksquare

📐 Definition 11 (Ellipsoid)

Let A0A \succ 0 be symmetric positive-definite. The unit ellipsoid of AA is

E(A)={xRn:xAx1}.\mathcal{E}(A) = \{\mathbf{x} \in \mathbb{R}^n : \mathbf{x}^\top A \mathbf{x} \leq 1\}.

By the spectral theorem, E(A)\mathcal{E}(A) is centered at the origin with principal axes along the eigenvectors qi\mathbf{q}_i and semi-axis lengths 1/λi1/\sqrt{\lambda_i}. Larger eigenvalues give shorter semi-axes — the matrix “stretches more aggressively” along high-eigenvalue directions, so the level set is more compressed there.

📝 Example 10 (Three quadratic forms in ℝ²)

(a) A=I=diag(1,1)A = I = \operatorname{diag}(1, 1). q(x)=x12+x22q(\mathbf{x}) = x_1^2 + x_2^2. Eigenvalues 1,11, 1. Level sets q=c>0q = c > 0 are circles of radius c\sqrt c. Positive-definite, isotropic.

(b) A=diag(4,1)A = \operatorname{diag}(4, 1). q(x)=4x12+x22q(\mathbf{x}) = 4 x_1^2 + x_2^2. Eigenvalues 4,14, 1. Level sets are ellipses with x1x_1-semi-axis c/2\sqrt{c}/2 and x2x_2-semi-axis c\sqrt celongated along the x2x_2-axis (smaller eigenvalue, longer axis). Positive-definite, anisotropic.

(c) A=diag(1,1)A = \operatorname{diag}(1, -1). q(x)=x12x22q(\mathbf{x}) = x_1^2 - x_2^2. Eigenvalues 1,11, -1 — opposite signs. The surface z=q(x1,x2)z = q(x_1, x_2) is a saddle; level sets q=cq = c are hyperbolas (for c0c \neq 0) with asymptotes x2=±x1x_2 = \pm x_1. Indefinite.

The notebook plots all three. The viz below lets you interpolate continuously between them by editing the matrix entries.

💡 Remark 10 (Why we care about positive-semi-definite (not just positive-definite))

Many naturally occurring symmetric matrices fail to be positive-definite but are positive-semidefinite: a covariance matrix of a degenerate distribution (some linear combination of variables has zero variance); a Gram matrix XXX^\top X when the data matrix XX is rank-deficient; a graph Laplacian, which always has 1\mathbf{1} in its kernel. The semidefinite case is where rank-deficiency lives. covariance-correlation → Geometrically, a PSD matrix with a nontrivial kernel has an ellipsoid that degenerates into an infinite cylinder along the kernel direction — the form is constant along the kernel, growing only in the orthogonal complement.

ML aside. The Hessian topic’s “condition number κ(H)=λmax/λmin\kappa(H) = \lambda_{\max}/\lambda_{\min}” implicitly assumes HH is positive-definite (so λmin>0\lambda_{\min} > 0) — that is the local-minimum case. When the Hessian is positive-semidefinite but not positive-definite, the loss has a flat direction (the kernel of HH), and gradient descent in that direction is undamped. Modern deep learning has a large literature on flat directions because over-parameterized networks have positive-semidefinite-but-not-positive-definite Hessians by construction (any null direction in parameter space along which the loss does not change is a Hessian-null direction).

Symmetric matrix A
positive definite
bowl (elliptic contours)
λ₁ = 1.00(major principal axis)
λ₂ = 1.00(minor principal axis)
Dashed lines are the eigenvectors (principal axes). Contour color encodes the q(x) value (viridis colormap).
Five-panel figure: positive-definite isotropic (circular contours), positive-definite elongated (elliptical), positive-semidefinite (parallel lines), indefinite saddle (hyperbolas), negative-definite (inverted)
The zoo of quadratic forms in ℝ², classified by eigenvalue signs. Positive-definite → ellipses (bowl). Positive-semidefinite → parallel lines (trough). Indefinite → hyperbolas (saddle). Negative-definite → ellipses (dome). The sign pattern of the eigenvalues determines the contour topology.

8. The Rayleigh Quotient

The spectral theorem and the eigenvalue/definiteness picture (§§6-7) gave us static information about a symmetric matrix: its decomposition, its quadratic form, its principal axes. The Rayleigh quotient gives us a variational characterization — eigenvalues as extrema of a scalar function. This is the picture in which PCA’s “find the direction of maximum variance” lives, and the bridge from spectral theory to constrained optimization.

📐 Definition 12 (Rayleigh Quotient)

For a real symmetric matrix AA and a nonzero vector xRn\mathbf{x} \in \mathbb{R}^n, the Rayleigh quotient is

RA(x)=xAxxx.R_A(\mathbf{x}) = \frac{\mathbf{x}^\top A \mathbf{x}}{\mathbf{x}^\top \mathbf{x}}.

Defined on Rn{0}\mathbb{R}^n \setminus \{\mathbf{0}\} and scale-invariant: RA(cx)=RA(x)R_A(c \mathbf{x}) = R_A(\mathbf{x}) for any c0c \neq 0. Restricting to unit vectors x=1\|\mathbf{x}\| = 1 gives RA(x)=xAxR_A(\mathbf{x}) = \mathbf{x}^\top A \mathbf{x} — just the quadratic form on the unit sphere.

🔷 Theorem 9 (Rayleigh Quotient Bounds (Extremal Eigenvalues))

Let AA be real symmetric with eigenvalues λ1λ2λn\lambda_1 \geq \lambda_2 \geq \cdots \geq \lambda_n and orthonormal eigenvectors q1,,qn\mathbf{q}_1, \ldots, \mathbf{q}_n. For every x0\mathbf{x} \neq \mathbf{0}:

λnRA(x)λ1.\lambda_n \leq R_A(\mathbf{x}) \leq \lambda_1.

The upper bound is achieved at x=q1\mathbf{x} = \mathbf{q}_1; the lower bound at x=qn\mathbf{x} = \mathbf{q}_n. Therefore

λ1=maxx0RA(x),λn=minx0RA(x).\lambda_1 = \max_{\mathbf{x} \neq \mathbf{0}} R_A(\mathbf{x}), \qquad \lambda_n = \min_{\mathbf{x} \neq \mathbf{0}} R_A(\mathbf{x}).

Proof.

Expand x\mathbf{x} in the orthonormal eigenbasis: x=i=1nciqi\mathbf{x} = \sum_{i=1}^n c_i \mathbf{q}_i with ci=qixc_i = \mathbf{q}_i^\top \mathbf{x}.

By Parseval (orthonormality of the basis): xx=ici2\mathbf{x}^\top \mathbf{x} = \sum_i c_i^2. By the outer-product expansion (Corollary 3): Ax=iλiciqiA \mathbf{x} = \sum_i \lambda_i c_i \mathbf{q}_i, so xAx=iλici2\mathbf{x}^\top A \mathbf{x} = \sum_i \lambda_i c_i^2.

Therefore

RA(x)=iλici2ici2=i=1nwiλi,R_A(\mathbf{x}) = \frac{\sum_i \lambda_i c_i^2}{\sum_i c_i^2} = \sum_{i=1}^n w_i \, \lambda_i,

where wi=ci2/jcj2[0,1]w_i = c_i^2 / \sum_j c_j^2 \in [0, 1] are weights summing to 11. So RA(x)R_A(\mathbf{x}) is a convex combination of the eigenvalues. Any convex combination of numbers lies between the smallest and largest:

λn=wiλnwiλiwiλ1=λ1.\lambda_n = \sum w_i \lambda_n \leq \sum w_i \lambda_i \leq \sum w_i \lambda_1 = \lambda_1.

Equality on the upper bound requires all the weight to be on indices where λi=λ1\lambda_i = \lambda_1 — i.e. x\mathbf{x} lies in the eigenspace Eλ1E_{\lambda_1}. The simplest choice is x=q1\mathbf{x} = \mathbf{q}_1. Similarly the lower bound is achieved at x=qn\mathbf{x} = \mathbf{q}_n. \blacksquare

🔷 Corollary 5 (Variational Characterization of λ₁ and λₙ)

λ1=maxx=1xAx,λn=minx=1xAx.\lambda_1 = \max_{\|\mathbf{x}\| = 1} \mathbf{x}^\top A \mathbf{x}, \qquad \lambda_n = \min_{\|\mathbf{x}\| = 1} \mathbf{x}^\top A \mathbf{x}.

The maximizer is q1\mathbf{q}_1 (top eigenvector); the minimizer is qn\mathbf{q}_n (bottom eigenvector), each up to sign and unit-norm scaling.

📝 Example 11 (Computing λ_max by maximization)

Let A=(2112)A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}. Parameterize the unit circle as x(θ)=(cosθ,sinθ)\mathbf{x}(\theta) = (\cos\theta, \sin\theta)^\top. Compute

x(θ)Ax(θ)=2cos2θ+2sinθcosθ+2sin2θ=2+sin(2θ).\mathbf{x}(\theta)^\top A \mathbf{x}(\theta) = 2\cos^2\theta + 2\sin\theta\cos\theta + 2\sin^2\theta = 2 + \sin(2\theta).

The maximum over θ\theta is 33 at θ=π/4\theta = \pi/4 (where sin(2θ)=1\sin(2\theta) = 1); the minimum is 11 at θ=3π/4\theta = 3\pi/4 (where sin(2θ)=1\sin(2\theta) = -1). So λmax=3\lambda_{\max} = 3, λmin=1\lambda_{\min} = 1. Top eigenvector q1=(cos(π/4),sin(π/4))=(1,1)/2\mathbf{q}_1 = (\cos(\pi/4), \sin(\pi/4))^\top = (1, 1)^\top / \sqrt{2}, bottom eigenvector q2=(1,1)/2\mathbf{q}_2 = (-1, 1)^\top / \sqrt{2}.

Sanity-check via the characteristic polynomial: λ24λ+3=(λ1)(λ3)\lambda^2 - 4\lambda + 3 = (\lambda - 1)(\lambda - 3) ✓.

💡 Remark 11 (The Rayleigh quotient as a Lagrangian critical-point equation)

The maximization

maxxxAxsubject toxx=1\max_{\mathbf{x}} \mathbf{x}^\top A \mathbf{x} \quad \text{subject to} \quad \mathbf{x}^\top \mathbf{x} = 1

is a constrained-optimization problem. By Lagrange multipliers (Topic 16), the Lagrangian is

L(x,μ)=xAxμ(xx1).\mathcal{L}(\mathbf{x}, \mu) = \mathbf{x}^\top A \mathbf{x} - \mu (\mathbf{x}^\top \mathbf{x} - 1).

Setting xL=0\nabla_{\mathbf{x}} \mathcal{L} = \mathbf{0}: 2Ax2μx=02 A \mathbf{x} - 2 \mu \mathbf{x} = \mathbf{0}, i.e. Ax=μxA \mathbf{x} = \mu \mathbf{x}. The Lagrange multiplier at a critical point is an eigenvalue. The critical point x\mathbf{x} is the corresponding eigenvector. Maximizing the Rayleigh quotient is solving the eigenvalue equation — eigenvalues fall out of constrained optimization without any extra machinery.

ML aside. The first principal component of a mean-centered data matrix XX is the unit vector q1\mathbf{q}_1 maximizing q(XX)q\mathbf{q}^\top (X^\top X) \mathbf{q} — the direction of maximum variance. By Corollary 5, that maximizer is the top eigenvector of XXX^\top X, achieving value λ1\lambda_1. Each subsequent component maximizes the same Rayleigh quotient subject to orthogonality with the previous components — exactly the Courant-Fischer characterization of λ2,λ3,\lambda_2, \lambda_3, \ldots in the next section. PCA is the iterative application of the Rayleigh quotient. pca-and-spectral-methods →

Symmetric matrix A
θ = 0.00 rad   (0.00°)
RA(x(θ)) = 5.00
λmax = 5.00, λmin = 1.00
RA restricted to this 1D subspace: 3.00
(constrained value, between λmin and λmax)
Drag the red probe around the unit circle. The right panel's red marker tracks R_A. Peaks are λ_max and λ_min, attained at the eigenvector angles (blue, emerald).
Two-panel figure: unit circle with eigenvector directions on the left, Rayleigh quotient as a function of angle on the right with horizontal dashed lines at lambda_max and lambda_min
The Rayleigh quotient on the unit circle. Peaks coincide with the eigenvector angles; peak values are the eigenvalues. The horizontal dashed lines mark λ_max and λ_min as the upper and lower envelopes of R_A.

9. The Courant-Fischer Min-Max Principle

The Rayleigh quotient (§8) characterized λ1\lambda_1 and λn\lambda_n as extrema. What about λ2,λ3,\lambda_2, \lambda_3, \ldots? Restricting the Rayleigh quotient to vectors orthogonal to q1\mathbf{q}_1 removes the top eigendirection, and the remaining max becomes λ2\lambda_2. But this construction requires already knowing q1\mathbf{q}_1 — a chicken-and-egg problem when we want to characterize eigenvalues without first computing the others.

The Courant-Fischer min-max principle avoids the dependence. It characterizes the kk-th eigenvalue as a max-over-kk-dimensional-subspaces of a min, or equivalently a min-over-(nk+1)(n-k+1)-dimensional-subspaces of a max. Either formulation captures λk\lambda_k without first computing λ1,,λk1\lambda_1, \ldots, \lambda_{k-1}.

🔷 Theorem 10 (Courant-Fischer Min-Max Principle)

Let AA be real symmetric with eigenvalues λ1λn\lambda_1 \geq \cdots \geq \lambda_n. For each k=1,2,,nk = 1, 2, \ldots, n:

λk=maxSRndimS=k  minxSx=1xAx=minSRndimS=nk+1  maxxSx=1xAx.\lambda_k = \max_{\substack{S \subseteq \mathbb{R}^n \\ \dim S = k}} \; \min_{\substack{\mathbf{x} \in S \\ \|\mathbf{x}\| = 1}} \mathbf{x}^\top A \mathbf{x} = \min_{\substack{S \subseteq \mathbb{R}^n \\ \dim S = n - k + 1}} \; \max_{\substack{\mathbf{x} \in S \\ \|\mathbf{x}\| = 1}} \mathbf{x}^\top A \mathbf{x}.

Proof.

We prove the max-min form; the min-max form is the same argument with signs flipped. Let q1,,qn\mathbf{q}_1, \ldots, \mathbf{q}_n be the orthonormal eigenbasis from the spectral theorem, with Aqi=λiqiA \mathbf{q}_i = \lambda_i \mathbf{q}_i and λ1λn\lambda_1 \geq \cdots \geq \lambda_n.

Lower bound (λkmaxSminxS,x=1xAx\lambda_k \leq \max_S \min_{\mathbf{x} \in S, \|\mathbf{x}\|=1} \mathbf{x}^\top A \mathbf{x}). Take S=span(q1,,qk)S = \operatorname{span}(\mathbf{q}_1, \ldots, \mathbf{q}_k), a kk-dimensional subspace. For any unit x=i=1kciqiS\mathbf{x} = \sum_{i=1}^k c_i \mathbf{q}_i \in S with ci2=1\sum c_i^2 = 1:

xAx=i=1kλici2λki=1kci2=λk,\mathbf{x}^\top A \mathbf{x} = \sum_{i=1}^k \lambda_i c_i^2 \geq \lambda_k \sum_{i=1}^k c_i^2 = \lambda_k,

since each λiλk\lambda_i \geq \lambda_k for iki \leq k. The min over this particular SS is at least λk\lambda_k, so the max over all kk-dim subspaces is at least λk\lambda_k.

Upper bound (maxSminxS,x=1xAxλk\max_S \min_{\mathbf{x} \in S, \|\mathbf{x}\|=1} \mathbf{x}^\top A \mathbf{x} \leq \lambda_k). For any kk-dimensional subspace SS, consider its intersection with T=span(qk,qk+1,,qn)T = \operatorname{span}(\mathbf{q}_k, \mathbf{q}_{k+1}, \ldots, \mathbf{q}_n), an (nk+1)(n - k + 1)-dimensional subspace. By dimension counting (Topic 33, §8):

dim(ST)dimS+dimTn=k+(nk+1)n=1.\dim(S \cap T) \geq \dim S + \dim T - n = k + (n - k + 1) - n = 1.

So STS \cap T contains a unit vector x\mathbf{x}^*. Since xT\mathbf{x}^* \in T, expand x=i=knciqi\mathbf{x}^* = \sum_{i=k}^n c_i \mathbf{q}_i with ci2=1\sum c_i^2 = 1. Then

(x)Ax=i=knλici2λki=knci2=λk,(\mathbf{x}^*)^\top A \mathbf{x}^* = \sum_{i=k}^n \lambda_i c_i^2 \leq \lambda_k \sum_{i=k}^n c_i^2 = \lambda_k,

since each λiλk\lambda_i \leq \lambda_k for iki \geq k. So for every choice of kk-dim SS, the min is at most (x)Axλk(\mathbf{x}^*)^\top A \mathbf{x}^* \leq \lambda_k, and therefore the max over all SS is at most λk\lambda_k.

Combining both bounds: λk=maxSminxS,x=1xAx\lambda_k = \max_S \min_{\mathbf{x} \in S, \|\mathbf{x}\|=1} \mathbf{x}^\top A \mathbf{x}. \blacksquare

The Courant-Fischer principle has two important consequences. Cauchy interlacing tells us how eigenvalues of a leading principal submatrix relate to those of the full matrix — a structural fact about how eigenvalues “thin out” as we restrict to subspaces. Weyl’s inequality bounds how much the eigenvalues of a symmetric matrix can move under a perturbation, the foundation of eigenvalue stability in approximate PCA, noise-perturbed kernel methods, and spectral clustering on noisy graphs.

🔷 Corollary 6 (Cauchy Interlacing)

Let AA be a real symmetric n×nn \times n matrix with eigenvalues λ1λn\lambda_1 \geq \cdots \geq \lambda_n, and let BB be the (n1)×(n1)(n-1) \times (n-1) leading principal submatrix of AA (delete the last row and column). Let μ1μn1\mu_1 \geq \cdots \geq \mu_{n-1} be the eigenvalues of BB. Then

λkμkλk+1for each k=1,,n1.\lambda_k \geq \mu_k \geq \lambda_{k+1} \quad \text{for each } k = 1, \ldots, n-1.

The eigenvalues of BB interlace those of AA — between consecutive eigenvalues of AA.

Proof.

The kk-dimensional subspaces of Rn1\mathbb{R}^{n-1} embed canonically into Rn\mathbb{R}^n as kk-dimensional subspaces orthogonal to en\mathbf{e}_n. Apply Courant-Fischer to BB (working in Rn1\mathbb{R}^{n-1}) and to AA (over the same subspaces, restricted to Rn1Rn\mathbb{R}^{n-1} \subset \mathbb{R}^n). The max over a smaller family of subspaces is no larger than the max over the full family, giving μkλk\mu_k \leq \lambda_k. The dual min-max form gives μkλk+1\mu_k \geq \lambda_{k+1}. \blacksquare

🔷 Theorem 11 (Weyl's Inequality (stated))

For real symmetric matrices AA and EE of the same size, let λk(A)\lambda_k(A) denote the kk-th eigenvalue (in non-increasing order). Then

λk(A+E)λk(A)E2,|\lambda_k(A + E) - \lambda_k(A)| \leq \|E\|_2,

where E2=maxiλi(E)\|E\|_2 = \max_i |\lambda_i(E)| is the operator norm. Perturbing AA by EE moves each eigenvalue by at most E2\|E\|_2.

💡 Remark 12 (Why Courant-Fischer matters in practice)

Many ML quantities are eigenvalues of matrices that are perturbations of simpler ones — empirical covariance perturbing a population covariance, noisy kernel matrices perturbing the clean kernel, finite-sample graph Laplacians perturbing their continuum limits. Weyl’s inequality (a consequence of Courant-Fischer) says these perturbations move eigenvalues by at most the operator-norm magnitude of the noise — the foundation of eigenvalue stability. The Davis-Kahan theorem extends stability to eigenvectors with sharper conditions; we mention it as the next step in spectral perturbation theory but defer the development.

The min-max characterization also reads as a constrained optimization: “find the best kk-dimensional approximation of the eigenvalue structure of AA.” For PCA, this becomes “find the kk-dim projection that maximizes captured variance” — and Courant-Fischer says the optimal projection is onto the span of the top kk eigenvectors. Spectral clustering’s “the Fiedler vector gives the best balanced cut” is the same statement for λ2\lambda_2 of the Laplacian.

Three-panel figure showing the Courant-Fischer min-max principle: free max equals top eigenvalue, constrained to 2D subspace orthogonal to top eigenvector gives second eigenvalue, constrained to a 1D subspace gives a specific Rayleigh-quotient value
Courant-Fischer: every eigenvalue is a max-min over subspaces. Constraining to a subspace of dimension k caps the Rayleigh quotient between λ_k and λ_max. The k-th eigenvalue is the max over all k-dim subspaces of the constrained minimum.

10. Principal Axes Geometry

Three pictures from §§6-8 — the spectral theorem’s ellipsoid (Definition 11), the quadratic form’s level sets (Theorem 7), and the Rayleigh quotient’s extrema on the unit sphere (Theorem 9) — are the same geometric object read three ways. This short consolidating section names the unification and applies it to three apparently unrelated ML contexts that all reduce to the same spectral picture.

📐 Definition 13 (Principal Axes)

Let A0A \succ 0 be symmetric positive-definite with spectral decomposition A=QΛQA = Q \Lambda Q^\top. The principal axes of AA are the eigenvectors q1,,qn\mathbf{q}_1, \ldots, \mathbf{q}_n. The principal-axis lengths of the unit ellipsoid E(A)\mathcal{E}(A) are the semi-axes, equal to 1/λi1/\sqrt{\lambda_i} along qi\mathbf{q}_i.

The interpretation: a positive-definite symmetric matrix is “a uniform stretching along an orthogonal set of axes.” The axes are the eigenvectors; the stretch factors are the eigenvalues. This is the picture every covariance ellipse, every quadratic loss landscape, and every Mahalanobis ball is invoking.

🔷 Proposition 4 (Whitening Transformation)

Let Σ0\Sigma \succ 0 be a symmetric positive-definite matrix with spectral decomposition Σ=QΛQ\Sigma = Q \Lambda Q^\top. The whitening transformation

W=Σ1/2=QΛ1/2QW = \Sigma^{-1/2} = Q \, \Lambda^{-1/2} \, Q^\top

satisfies WΣW=IW \Sigma W^\top = I. Equivalently, if XX is a random vector with covariance Σ\Sigma, then WXWX has covariance II.

Proof.

WW is symmetric: W=(QΛ1/2Q)=QΛ1/2Q=WW^\top = (Q \Lambda^{-1/2} Q^\top)^\top = Q \Lambda^{-1/2} Q^\top = W. So W=WW^\top = W, and the conjugation WΣWW \Sigma W^\top simplifies:

WΣW=(QΛ1/2Q)(QΛQ)(QΛ1/2Q)=QΛ1/2(QQ)Λ(QQ)Λ1/2Q.W \Sigma W = (Q \Lambda^{-1/2} Q^\top)(Q \Lambda Q^\top)(Q \Lambda^{-1/2} Q^\top) = Q \Lambda^{-1/2} (Q^\top Q) \Lambda (Q^\top Q) \Lambda^{-1/2} Q^\top.

Using QQ=IQ^\top Q = I (orthogonality of QQ) at each step: WΣW=QΛ1/2ΛΛ1/2Q=QIQ=IW \Sigma W = Q \Lambda^{-1/2} \Lambda \Lambda^{-1/2} Q^\top = Q I Q^\top = I. \blacksquare

📝 Example 12 (Whitening a 2D Gaussian)

Let Σ=(4222)\Sigma = \begin{pmatrix} 4 & 2 \\ 2 & 2 \end{pmatrix}. Eigenvalues from the characteristic polynomial λ26λ+4=0\lambda^2 - 6\lambda + 4 = 0: λ1=3+55.236\lambda_1 = 3 + \sqrt{5} \approx 5.236, λ2=350.764\lambda_2 = 3 - \sqrt{5} \approx 0.764.

Eigenvectors: q1(0.851,0.526)\mathbf{q}_1 \approx (0.851, 0.526)^\top (high-variance direction); q2(0.526,0.851)\mathbf{q}_2 \approx (-0.526, 0.851)^\top (low-variance direction). The data ellipse — the locus where the multivariate-normal density takes any fixed value — is an ellipse with semi-axes 5.2362.29\sqrt{5.236} \approx 2.29 and 0.7640.87\sqrt{0.764} \approx 0.87, oriented along q1\mathbf{q}_1 and q2\mathbf{q}_2.

The whitening transformation W=Qdiag(1/5.236,1/0.764)QW = Q \operatorname{diag}(1/\sqrt{5.236}, 1/\sqrt{0.764}) Q^\top stretches the data along q2\mathbf{q}_2 (where variance is small) and compresses along q1\mathbf{q}_1 (where variance is large), so the resulting distribution is circularly symmetric. Linear regression after whitening becomes well-conditioned; Mahalanobis distance becomes Euclidean distance in the whitened coordinates.

💡 Remark 13 (The three pictures, unified)

A positive-definite symmetric matrix AA is simultaneously three different objects:

(a) A quadratic form xAx\mathbf{x}^\top A \mathbf{x} whose level sets are ellipsoids (Definition 11);

(b) A linear map whose action on the unit sphere stretches it to an ellipsoid (the spectral-theorem picture from the <SpectralDecompositionVisualizer /> above);

(c) An inner product structure x,yA=xAy\langle \mathbf{x}, \mathbf{y} \rangle_A = \mathbf{x}^\top A \mathbf{y} that defines the Mahalanobis distance dA(x,y)=(xy)A(xy)d_A(\mathbf{x}, \mathbf{y}) = \sqrt{(\mathbf{x} - \mathbf{y})^\top A (\mathbf{x} - \mathbf{y})}.

The eigenvalues and eigenvectors are the same in all three pictures; only the visualization differs. This is the unifying observation that makes spectral methods so reusable across ML and statistics. mahalanobis-distance →

ML aside. Adam, RMSProp, and AdaGrad are approximate whitening methods for gradient descent. Each maintains a running estimate of (the diagonal of) the loss Hessian and uses it to rescale per-coordinate step sizes — effectively applying a diagonal approximation of Σ1/2\Sigma^{-1/2} to the gradient at each step. Full whitening would require the full eigendecomposition of the Hessian; the diagonal approximation is what is computationally tractable. The condition number κ(H)=λmax/λmin\kappa(H) = \lambda_{\max} / \lambda_{\min} from the Hessian topic is the anisotropy of the loss ellipsoid — the ratio of longest to shortest axis. Newton’s method whitens fully (uses H1H^{-1} as preconditioner) and converges in one step on a pure quadratic.

Four-panel figure: data ellipse for a covariance matrix, loss landscape with Hessian eigenvectors as principal axes, whitening transformation mapping ellipse to circle, generic ellipsoid of x'Ax = 1
The same spectral picture, four contexts. (1) Data ellipse from a covariance matrix Σ. (2) Loss landscape with Hessian H. (3) Whitening transformation Σ^(-1/2). (4) Generic ellipsoid of xᵀAx = 1. The eigenvectors are the principal axes everywhere; the eigenvalues are the variances/curvatures/semi-axis lengths.

11. Connections to Machine Learning

The spectral theorem and its corollaries are the most heavily reused piece of linear algebra in machine learning. Three applications span the full breadth of the topic, each pulling on a different part of what we built. We do not develop the algorithms here — that is the job of the formalML site — but the mathematics each technique invokes is contained in this topic.

11.1. Gradient descent and the Hessian spectrum

Near a strict local minimum θ\boldsymbol{\theta}^* of a smooth loss L ⁣:RpRL \colon \mathbb{R}^p \to \mathbb{R}, the gradient flow θ˙=L(θ)\dot{\boldsymbol{\theta}} = -\nabla L(\boldsymbol{\theta}) linearizes to δ˙=Hδ\dot{\boldsymbol{\delta}} = -H \boldsymbol{\delta} where H=2L(θ)H = \nabla^2 L(\boldsymbol{\theta}^*) and δ=θθ\boldsymbol{\delta} = \boldsymbol{\theta} - \boldsymbol{\theta}^*. The Hessian is symmetric (Clairaut, Topic 11) and positive-definite at a strict local minimum, so the spectral theorem applies: H=QΛQH = Q \Lambda Q^\top.

Change coordinates to y=Qδ\mathbf{y} = Q^\top \boldsymbol{\delta} — the eigenbasis. The dynamics decouple into pp independent scalar ODEs:

y˙i=λiyi,yi(t)=eλityi(0).\dot y_i = -\lambda_i y_i, \qquad y_i(t) = e^{-\lambda_i t} \, y_i(0).

Each eigencomponent decays at rate λi\lambda_i; the slowest mode (smallest eigenvalue) dominates the long-time behavior.

Discrete gradient descent with step size η\eta replaces eλite^{-\lambda_i t} with (1ηλi)k(1 - \eta \lambda_i)^k, where kk is the iteration count. Convergence requires 1ηλi<1|1 - \eta \lambda_i| < 1 for every ii, i.e. η<2/λmax\eta < 2/\lambda_{\max}. The optimal step size η=2/(λmax+λmin)\eta^* = 2/(\lambda_{\max} + \lambda_{\min}) minimizes the worst-case rate, giving convergence at rate

(κ1κ+1)k,κ=λmaxλmin.\left(\frac{\kappa - 1}{\kappa + 1}\right)^k, \qquad \kappa = \frac{\lambda_{\max}}{\lambda_{\min}}.

The condition number κ\kappa is the principal-axis aspect ratio of the loss ellipsoid. Ill-conditioned problems (κ1\kappa \gg 1) train slowly along the small-eigenvalue direction. Newton’s method effectively rescales the dynamics to κ=1\kappa = 1 (preconditioning by H1H^{-1}) — one step suffices for an exact quadratic loss. gradient-descent →

📝 Example 13 (Convergence rate on a quadratic loss)

Let L(θ)=12θHθL(\boldsymbol{\theta}) = \frac{1}{2} \boldsymbol{\theta}^\top H \boldsymbol{\theta} with H=diag(1,10,100)H = \operatorname{diag}(1, 10, 100). Eigenvalues λmin=1\lambda_{\min} = 1, λmax=100\lambda_{\max} = 100, κ=100\kappa = 100. Optimal step size η=2/1010.0198\eta^* = 2/101 \approx 0.0198.

After 100 iterations of optimal-step gradient descent, the slow direction (eigenvalue 1) has residual

(12/101)100=(99/101)100e20.135.(1 - 2/101)^{100} = (99/101)^{100} \approx e^{-2} \approx 0.135.

Only ~87% reduction — a hundred iterations bought you about two halvings of the error. The fast direction (eigenvalue 100) has residual (1200/101)100(0.98)1000.13(1 - 200/101)^{100} \approx (-0.98)^{100} \approx 0.13 — about the same magnitude, but oscillating in sign because the step is “too large” for this direction. Newton’s method on the same LL converges in one step: θ1=θ0H1L(θ0)=θ0θ0=0\boldsymbol{\theta}_1 = \boldsymbol{\theta}_0 - H^{-1} \nabla L(\boldsymbol{\theta}_0) = \boldsymbol{\theta}_0 - \boldsymbol{\theta}_0 = \boldsymbol{0}.

11.2. PCA as the spectral theorem

Let XRn×pX \in \mathbb{R}^{n \times p} be a mean-centered data matrix (nn observations, pp features). The sample covariance is

Σ=1n1XX,\Sigma = \frac{1}{n - 1} X^\top X,

a symmetric positive-semidefinite matrix. By the spectral theorem, Σ=QΛQ\Sigma = Q \Lambda Q^\top with Λ=diag(λ1,,λp)\Lambda = \operatorname{diag}(\lambda_1, \ldots, \lambda_p) ordered non-increasingly. The columns of QQ are the principal components q1,,qp\mathbf{q}_1, \ldots, \mathbf{q}_p; the diagonal entries are the variances along those directions.

The first principal component q1\mathbf{q}_1 is the unit vector maximizing qΣq\mathbf{q}^\top \Sigma \mathbf{q} — the direction of maximum variance. By Theorem 9 (Rayleigh quotient), the maximum is λ1\lambda_1 achieved at q1\mathbf{q}_1. The first kk components capture variance i=1kλi\sum_{i=1}^k \lambda_i; the explained-variance ratio is

i=1kλii=1pλi.\frac{\sum_{i=1}^k \lambda_i}{\sum_{i=1}^p \lambda_i}.

PCA truncation to the top kk components gives the best rank-kk approximation in Frobenius norm (Eckart-Young, which we do not prove). All of this — the variance maximization, the orthogonality, the explained-variance ordering — is the spectral theorem read as a statistical procedure. PCA is the spectral decomposition of a covariance matrix. principal-components-analysis →

11.3. Spectral clustering and kernel methods

Spectral clustering. Let GG be a graph with weighted adjacency matrix WW (entries wij0w_{ij} \geq 0). The graph Laplacian is

L=DW,D=diag(jwij),L = D - W, \qquad D = \operatorname{diag}\left(\textstyle\sum_j w_{ij}\right),

symmetric positive-semidefinite. Its smallest eigenvalue is 00 with eigenvector 1\mathbf{1} (when GG is connected); the next smallest is the Fiedler value, and its eigenvector — the Fiedler vector — gives an approximate minimum balanced cut of GG by sign: vertices with positive Fiedler-vector entry form one cluster, negative the other. Spectral clustering uses the bottom kk nontrivial eigenvectors as features and applies kk-means in that feature space. spectral-clustering →

Kernel methods. A kernel k:X×XRk : \mathcal{X} \times \mathcal{X} \to \mathbb{R} is positive-semidefinite if its Gram matrix Kij=k(xi,xj)K_{ij} = k(\mathbf{x}_i, \mathbf{x}_j) is symmetric PSD for every finite point set {xi}\{\mathbf{x}_i\}. Mercer’s theorem decomposes the kernel as an infinite-dimensional spectral expansion:

k(x,y)=i=1λiϕi(x)ϕi(y).k(\mathbf{x}, \mathbf{y}) = \sum_{i=1}^\infty \lambda_i \, \phi_i(\mathbf{x}) \, \phi_i(\mathbf{y}).

The finite-dimensional version is the spectral decomposition of the Gram matrix K=UΛUK = U \Lambda U^\top. Kernel PCA, kernel ridge regression, Gaussian-process predictive means — all of them are matrix-spectrum computations on this Gram matrix. kernel-methods →

Both constructions are the spectral theorem applied to a structured positive-semidefinite matrix. The construction is the same; only the matrix changes.

Three-panel figure showing gradient descent on an ill-conditioned quadratic loss: contour plot with eigenvector axes, trajectories at three step sizes, loss vs iteration curves
Gradient descent on a quadratic loss with κ = 100. Left: the loss contours form long thin ellipses oriented along the eigenvectors of H. Middle: gradient descent at three step sizes; too small wastes iterations on the fast direction, too large oscillates. Right: loss-vs-iteration on a log scale shows the asymptotic rate (κ−1)/(κ+1) ≈ 0.98 — painfully slow.

12. Where This Leads

We have built the spectral picture of symmetric matrices: orthogonal eigenvectors, real eigenvalues, the factorization A=QΛQA = Q \Lambda Q^\top, the definiteness classification, the Rayleigh quotient as a variational characterization, and Courant-Fischer as its extension to every eigenvalue. Four natural sequels extend this story in different directions, each living elsewhere in the curriculum (or on a sister site).

Singular value decomposition (SVD) extends the spectral theorem to rectangular matrices. For any m×nm \times n real matrix AA — not necessarily square, not necessarily symmetric — there exist orthogonal UU (m×mm \times m), VV (n×nn \times n), and a diagonal Σ\Sigma (m×nm \times n, non-negative entries called singular values) such that

A=UΣV.A = U \, \Sigma \, V^\top.

The construction reduces to the spectral theorem on AAA^\top A and AAA A^\top (both symmetric positive-semidefinite). The geometric reading is that every linear map between inner-product spaces factors as “rotate, scale along orthogonal axes, rotate again.” SVD is the foundation of low-rank approximation (Eckart-Young), the Moore-Penrose pseudoinverse, and the bulk of modern numerical linear algebra. It is the natural next topic on this track, currently planned for a future curriculum cycle.

Principal Component Analysis (PCA) is the statistical sibling of SVD: PCA on a centered data matrix XX is the singular value decomposition of XX with the singular values squared giving the variances. We previewed PCA in §11.2; the full statistical treatment lives on formalstatistics.com, and the ML treatment on formalml.com. The mathematics is entirely contained in this topic — PCA adds no new linear algebra.

Perturbation theory of eigenvalues asks how the spectrum of A+EA + E relates to the spectrum of AA for small EE. Weyl’s inequality (Theorem 11) is the entry point; Bauer-Fike, Davis-Kahan, and the resolvent expansion are the next steps. The theory is essential for understanding numerical stability of eigenvalue solvers and for proving consistency results in statistical learning theory — e.g. that empirical PCA on a sample converges to population PCA as nn \to \infty. Trefethen & Bau, Stewart-Sun, and Kato are the standard references; we do not develop perturbation theory here.

Infinite-dimensional spectral theory extends every finite-dimensional theorem in this topic to compact self-adjoint operators on a Hilbert space. The spectral theorem becomes a sum over a countable orthonormal basis of eigenvectors with eigenvalues converging to zero. The Hilbert Spaces topic states the infinite-dimensional theorem and uses it for Fourier series, Sturm-Liouville theory, and integral operators. The finite-dimensional intuition and proof developed here are exactly the right preparation for that material.

Within the Linear Algebra track, this topic completes the currently planned curriculum. Future track extensions might include SVD as a dedicated topic, quadratic forms in optimization (closing the loop with Hessian), and a numerical-linear-algebra topic covering the QR algorithm, power iteration, Lanczos, and Arnoldi. Those are deferred to a future curriculum cycle.

Connections & Further Reading

On to formalML — where this calculus powers ML

Pca And Spectral Methods

PCA is the spectral theorem applied to a covariance matrix. The first k principal components are the top k eigenvectors of XᵀX/(n−1), and the k-dimensional projection retaining maximum variance is the projection onto their span. Spectral methods for clustering, embedding, and dimensionality reduction all instantiate the same construction on different positive-semidefinite matrices.

Gradient Descent

Gradient descent on a quadratic loss L(θ) = ½θᵀHθ decomposes along the eigenbasis of H: each eigencomponent decays at rate e^{−λᵢt} in continuous time or (1 − ηλᵢ)^k in discrete time. The condition number κ(H) = λ_max/λ_min bounds the convergence rate, and the principal-axis picture of the loss landscape — ellipsoidal level sets oriented along eigenvectors — explains why ill-conditioned problems train slowly.

Spectral Clustering

Spectral clustering uses the eigenvectors of a graph Laplacian L = D − W (or its normalized variants) to partition data points. L is symmetric positive-semidefinite, and the Fiedler vector (the eigenvector for the second-smallest eigenvalue) gives an approximate balanced cut. The construction is a direct application of the spectral theorem to a structured PSD matrix.

Kernel Methods

Mercer's theorem decomposes a positive-semidefinite kernel as K(x, y) = Σᵢ λᵢ φᵢ(x) φᵢ(y) — an eigenvalue expansion. The finite-dimensional version is the spectral decomposition of the Gram matrix Kᵢⱼ = k(xᵢ, xⱼ). Kernel PCA, kernel ridge regression, and Gaussian-process predictive means are all matrix-spectrum computations on this Gram matrix.

References

  1. book Axler (2024). Linear Algebra Done Right The eigenvalue-first textbook. Chapters 5 and 7 develop spectral theory before determinants — the opposite of our ordering. Read for the cleanest possible treatment of invariant subspaces, the spectral theorem for self-adjoint operators (Axler's Theorem 7.13), and the inner-product-space approach to quadratic forms.
  2. book Strang (2023). Introduction to Linear Algebra Chapter 6 (eigenvalues and eigenvectors) and Chapter 7 (SVD) are the closest published match to our pedagogical line for this topic. Strang's emphasis on the geometric meaning of Ax = λx — directions that don't rotate — is the framing we take.
  3. book Horn & Johnson (2013). Matrix Analysis The rigorous reference. Chapter 1 covers the characteristic polynomial and similarity; Chapter 2 covers unitary similarity and triangularization; Chapter 4 covers Hermitian matrices and variational characterizations (Courant-Fischer). Use for cross-checking statements; not for pedagogy.
  4. book Meyer (2000). Matrix Analysis and Applied Linear Algebra Chapter 7 (eigenvalues and eigenvectors) is the source for our proof of the spectral theorem via induction on dimension. The geometric pictures of quadratic forms in §7.5 are the visual templates for our principal-axes visualizations.
  5. book Trefethen & Bau (1997). Numerical Linear Algebra Lectures 24–30 cover eigenvalue algorithms in depth — QR iteration, Hessenberg form, divide-and-conquer. We cite this only as the right place to learn the numerical theory we explicitly do not develop. Lecture 24's discussion of why the characteristic polynomial is the wrong way to compute eigenvalues is the source for our computational-reality remark in §3.
  6. book Hoffman & Kunze (1971). Linear Algebra Chapter 6 (elementary canonical forms) and Chapter 7 (the rational and Jordan forms) are the standard rigorous treatment of diagonalizability and Jordan normal form. Used here as the reference for the defective-matrix detour.
  7. book Lax (2007). Linear Algebra and Its Applications Lax's chapters on spectral theory of self-adjoint operators and the Courant-Fischer min-max principle are the cleanest finite-dimensional treatment of the material we cover in §§7–9. Bridges naturally to the functional-analysis topics in Track 8.
  8. paper Pearson (1901). “On Lines and Planes of Closest Fit to Systems of Points in Space” Karl Pearson's original PCA paper. Cited as the historical origin of the principal-axes geometry of data — predates the modern statistical formulation but contains the geometric idea in its first form.