Perturbation theory: Weyl and Davis–Kahan
Before this lesson: lesson 06 (spectral theorem, Rayleigh quotient, Courant–Fischer; Weyl is proved there), lesson 08 (the SVD) and lesson 09 (PCA); conditioning is in lesson 13. Time: about 70 minutes, plus the notebook.
Why this matters #
In practice every matrix is a noisy copy of the matrix we care about: a sample covariance instead of the population covariance, a graph Laplacian built from noisy similarities, a quantized weight matrix, the floating-point output of an eigensolver. Perturbation theory says which spectral quantities survive the noise. Eigenvalues of symmetric matrices are robust: they move at most as much as the noise (Weyl). Eigenvectors are only as robust as the eigengap, the distance from their eigenvalue to the rest of the spectrum (Davis–Kahan). This one idea tells you when principal components can be trusted, how spectral clustering picks the number of clusters, why climate scientists group nearly equal EOFs, and when a low-rank compression keeps its subspace.
1. Predict first #
2. The picture #
Simplest case. with and gap . Add the off-diagonal noise , with . The matrix has eigenvalues
and its top eigenvector makes an angle with , where (section 3 derives this). There are two regimes:
- Large gap (): , and each eigenvalue moves by about , much less than .
- Small gap (): , so , however small is. The eigenvalues still move by at most .
So the eigenvalue error is controlled by alone, and the eigenvector error by .
Why, as a picture. maps the unit circle to an ellipse with half-axes and , and the eigenvectors are its axes. With a small gap the ellipse is almost a circle. Its axes are poorly defined, and a small bump can turn them anywhere. At (a circle) every direction is an eigenvector.
Shrink the gap. Here and . On the left, the blue dashed ellipse is the unit circle mapped by , the orange one is mapped by ; the arrows are their long axes and . Move below : the ellipse becomes a circle and turns by almost , while the eigenvalues move by less than . On the right, the true (orange) is about for large gaps, where it almost touches the classical bound (aqua), and it levels off at for small gaps. Both Davis–Kahan bounds of section 3 stay above it; the bound (violet) is twice as large for large gaps.
Keep the noise at and shrink the gap from 1 to 0.001. What happens?
Eigenvalues are controlled by alone (Weyl), so their move is at most 0.01 for every gap. The eigenvector angle satisfies : for that gives , for it gives . The angle never passes here, because .
3. Definitions and main results #
Throughout, and are real symmetric matrices, with eigenvalues and and orthonormal eigenvectors and .
Eigenvalues: Weyl #
Theorem (Weyl). for every .
Lesson 06 proves it from Courant–Fischer: the Rayleigh quotients add, , and always lies in . So the eigenvalues of a symmetric matrix have condition number 1: an error of size in the matrix gives an error of at most in every eigenvalue.
Each eigenvalue stays in its own interval. Row shows of an symmetric (blue), the interval (aqua) and of (orange). Increase and press New noise: the orange dot never leaves its interval, even when neighbouring intervals overlap. Choose to see that the bound is reached, and a rank-one to see every eigenvalue move up.
Frobenius version (Hoffman–Wielandt): . It bounds all the moves together.
Singular values: Weyl for any matrix #
Theorem (Weyl for singular values). For any and every ,
The matrices need not be square or symmetric. The trick is to build a symmetric matrix whose eigenvalues are the singular values.
The symmetric embedding. For , let
It is symmetric. Its eigenvalues are with , plus zeros.
Small example first. (, singular values 3 and 1). is , and its eigenvalues are . The single 0 comes from .
Proof of the theorem.
- Let and (the SVD, lesson 08). Then and .
- These vectors are orthogonal. The remaining eigenvectors come from the null space: if , every unit has , so (the case is the same with ).
- Sorted in decreasing order, the eigenvalues of are
So for . 4. is linear: . By steps 1–2 for , the largest is . So . 5. Weyl for the symmetric matrices and gives
By step 3, for the left side is .
The same embedding turns other symmetric results into results about singular values. Wedin's theorem below is the singular-vector version of Davis–Kahan.
Non-symmetric matrices have no such bound #
For a non-symmetric matrix, a tiny can move the eigenvalues a lot. The extreme case is a Jordan block: the matrix with zeros on the diagonal and ones just above it. Its only eigenvalue is 0. Put in its bottom-left corner. The characteristic polynomial becomes , so the eigenvalues are the points on a circle of radius . For and that radius is ; for and the eigenvalues move by , a billion times .
A non-normal matrix amplifies noise. The orange dots are the eigenvalues of in the complex plane. They sit on the violet circle of radius , far outside the aqua disc that Weyl and Bauer–Fike give for a symmetric or normal matrix (for small this disc is so small that it hides under the blue dot at 0). Make larger or smaller and read the amplification. Switch to a random with the same norm: the eigenvalues still spread around a circle of about the same size (usually a little smaller, because only part of the norm of sits in the corner entry).
is the Jordan block with eigenvalue 0. You put in its bottom-left corner. About how large are the new eigenvalues?
The characteristic polynomial of the perturbed block is , so : more than 2000 times the size of the perturbation. Weyl does not apply, because is not symmetric.
Bauer–Fike and near-defective matrices
Theorem (Bauer–Fike). Let be diagonalizable. Every eigenvalue of satisfies , where .
Proof.
- If is an eigenvalue of , there is nothing to prove. Otherwise is invertible.
- is singular, so is singular. Then some unit has , so .
- .
- So .
The condition number of the eigenvector matrix is the amplifier. For symmetric , is orthogonal and : the same constant 1 as in Weyl. The same holds for every normal matrix (), which also has orthonormal eigenvectors (complex ones in general).
Ill-conditioned eigenvectors, not an ill-conditioned matrix. "Near-defective" means that the eigenvector matrix is ill-conditioned; itself can be well-conditioned. has but , and an entry at position moves both eigenvalues by about . A defective matrix (like the Jordan block) is the limit ; there the move is like , not proportional to .
Angles between subspaces #
To say how far an eigenvector or an eigenspace has moved, we need a distance between subspaces. Comparing vectors entry by entry does not work: and are the same eigenvector, and inside an eigenspace any orthonormal basis is allowed. We use angles. Three cases in show the idea.
Two lines. For unit vectors , the angle is given by . The absolute value ignores the sign. Example: and give , so and . Two useful forms: (the part of that is not along ) and (the distance between the two projectors).
A line and a plane. Project the line onto the plane. The angle is the angle between the line and its shadow. Example: the line through and the -plane. The shadow is along , and , so .
Two planes in . They always share a line (, as in lesson 06). So the first angle is . The second angle is the opening angle between the planes, measured perpendicular to the shared line. Example: the -plane and the plane spanned by and share the -axis, and they open by .
Turn and tilt . Blue is (the -axis, or the -plane), orange is . The readout computes the singular values of and the principal angles. With two planes, the magenta line is the shared line, and always; the arc shows . With line and plane, the dashed segment drops the line onto its shadow. For equal dimensions the readout also checks .
The general definition. Let have orthonormal columns. The principal angles between their column spaces are given by
and we collect their sines in the diagonal matrix .
In words: is the smallest angle between a vector of one subspace and a vector of the other. Remove these two directions; is the smallest angle between what is left, and so on. The result does not depend on the choice of bases: changes to with orthogonal , which has the same singular values. Two facts make a distance between subspaces:
For the two planes above: , the angles are and , and .
is the -plane and is the -plane in . What are the principal angles?
The planes share the -axis, so . Perpendicular to it, and are at , so . With bases and , , with singular values 1 and 0. Two planes in can never have .
First-order perturbation: where the gap comes from #
Step 1: the exact answer. A symmetric matrix has a unit eigenvector . Write in both rows:
Multiply the first equation by , the second by , and subtract. cancels:
With and this is .
So . For this gives
Step 2: compare with a first-order guess. For small , , so and : (coupling)/(gap). The table compares the exact angle with for .
| exact | first order | |
|---|---|---|
| 0.01 | 0.573° | 0.573° |
| 0.1 | 5.65° | 5.73° |
| 0.5 | 22.5° | 28.6° |
| 1 | 31.7° | 57.3° |
The first-order answer is excellent while . When is comparable to , it is too large: the exact angle can never pass , but grows without limit.
Step 3: the general formulas. Let be a simple (not repeated) eigenvalue, and let be the eigenpair of that starts at , with . Then
Derivation.
- Differentiate at : .
- Multiply on the left by . As , the terms with cancel: .
- Multiply by with : , so .
- From : . Expand in the eigenbasis.
For the example, and , so and : the same as in step 2.
How to read the formulas:
- The eigenvalue changes by , which is at most : the same constant 1 as Weyl.
- The eigenvector mixes in each with weight (coupling)/(gap). The nearest eigenvalue dominates, and . So the condition number of an eigenvector is 1/gap.
- At a repeated eigenvalue the formula divides by zero. Inside the eigenspace the eigenvectors are not unique, and an arbitrarily small picks the basis. The eigenspace itself stays stable if it is separated from the rest of the spectrum.
The Davis–Kahan theorem #
The first-order formula holds only for small . Davis–Kahan gives a bound for every .
Theorem (one eigenvector, classical form). Let with , let be the eigenvector of that we compare with , and let , the distance from to the other eigenvalues of . If , then
Proof.
- Residual: as , we get .
- Write in the orthonormal eigenbasis of (here symmetry is used). Then .
- Take norms (the are orthonormal), drop the term , and use for :
- . Hence .
The gap uses the eigenvalues of the noisy matrix . In statistics we know 's gap better, or we want a bound in terms of it. The next corollary uses only the gap of , at the price of a factor 2.
Corollary (gap of only; Yu, Wang and Samworth). Let , with and . Then
Proof of the corollary
- If , the right side is above 1, and always. Nothing to prove.
- If , Weyl gives, for , , and for , .
- So every other eigenvalue of is at distance at least from : .
- The theorem gives .
Read the corollary in words: the eigenvector turns by at most about (noise)/(gap). When the bound is above 1, it says nothing; the vector may or may not turn.
Subspace version. Let hold eigenvectors of , the matching eigenvectors of , and the gap between this block of eigenvalues and the rest of the spectrum of . Then (Yu, Wang, Samworth 2015)
Gaps inside the block do not matter: only the separation of the block from the rest. This is why a cluster of close eigenvalues has a stable subspace even when its single eigenvectors are unstable.
Sharpness, the classical subspace form, and singular vectors (Wedin)
The constant 2 cannot be improved in general: Yu, Wang and Samworth give an example where the bound is reached (there is orthogonal to ). For small the first-order formula gives at most about , half the bound. The classical Davis–Kahan form is in the spectral or Frobenius norm, when the block eigenvalues of lie in an interval and the other eigenvalues of lie outside .
Singular vectors (Wedin). For any and of the same shape, let hold the top left and right singular vectors of , and those of . If (singular values of ), then the sines of the principal angles between and , and between and , are at most . The singular-value gap plays the role of the eigengap.
has eigenvalues and . What do the Davis–Kahan bounds support?
For the gap is , so the bound allows a large turn. For the plane the gap is , so . The small gap inside the block does not matter.
Answers to section 1. (1) By Weyl, at most ; in fact both move by about (to and ). For the eigenvector, , so : almost the largest possible turn, . (2) The plane. The gap is small, so alone can turn a lot. The gap between the pair and the rest is , so moves little. Section 4 has the numbers.
4. Worked example #
(a) Same noise, three gaps. with , and :
| gap | eigenvalues of | eigenvalue move | angle of () | bound |
|---|---|---|---|---|
| 1 | 2.0001, 0.9999 | 0.0001 | 0.57° (0.0100) | 0.02 |
| 0.01 | 1.01618, 0.99382 | 0.0062 | 31.7° (0.526) | 2 (no information) |
| 0.001 | 1.01051, 0.99049 | 0.0095 | 43.6° (0.689) | 20 (no information) |
- Weyl holds in every row: every move is below 0.01.
- Row 1: the first-order formula predicts , an angle of rad . Exact.
- Rows 2 and 3: the bound is above 1, so it says nothing, and the angles really are large ( and ).
(b) A cluster. and , that is, in every off-diagonal entry ( is the all-ones vector). Then and .
- has eigenvalues . Each moved by less than (Weyl).
- is away from . The gap is , so the bound says nothing, and the vector really turned.
- The top-2 plane has gap . Its principal angles are and (two planes in always share a line), so . The bound is . The plane is stable, although the vectors inside it are not.
- Why: the noise mostly rotates and inside their plane (the coupling is half the gap ). It tilts the plane only a little (the coupling is small compared with the gap ).
- also has gap : it turns by (), below its bound .
In example (b), what does the corollary guarantee for ?
The gap of is to its only neighbour: . So the bound is ; the true value is . The value forgets the factor 2. The value 2 uses the wrong gap (the gap of ). The cluster does not matter for .
5. In code #
NumPy checks the numbers of sections 3 and 4, tests the corollary in random trials and shows the non-symmetric amplifier. The notebook for this lesson has these cells and the exercises.
import numpy as np
from scipy.linalg import subspace_angles
def eigh_desc(M):
"""Eigenvalues in DEcreasing order and matching eigenvectors (eigh sorts ascending)."""
w, V = np.linalg.eigh(M)
return w[::-1], V[:, ::-1]
# Weyl for singular values through the symmetric embedding H(A) = [[0, A], [A^T, 0]]
A = np.array([[3., 0.], [0., 1.], [0., 0.]])
H = np.block([[np.zeros((3, 3)), A], [A.T, np.zeros((2, 2))]])
print(np.round(np.sort(np.linalg.eigvalsh(H))[::-1], 6)) # [ 3. 1. 0. -1. -3.]
# principal angles: two planes in R^3 share a line
V = np.eye(3)[:, :2] # the xy-plane
Vh = np.column_stack([[1, 0, 0], np.array([0, 1, 1]) / np.sqrt(2)]) # span(e1, (e2+e3)/sqrt2)
print(np.round(np.linalg.svd(Vh.T @ V, compute_uv=False), 4)) # [1. 0.7071]
print(np.round(np.degrees(subspace_angles(Vh, V)), 2)) # [45. 0.]
# 2x2: the same noise and three gaps
F = np.array([[0., 1.], [1., 0.]]); eps = 0.01
for gap in (1.0, 0.01, 0.001):
w, Vg = eigh_desc(np.diag([1 + gap, 1.0]) + eps * F)
theta = np.degrees(np.arccos(abs(Vg[0, 0]))) # angle between q1_hat and e1
print(gap, np.round(w, 5), round(theta, 2), round(2 * eps / gap, 3))
# 1.0 [2.0001 0.9999] 0.57 0.02
# 0.01 [1.01618 0.99382] 31.72 2.0
# 0.001 [1.01051 0.99049] 43.57 20.0
# a cluster: the top eigenvector turns a lot, the top-2 plane does not
A = np.diag([2.0, 1.9, 1.0]); E = 0.05 * (np.ones((3, 3)) - np.eye(3))
w0, V0 = eigh_desc(A); w, V = eigh_desc(A + E)
print(round(np.linalg.norm(E, 2), 6), np.round(w, 4)) # 0.1 [2.0249 1.8801 0.995 ]
print(round(np.degrees(np.arccos(abs(V[:, 0] @ V0[:, 0]))), 2)) # 23.45
ang = subspace_angles(V[:, :2], V0[:, :2]) # principal angles, largest first
print(np.round(np.degrees(ang), 2), round(np.linalg.norm(np.sin(ang)), 4)) # [4.04 0. ] 0.0705
print(round(2 * min(np.sqrt(2) * 0.1, np.linalg.norm(E)) / 0.9, 3)) # 0.272 (the bound)
P, P0 = V[:, :2] @ V[:, :2].T, V0[:, :2] @ V0[:, :2].T
print(round(np.linalg.norm(P - P0, 2), 4)) # 0.0705 = ||sin Theta||_2
# the corollary sin(theta) <= 2 ||E||_2 / delta_k in random trials
rng = np.random.default_rng(0); worst = 0.0
for _ in range(2000):
lam = np.sort(rng.uniform(0, 5, 6))[::-1]
Q, _ = np.linalg.qr(rng.standard_normal((6, 6)))
G = rng.standard_normal((6, 6)); En = rng.uniform(1e-3, 0.3) * (G + G.T)
_, Vh = eigh_desc(Q @ np.diag(lam) @ Q.T + En)
k = rng.integers(6)
delta = min(lam[k - 1] - lam[k] if k > 0 else np.inf, lam[k] - lam[k + 1] if k < 5 else np.inf)
s = np.sqrt(max(0.0, 1 - (Vh[:, k] @ Q[:, k]) ** 2))
worst = max(worst, s / (2 * np.linalg.norm(En, 2) / delta))
print(worst < 1) # True
# non-symmetric: the eigenvector matrix X amplifies (Bauer-Fike)
B = np.array([[1., 1.], [0., 1.001]])
_, X = np.linalg.eig(B)
print(round(np.linalg.cond(B), 2), round(np.linalg.cond(X))) # 2.62 2000
print(np.round(np.linalg.eigvals(B + np.array([[0., 0.], [1e-6, 0.]])).real, 6)) # moved ~6e-4, not 1e-6
subspace_angles returns the principal angles in radians, largest first. Always compare
eigenvectors through , angles or projectors, never entry by entry.
6. Where it shows up #
- PCA from samples. For samples of -dimensional Gaussian data with , the sample covariance has of order (up to a constant). Weyl: the variances are that accurate. Davis–Kahan: principal component is reliable only when this is small compared with , so roughly . When eigenvalues are nearly equal, report the subspace they span, not single components.
- Climate EOFs and ensemble PCA (ML for science). EOFs are the principal components of a climate field. North et al. (1982) give the rule of thumb: the sampling error of an eigenvalue is about for independent samples. If it is comparable to the distance to a neighbouring eigenvalue, the two EOFs are mixed by sampling noise and must be read as a pair. For example, with gives an error of about .
- Spectral clustering. For disconnected clusters, the eigenvectors of the smallest Laplacian eigenvalues span the cluster indicators. Edges between clusters perturb the Laplacian; Davis–Kahan keeps this -dimensional eigenspace close if the gap is large ( sorted ascending). This is the eigengap heuristic for choosing (lesson 19).
- Compression and quantization. Quantization or pruning adds to a weight matrix. The singular values move by at most (Weyl), and the top- singular subspace stays put only if is large compared with (Wedin). With a small gap at the cut, an SVD-based compression can pick a different subspace after a tiny change.
- Numerics. LAPACK's error bound for a computed symmetric eigenvector is about . Eigenvalues are accurate to ; eigenvectors of close eigenvalues are individually unreliable, but their span is reliable.
- Physics. The first-order formulas are Rayleigh–Schrödinger perturbation theory: the energy shift is , and states mix with weights . Degenerate levels need degenerate perturbation theory, for the same reason as above.
7. Common mistakes #
- Comparing eigenvectors entry by entry. and are the same eigenvector, and inside a repeated eigenspace any rotation is allowed. Compare , principal angles or projectors.
- "Small noise, so small eigenvector change." Only relative to the gap: .
- The wrong gap. For the gap is to both neighbours. For a block, it is the gap between the block and the rest; gaps inside the block do not matter.
- Reading a bound above 1 as "large rotation". Such a bound says nothing. Davis–Kahan is an upper bound; the true angle can be small, for example when has the same eigenvectors as .
- Using the first-order formula for large noise. needs ; in the example the true angle never passes .
- Mismatched indices. must be the -th eigenvector of in the same order as
(
np.linalg.eighsorts ascending). - Using Weyl or Davis–Kahan for non-symmetric matrices. Eigenvalues can move by much more than (Bauer–Fike allows ). For general matrices use singular values and Wedin.
8. Check yourself #
- has eigenvalues and . Bound for the top eigenvector, and
for the top-2 eigenspace.
Answer
Top eigenvector: , so . Top-2 eigenspace: , so . - From , derive for a simple eigenvalue.
Answer
Differentiate at : . Multiply by and use : the terms cancel and . - and . What is the top eigenvector to first order?
Answer
. (For the exact ratio of the entries is .) - Where does the Davis–Kahan proof use that is symmetric?
Answer
In steps 2–3: has an orthonormal eigenbasis, so and . For a non-normal the eigenvectors are not orthogonal and this identity fails. - A noisy matrix has singular values , and you know . What can you say about and its top-2 singular subspaces?
Answer
Weyl for singular values: and , so ; but and can be zero or not, so the rank (2, 3 or 4) is not determined. The gap is large, so by Wedin the top-2 singular subspaces are well determined: sines at most . - A sample covariance has eigenvalues , and . Can you report PC1? What can you report?
Answer
Not PC1. By Weyl, the population gap is at most , so the bound is at least : PC1 and PC2 may mix. Report the plane of PC1 and PC2: by Weyl the population gap is at least , so . - What are the eigenvalues of for ?
Answer
is with singular values 2 and 1, so is with eigenvalues (one zero, because ).
State Weyl's inequality for eigenvalues of symmetric matrices.
for every , with both spectra sorted the same way.
State Weyl's inequality for singular values. How is it proved?
for any of the same shape. Apply eigenvalue Weyl to , whose top eigenvalues are the .
State the Bauer–Fike theorem.
If , every eigenvalue of has .
How are the principal angles between two subspaces computed?
With orthonormal bases : .
What is in terms of projectors?
, the spectral-norm distance between the two orthogonal projectors.
What is for a simple eigenvalue of ?
.
What is for the eigenvector of a simple eigenvalue of ?
: each mixes in with weight (coupling)/(gap).
Compute the angle of the top eigenvector of .
, so : almost the maximum .
Davis–Kahan in words.
An eigenvector turns by at most about divided by the gap between its eigenvalue and the neighbouring ones.
Why is the span of a cluster of close eigenvectors stable when its single eigenvectors are not?
The subspace bound uses only the gap between the cluster and the rest; small gaps inside the cluster only let the vectors rotate within the subspace.
9. Interview angle #
- "Eigenvalues are stable but eigenvectors are not. Explain." — Weyl has constant 1; eigenvectors have condition number 1/gap (first-order formula, Davis–Kahan); give the example.
- "How many samples do you need to estimate the top principal component?" — Enough that is small compared with .
- "Two eigenvalues of your covariance are almost equal. What do you report?" — The 2-D subspace they span; it is stable if it is separated from the rest of the spectrum.
- "Why does spectral clustering look at the eigengap?" — The -dimensional eigenspace is stable when is large.
- "The eigenvectors from your solver change between machines. Bug?" — Not necessarily: sign flips and rotations inside a near-degenerate eigenspace are allowed. Compare subspaces.
10. Practice #
The notebook for this lesson runs in Colab. It has four exercises, each with a check cell and a folded solution:
- Weyl in practice: compute the largest eigenvalue move for random symmetric noise, check it against , and find the noise that reaches the bound.
- Write
sin_thetafor two vectors andsin_theta_subspacesfor two subspaces (through projectors), and compare withscipy.linalg.subspace_angles. - Implement the first-order eigenvector formula and show that its error shrinks like .
- Davis–Kahan for PCA: for a covariance with a small and a large eigengap, compare the true angles of the sample eigenvectors with the bound .
11. Watch and read #
- Yi Yu, Tengyao Wang, Richard J. Samworth, A useful variant of the Davis–Kahan theorem for statisticians (Biometrika, 2015): Theorem 1 (the classical form), Theorem 2 (population gap only), Section 4 (singular vectors).
- Yuxin Chen, Yuejie Chi, Jianqing Fan, Cong Ma, Spectral Methods for Data Science: A Statistical Perspective (2021): §2.2 (distances and angles between subspaces), §2.3 (Davis–Kahan, with proof), §2.4 (Wedin), §3.3 (PCA).
- Paige Bright, Alan Edelman, Steven G. Johnson, Matrix Calculus (for Machine Learning and Beyond), ch. 13 "Derivatives of eigenproblems" (the first-order formulas).
- Alex Levis, "Weyl's inequality" (Harvard BST 235 note): a short proof of Weyl from Courant–Fischer.
Runs in your browser with nothing to install. The notebook repeats the key demos and has exercises with checks; solutions are inside, folded.
No Google account needed: Python runs inside your browser. The first start downloads about 40 MB; your changes are saved in this browser only.