Watch any linear map act on the plane and most vectors get knocked off their direction. A few do not: they come out scaled, pointing exactly where they pointed before. Those stubborn directions — eigenvectors — are the transformation’s skeleton, and finding them turns an incomprehensible map into a diagonal one. This lesson earns three things: the decomposition itself, the humble iteration that computes it at web scale, and the spectral theorem — which, count them, already underwrites the condition number κ, the Hessian classification of critical points, ridge’s shrinkage picture, and the covariance geometry of PCA.
The definition, and how to find them by hand
A nonzero is an eigenvector of with eigenvalue when
— the map’s entire action on that direction is a stretch by (negative: flip; magnitude below one: contraction). Rearranged, demands a nonzero vector in the kernel of , which exists exactly when that matrix is singular:
For a 2×2 this is a quadratic with a form worth memorizing, , so and — the area factor from last lesson is the product of the stretches, as it must be. Beyond 3×3 nobody solves characteristic polynomials (they are numerically treacherous); iteration wins, as you are about to see.
If has independent eigenvectors, stack them as columns of :
Read the decomposition as instructions: change into eigen-coordinates, stretch each axis independently, change back. The payoff line turns repeated application — the expensive thing — into powering scalars, and it is the exact tool you used in Optimization to solve gradient descent’s dynamics ( decoupling per eigendirection into factors : that was this lesson, smuggled in early).
Power iteration: the web-ranking algorithm in four lines
Apply repeatedly to almost any starting vector and expand in the eigenbasis:
Every component decays relative to the dominant one at rate — the direction of converges to the top eigenvector, no polynomial-solving required. Normalize each step and you have power iteration, and you have also just derived PageRank: Google’s founding algorithm builds the web’s link matrix (column-stochastic, damped) and power-iterates it; the stationary importance of every page on the internet is the top eigenvector, and the damping factor 0.85 exists precisely to control the gap that sets convergence speed. The same iteration scores nodes in every network (eigenvector centrality), finds the top principal component when the data is too big to decompose, and — as the Deep RL chapter’s power method for values hints — is the quiet engine inside many “iterate to a fixed point” algorithms.
The dashed lines never move when the grid shears around them — drag the columns and watch the skeleton reorient. Press Apply A repeatedly: the gold vector swings toward the dominant eigendirection and locks on; the closer λ₂/λ₁ is to 1 (drag the columns to make the eigenvalues similar — read them in the panel), the more steps it takes — the spectral gap is the convergence rate, exactly as derived above. Try the rotate preset: the readout reports complex eigenvalues and the dashed lines vanish — a pure rotation stretches no real direction, and the power vector just circles forever. That failure case is as instructive as the success.
The spectral theorem: symmetry buys everything
For general matrices, eigenvectors may be non-orthogonal, complex, or missing. For the matrices ML actually optimizes over, nature is kind:
Spectral theorem. Every symmetric has real eigenvalues and an orthonormal basis of eigenvectors: with orthogonal.
Symmetric maps are exactly rotate, stretch along perpendicular axes, rotate back — no shear, no complex behaviour, nothing hidden. And the matrices this curriculum lives on are symmetric by construction: (Supervised Learning’s normal equations), covariance matrices (PCA, next lessons), Hessians (Optimization), kernel matrices (SVMs). For all of them the spectral theorem is why:
- κ was well-defined: the condition number is of a symmetric Hessian — perpendicular stretch factors of the loss’s local bowl.
- Saddles were classifiable: mixed Hessian eigenvalue signs = up in some perpendicular directions, down in others (the Non-convex landscapes lesson’s taxonomy is the spectral theorem plus adjectives).
- Ridge’s shrinkage was diagonal: shares eigenvectors with , shrinking each direction by — the Regularization lesson’s formula, now with its provenance attached.
The quadratic-form view makes the geometry tactile: has the eigenvectors as its principal axes and the eigenvalues as curvatures along them — which is precisely the surface classification you will drive by slider in lesson 5’s widget, and precisely what “positive definite” (: a bowl) means.
import numpy as np
A = np.array([[1.5, 0.45], [0.35, 0.9]])
lam, V = np.linalg.eig(A) # general case
def power_iteration(A, k=50):
v = np.random.randn(A.shape[0])
for _ in range(k):
v = A @ v
v /= np.linalg.norm(v) # the whole algorithm
return v, v @ A @ v # direction, Rayleigh-quotient eigenvalue
S = A + A.T # symmetrize → spectral theorem applies
lam_s, Q = np.linalg.eigh(S) # eigh: real λ, orthonormal Q, sorted
np.testing.assert_allclose(Q @ np.diag(lam_s) @ Q.T, S, atol=1e-12)
Exercises
Work these before the next lesson
- Derive for 2×2, and compute the eigen-pairs of the widget’s default (columns and ). Check against the panel’s readout.
Solution
Worked solutions are part of Premium — unlock all of them for £5/month →
- 5 more exercises — each with a worked solution — are part of Premium. Unlock everything for £5/month →
References
- G. Strang, Introduction to Linear Algebra, ch. 6 — eigenvalues with the geometry kept on.
- S. Brin & L. Page, “The Anatomy of a Large-Scale Hypertextual Web Search Engine”, 1998 — PageRank; read §2.1 and recognize this lesson.
- L. Trefethen & D. Bau, Numerical Linear Algebra — why nobody solves characteristic polynomials, and what production eigensolvers actually do.