Before this lesson:lesson 05
(eigenvalues, diagonalization) and lesson 04(Q⊤Q=I); orthogonal projections are in lesson 03.
Time: about 90 minutes, plus the notebook.
Symmetric matrices are the most common matrices in ML: covariance matrices, Hessians, kernel
(Gram) matrices, graph Laplacians, A⊤A. For them, the problems of lesson 05 cannot happen:
eigenvalues are real, eigenvectors are orthogonal, and there are always enough of them. The
Rayleigh quotient turns eigenvalues into optimization. PCA's first direction, the sharpness of
a loss, the Fiedler vector of spectral clustering and the ground-state energy of a quantum
system are all a max or a min of a Rayleigh quotient. Courant–Fischer does the same for every
eigenvalue. Its corollary, Weyl's inequality, says that symmetric eigenvalues move at most as
much as the noise you add.
Start with a diagonal matrix. Take S=diag(3,1) and a unit vector
x=(cosθ,sinθ). Then
x⊤Sx=3cos2θ+1⋅sin2θ=2+cos2θ.
This is a weighted average of the eigenvalues 3 and 1. The weights are cos2θ and
sin2θ; they are not negative and they sum to 1. So the value lies between 1 and 3. The
max is on the e1 axis, the min on the e2 axis. S maps the unit circle to an ellipse
with half-axes 3 and 1.
A general symmetric matrix looks the same in the right axes.S=QΛQ⊤ means three
steps: change to the orthonormal eigen-axes (Q⊤), scale each axis (Λ), change back
(Q). There is no shear. So the axes of the ellipse are the eigenvectors, and they are
perpendicular. In those axes, every value x⊤Sx of a unit vector is again a weighted average
of eigenvalues. Almost every result of this lesson follows from this one fact.
Interactive figure: loading…
Change a,b,c in S=(abbc). The violet ellipse is
the image of the unit circle. Its axes are always the eigenvectors q1 and
q2, at a right angle, with half-lengths ∣λ1∣ and ∣λ2∣. Drag
x: the two faint arrows build Sx from its pieces along q1 and q2. Compare with a
non-symmetric matrix in lesson 05: there the directions that only stretch need not be perpendicular.
Quick check
S=(2112) has eigenvalues 3 and 1. Which values can x⊤Sx take for unit vectors x?
Why.
For a unit x,x⊤Sx is a weighted average of 3 and 1 with weights (q1⋅x)2 and (q2⋅x)2 that sum to 1. Every weight between 0 and 1 is possible, so every value in [1,3] is reached. For example x=e1 gives S11=2, the average with weights 21,21. The values 1 and 3 are only the ends.
where Q is orthogonal (Q⊤Q=I; its columns qi are orthonormal eigenvectors) and
Λ=diag(λ1,…,λn) is real. Conversely,
(QΛQ⊤)⊤=QΛQ⊤. So over R: a matrix is orthogonally
diagonalizable (diagonalizable with an orthogonal Q) exactly when it is symmetric.
The proof has three steps: (1) the eigenvalues are real, (2) eigenvectors for different
eigenvalues are orthogonal, (3) there are always n orthonormal eigenvectors, even when an
eigenvalue repeats.
Step 1: the eigenvalues are real
First the 2×2 case. For S=(abbc) the characteristic
polynomial is p(λ)=λ2−(a+c)λ+(ac−b2). Its discriminant is
(a+c)2−4(ac−b2)=a2−2ac+c2+4b2=(a−c)2+4b2≥0.
A sum of squares is never negative, so both roots are real. The discriminant is 0 only when
a=c and b=0, that is, when S=aI. Compare with the rotation
(01−10) (not symmetric): its polynomial is λ2+1, with
discriminant −4 and complex roots ±i.
Now any size. A real matrix can have complex eigenvalues (a rotation does). So we cannot
assume at the start that λ is real. We allow a complex eigenpair and then show that
λ is real. Write xˉ for the complex conjugate.
Let Sx=λx with x∈Cn,x=0.
Multiply on the left by xˉ⊤:xˉ⊤Sx=λxˉ⊤x.
xˉ⊤x=∑i∣xi∣2 is real and positive.
xˉ⊤Sx is real. Its conjugate is x⊤Sxˉ(S is real). This is a
1×1 matrix, so it equals its transpose xˉ⊤S⊤x=xˉ⊤Sx (here S⊤=S is used).
So λ=xˉ⊤Sx/xˉ⊤x is a real number divided by a positive number: real.
Then S−λI is a real singular matrix, so it has a real nonzero null vector: a real eigenvector.
Step 2: eigenvectors of different eigenvalues are orthogonal
Let Sx=λx and Sy=μy with λ=μ. Compute y⊤Sx in two ways:
λy⊤x=y⊤(Sx)=(S⊤y)⊤x=(Sy)⊤x=μy⊤x.
So (λ−μ)y⊤x=0, and as λ=μ,y⊤x=0.
Step 3: there are always enough eigenvectors
Step 2 does not cover repeated eigenvalues. In lesson 05, (0010) has
the eigenvalue 0 twice but only one eigenvector direction. A symmetric matrix never has this
problem. The key fact is:
Key fact. If Sq1=λ1q1, then S maps the subspace q1⊥ (all vectors
perpendicular to q1) into itself. Such a subspace is called invariant.
Why. Let x⊥q1. Then q1⊤(Sx)=(Sq1)⊤x=λ1q1⊤x=0. So Sx⊥q1
too. The first equality uses S⊤=S.
Interactive figure: loading…
Move the slider and watch the violet arrow.S is a symmetric 3×3 matrix and
q1 is its top eigenvector. The aqua patch is the plane
q1⊥. As x walks around the unit circle of this plane, Sx never leaves
the plane: the image of the circle is an ellipse inside the plane. Switch to not symmetric: q1 is
still an eigenvector of M, but Mx now leaves the plane (the dashed magenta
segment is its height q1⋅Mx).
So, inside the plane q1⊥,S is again a symmetric map, now on a space with one dimension
less. Repeat the argument there. For n=3 the story is 3→2→1:
Find one real unit eigenvector q1 (step 1 says it exists).
The plane q1⊥ is mapped into itself. In an orthonormal basis u1,u2 of this plane,
S acts like the 2×2 symmetric matrix B=U⊤SU, with U=[u1u2].
B has a real unit eigenvector c (step 1 again, now for size 2). Then q2=Uc is an
eigenvector of S inside the plane.
The line in the plane perpendicular to q2 is mapped into itself. Any unit vector q3 on it is
the third eigenvector. Now q1,q2,q3 are orthonormal.
Example.S=210120005. Here Se3=5e3,
so q1=e3 and λ1=5. The plane q1⊥ is the xy-plane, with U=[e1e2] and
B=U⊤SU=(2112). Its eigenvectors are (1,1)/2 (eigenvalue 3)
and (1,−1)/2 (eigenvalue 1). So q2=(1,1,0)/2 and q3=(1,−1,0)/2, and
S=5q1q1⊤+3q2q2⊤+1q3q3⊤.
Step 3 for every size (induction)
Induction on n; for n=1 there is nothing to prove.
Take a real unit eigenvector q1,Sq1=λ1q1 (step 1). By the key fact, W=q1⊥
is invariant.
Let the columns of U∈Rn×(n−1) be an orthonormal basis of W. The columns of
SU lie in W, and UU⊤ is the orthogonal projector onto W, so SU=UU⊤SU=U(U⊤SU).
B=U⊤SU is symmetric of size n−1. By induction, B=PΛ′P⊤ with P orthogonal.
Then S(UP)=UBP=(UP)Λ′: the n−1 columns of UP are orthonormal eigenvectors in W((UP)⊤UP=P⊤P=I).
With q1 they form the orthogonal matrix Q=[q1,UP], and SQ=QΛ.■
So a symmetric matrix is never defective: for every eigenvalue, the geometric multiplicity
equals the algebraic multiplicity. Inside an eigenspace of dimension >1, any orthonormal basis
works, so Q is not unique.
The spectral decomposition: a sum of projectors
S=QΛQ⊤ can be read column by column (the outer-product view of lesson 01):
Sx=QΛQ⊤x=i∑λiqi(qi⊤x).
In words: project x onto each eigenvector, scale each piece by its eigenvalue, add up. Each
Pi=qiqi⊤ is the orthogonal projector onto the line of qi (lesson 03). The projectors
satisfy Pi2=Pi,PiPj=0 for i=j, and ∑iPi=I.
Check with numbers.S=(2112), with q1=(1,1)/2 for
λ1=3 and q2=(1,−1)/2 for λ2=1:
A real symmetric 2×2 matrix S has a repeated eigenvalue. What can you conclude?
Why.
The discriminant (a−c)2+4b2 is 0 only when a=c and b=0. So S=aI. A matrix like (1551) has equal diagonal entries but eigenvalues 6 and −4. A symmetric matrix is never defective, so the first option is impossible.
For symmetric S and x=0, the Rayleigh quotient is
R(x)=x⊤xx⊤Sx.
It depends only on the direction of x:R(cx)=R(x) for every c=0. If Sq=λq, then
R(q)=λ. From now on the eigenvalues are sorted: λ1≥λ2≥⋯≥λn.
Theorem (Rayleigh).λn≤R(x)≤λ1 for all x=0. The max λ1 is reached
exactly at the nonzero vectors of the λ1-eigenspace, and the min λn exactly at those
of the λn-eigenspace.
Proof.
Put y=Q⊤x (the coordinates of x in the eigenbasis). Then x⊤x=y⊤y and
x⊤Sx=y⊤Λy, so R(x)=∑iλiyi2/∑iyi2.
This is a weighted average of the λi, with weights wi=yi2/∥y∥2≥0 that sum to 1.
So λn≤R(x)≤λ1.
R(x)=λ1 exactly when all the weight sits on indices with λi=λ1, that is,
when x is in the λ1-eigenspace. The same holds for λn.■
When λmax is repeated, the maximizers of R are all nonzero vectors of the whole
λmax-eigenspace, not one eigenvector direction (the same holds for λmin).
Theorem (critical points). The gradient of R is
∇R(x)=x⊤x2(Sx−R(x)x).
So the critical points of R (the points with ∇R=0) are exactly the eigenvectors. An
eigenvector q with λn<λ<λ1 is a saddle point: R goes up in one direction
and down in another.
Proof.
Quotient rule, with ∇(x⊤Sx)=2Sx and ∇(x⊤x)=2x:
∇R=(x⊤x)22Sx(x⊤x)−(x⊤Sx)2x=x⊤x2(Sx−R(x)x).
∇R(x)=0⟺Sx=R(x)x⟺x is an eigenvector (with eigenvalue R(x)).
Saddle. Let q,q1,qn be unit eigenvectors for λ,λ1,λn; they are orthogonal.
For t=0:R(q+tq1)=(λ+t2λ1)/(1+t2)>λ and
R(q+tqn)=(λ+t2λn)/(1+t2)<λ.■
Interactive figure: loading…
Drag x around the circle and watch the chart. For a unit x,R(x)=x⋅Sx is the part of
Sx along x (thick violet). The sideways part Sx−R(x)x (dashed magenta) is 21∇R:
it points to where R grows. It vanishes only at the eigenvectors, where the chart has its max
λ1 and its min λ2. The bar shows the weights (q1⋅x)2 and (q2⋅x)2 of the
weighted average. This is the "sideways part" of lesson 05, now with a meaning: a gradient.
More precisely, R(qkcost+qisint)=λk+(λi−λk)sin2t for orthonormal
eigenvectors qk,qi. So from qk,R goes up toward every eigenvector with a larger eigenvalue
and down toward every one with a smaller eigenvalue.
Quick check
S=diag(3,2,1). What kind of critical point of the Rayleigh quotient is x=e2?
Why.
e2 is an eigenvector, so ∇R(e2)=0. But R(e2cost+e1sint)=2+sin2t>2 and R(e2cost+e3sint)=2−sin2t<2. A zero gradient alone does not make a max or a min. This is why gradient methods for λmax do not get stuck at middle eigenvectors.
The eigenvalue error is quadratic. Let q be a unit eigenvector (Sq=λq) and d a unit
vector with d⊥q. Then
R(q+εd)−λ=1+ε2ε2(R(d)−λ),
because the cross term d⊤Sq=λd⊤q is 0. So an eigenvector error of size ε gives
an eigenvalue error of size ε2. This is why power iteration on a symmetric matrix gets the
eigenvalue at the rate ∣λ2/λ1∣2k: twice as many correct digits as the vector.
Restriction to a subspace. Let V have orthonormal columns that span a subspace U. For
x=Vc,R(x)=c⊤(V⊤SV)c/c⊤c. So the min and the max of R over U are the smallest
and the largest eigenvalues of the small symmetric matrix V⊤SV.
The generalized symmetric eigenproblem
In LDA, CCA and the vibration of structures, the problem is Sx=λBx with S symmetric
and B symmetric positive definite (lesson 07). The generalized Rayleigh quotientx⊤Sx/x⊤Bx plays the role of R.
Factor B=LL⊤ (Cholesky, lesson 07) and put y=L⊤x. Then Sx=λBx becomes
(L−1SL−⊤)y=λy, an ordinary symmetric eigenproblem.
So the eigenvalues are real, and the eigenvectors can be chosen B-orthonormal:
xi⊤Bxj=0 for i=j and xi⊤Bxi=1.
maxx=0x⊤Sx/x⊤Bx=λmax, the largest generalized eigenvalue.
Fisher's LDA maximizes w⊤SBw/w⊤SWw (between-class over within-class scatter): a
generalized Rayleigh quotient. In SciPy: scipy.linalg.eigh(S, B).
The Rayleigh theorem gives λ1 and λn. What about the eigenvalues in the middle?
First in words, for a 3×3 matrix. Take any plane U through 0. On this plane, R has a
smallest value: the weakest direction of U. Different planes have different weakest values.
Courant–Fischer says: λ2 is the best worst value of R over all planes,
λ2=planes Umaxx∈U,x=0minR(x).
Two facts give this.
The plane span(q1,q2) reaches λ2. On it, R is a weighted average of
λ1 and λ2, so R≥λ2, with equality at q2.
No plane does better. Let W=span(q2,q3). On W,R is a weighted average
of λ2 and λ3, so R≤λ2. Two planes through 0 in R3 always share at
least a line. Take x=0 on that line: minUR≤R(x)≤λ2.
Interactive figure: loading…
Turn and tilt the plane U. Here S=diag(3,2,1), so the eigenvectors are the
axes. The blue plane is W=span(q2,q3), where R≤2. However
you move the orange plane U, it shares a magenta line with
W, and the readout shows minUR≤R(x)≤λ2=2. Press best plane to reach
minUR=2. Switch to a line (dimU=1):1+2=3 is not more than 3, and the line usually
meets W only at 0.
Why two subspaces must meet. For subspaces U,W of Rn, the dimension formula
dim(U∩W)=dimU+dimW−dim(U+W) and dim(U+W)≤n give
dim(U∩W)≥dimU+dimW−n.
If dimU+dimW>n, they share a nonzero vector. For two planes in R3:2+2−3=1.
Theorem (Courant–Fischer). For symmetric S with λ1≥⋯≥λn and k=1,…,n:
λk=dimU=kmaxx∈U,x=0minR(x),
λk=dimU=n−k+1minx∈U,x=0maxR(x).
The max–min is reached at U=span(q1,…,qk), the min–max at
U=span(qk,…,qn). In words: every k-dimensional subspace has a weakest
direction, and λk is the best possible weakest value. For k=1 and k=n this is the
Rayleigh theorem.
Proof of the max–min form
(≥) Take U∗=span(q1,…,qk). For x∈U∗,R(x) is a weighted average
of λ1,…,λk, which are all ≥λk, and R(qk)=λk. So minU∗R=λk.
(≤) Let U be any k-dimensional subspace, and W=span(qk,…,qn), of
dimension n−k+1. Then dim(U∩W)≥k+(n−k+1)−n=1, so some x=0 lies
in both. As x∈W,R(x) is a weighted average of λk,…,λn, so
R(x)≤λk. Hence minUR≤R(x)≤λk for every U.
Steps 1 and 2 give equality. ■
The min–max form, and Cauchy interlacing
The min–max form follows from the max–min form applied to −S.
The eigenvalues of −S in decreasing order are −λn≥−λn−1≥⋯≥−λ1. So
the j-th largest eigenvalue of −S is −λn−j+1.
The Rayleigh quotient of −S is −R(x). The max–min form for −S with j=n−k+1 gives
−λk=maxdimU=n−k+1minx∈U(−R(x)).
min(−R)=−maxR and max(−f)=−minf, so
−λk=−mindimU=n−k+1maxx∈UR(x). Multiply by −1.■
A corollary: Cauchy interlacing. Let V∈Rn×m have orthonormal columns and
B=V⊤SV (for example, a principal m×m submatrix of S). Then
λk(S)≥λk(B)≥λk+n−m(S) for k=1,…,m. The first inequality follows from
the max–min form, because the subspaces {Vc} are only some of the k-dimensional subspaces;
the second from the min–max form in the same way.
Quick check
S=diag(5,3,1). You may choose any plane U through 0 in R3. What is the largest possible value of minx∈UR(x)?
Why.
By Courant–Fischer the best weakest value over planes is λ2=3, reached on span(e1,e2). No plane does better: every plane meets span(e2,e3) in a line, where R≤3. The last option is wrong: span(e1,e2) contains no vector with R<3.
Theorem (Weyl). Let A,E∈Rn×n be symmetric, with the eigenvalues of A,E and
A+E each sorted in decreasing order. For every k:
λk(A)+λn(E)≤λk(A+E)≤λk(A)+λ1(E),
and therefore
∣λk(A+E)−λk(A)∣≤∥E∥2.
Here ∥E∥2 is the spectral norm, the largest stretch maxx=0∥Ex∥/∥x∥. For symmetric E
it equals maxi∣λi(E)∣.
Proof.
For every x=0:RA+E(x)=RA(x)+RE(x), and λn(E)≤RE(x)≤λ1(E)
(Rayleigh theorem for E).
Fix a k-dimensional U and take the min over x∈U of each part:
minURA+λn(E)≤minURA+E≤minURA+λ1(E).
This holds for every U, so it also holds after the max over all k-dimensional U (if
f(U)≤g(U) for every U, then maxf≤maxg). Courant–Fischer turns the three
max–mins into λk(A)+λn(E),λk(A+E) and λk(A)+λ1(E).
−∥E∥2≤λn(E) and λ1(E)≤∥E∥2 give the bound with absolute values. ■
Four facts about the bound:
It is tight:E=εI moves every eigenvalue by exactly ε.
It needs symmetry:(0010)+(0ε00)
has eigenvalues ±ε (the characteristic polynomial is λ2−ε), but
∥E∥2=ε. For ε=10−6 the eigenvalues move by 10−3, a thousand times ∥E∥2.
It says nothing about eigenvectors. With a small eigengap they can turn far
(Davis–Kahan, lesson 17).
Singular values:∣σk(A+E)−σk(A)∣≤∥E∥2 holds for any matrices of the same
shape, even rectangular. Lesson 17 proves it from this theorem.
Interactive figure: loading…
Move ε and watch the paths stay in their cones.A is a fixed 4×4 symmetric
matrix with eigenvalues 3,2.2,1.8,0.4, and E is symmetric with ∥E∥2=1. Each coloured path is
λk(A+εE); each shaded cone is Weyl's interval λk(A)±ε. Press
E = I to touch the cone edges, and New random E to see a typical perturbation use less of its
budget. Then switch to not symmetric: the eigenvalues ±ε leave the cone at once.
Answers to section 1. (1) The eigenvalues are 3, with q1=(1,1)/2, and 1, with
q2=(1,−1)/2. The max of x⊤Sx over unit x is 3, at ±q1; the min is 1, at ±q2.
(2) Symmetric: no. Weyl allows a move of at most 0.01. Not symmetric: yes.
A=(0010) plus E=(00.0100) has
eigenvalues ±0.1.
S−3I=(−111−1) has null vector (1,1), so q1=(1,1)/2.S−I=(1111) has null vector (1,−1), so q2=(1,−1)/2.
q1⋅q2=(1−1)/2=0: orthogonal, as step 2 of the proof promised.
Projector sum: 3P1+1P2=S (computed in section 3).
(b) Rayleigh quotient. At x=(1,2):
Sx=(2+2,1+4)=(4,5), so x⊤Sx=1⋅4+2⋅5=14 and x⊤x=5. So R=14/5=2.8.
In eigen-coordinates, y=Q⊤x=((1+2)/2,(1−2)/2)=(3/2,−1/2).
The weights are y12/∥y∥2=4.5/5=0.9 and y22/∥y∥2=0.5/5=0.1.
R=0.9⋅3+0.1⋅1=2.8. It is close to 3 because x is close to q1. (In the
Rayleigh figure, x=(1,2)/5 is the direction θ≈63.4°.)
(c) Courant–Fischer in 3-D.D=diag(3,2,1),k=2.
On the plane span(e1,e3),R is an average of 3 and 1. Its min is 1, at e3.
On span(e1,e2),R is an average of 3 and 2. Its min is 2=λ2, at e2.
No plane does better: every plane meets span(e2,e3) in at least a line
(2+2>3), and there R≤2.
(d) Weyl, a tight case and a loose case, both with ∥E∥2=0.1:
E=(00.10.10)=0.1(q1q1⊤−q2q2⊤):S+E=(21.11.12) has eigenvalues 2±1.1, that is, 3.1 and 0.9.
Both moved by exactly 0.1, because E has the same eigenvectors as S.
E=diag(0.1,−0.1):S+E=(2.1111.9) has
eigenvalues 2±0.12+1=2±1.01, that is, 3.00499 and 0.99501. They moved by
only 0.005. To first order an eigenvalue moves by qk⊤Eqk, which is 0 here
(q1⊤Eq1=(0.1−0.1)/2=0). Weyl is a worst-case bound.
Quick check
S=(2112) and E is symmetric with ∥E∥2=0.01. Which number can be an eigenvalue of S+E?
Why.
By Weyl, λ1(S+E)∈[2.99,3.01] and λ2(S+E)∈[0.99,1.01]. Only 2.995 is inside one of these intervals. For a non-symmetric E of the same norm, there is no such guarantee.
NumPy checks the hand computations above. The notebook for this lesson has these cells and the exercises.
importnumpyasnpS=np.array([[2.,1.],[1.,2.]])lam,Q=np.linalg.eigh(S)# for symmetric matrices; eigenvalues in ASCENDING orderprint(lam)# [1. 3.]print(np.allclose(Q.T@Q,np.eye(2)),np.allclose(Q@np.diag(lam)@Q.T,S))# True True# the spectral decomposition as a sum of projectors: S = 3 P1 + 1 P2P1=np.outer([1,1],[1,1])/2;P2=np.outer([1,-1],[1,-1])/2print(np.allclose(3*P1+1*P2,S),np.allclose(P1+P2,np.eye(2)),np.allclose(P1@P2,0))# True True Truex=np.array([1.,2.])print(x@S@x,x@x)# 14.0 5.0, so R(x) = 2.8y=Q.T@x# coordinates in the eigenbasisw=y**2/(y@y)# weights, in the order of lam = [1, 3]print(np.round(w,12),round(lam@w,12))# [0.1 0.9] 2.8# Courant–Fischer in 3-D, for D = diag(3, 2, 1): R restricted to a plane is the# Rayleigh quotient of V^T D V. Here it is diagonal, so its smallest entry is min R.D=np.diag([3.,2.,1.])forcolsin([0,2],[0,1]):V=np.eye(3)[:,cols]# orthonormal basis of the planeprint(cols,np.diag(V.T@D@V))# [0, 2] [3. 1.] then [0, 1] [3. 2.]# Weyl: two perturbations with ||E||_2 = 0.1forEin(np.array([[0,.1],[.1,0]]),np.array([[.1,0],[0,-.1]])):print(round(np.linalg.norm(E,2),12),np.round(np.linalg.eigvalsh(S+E),5))# 0.1 [0.9 3.1] then 0.1 [0.99501 3.00499]# Without symmetry there is no such boundN=np.array([[0.,1.],[1e-4,0.]])# [[0,1],[0,0]] + E with ||E||_2 = 1e-4print(np.round(np.linalg.eigvals(N).real,6))# [ 0.01 -0.01]: moved 100 times ||E||_2
PCA. The first principal direction maximizes the variance u⊤Σu over unit u. This is
a Rayleigh quotient of the covariance Σ, so the answer is the top eigenvector. Weyl: for a
sample covariance Σ^=Σ+E, each estimated variance λk(Σ^) is within ∥E∥2 of
the true one. Principal directions with close eigenvalues can still mix (lesson 17).
Loss landscapes. The sharpness λmax(H) of a Hessian is a max Rayleigh quotient. At a
critical point of the loss, λmin(H)<0 means it is not a minimum (it is a saddle or a
maximum): along the eigenvector of λmin the curvature is negative, so the loss decreases.
Graphs. A graph Laplacian L has eigenvalues 0=μ1≤μ2≤… (sorted
ascending, by convention) with 1 in the null space. Then μ2=minRL(x) over
x⊥1, and the minimizer (the Fiedler vector) splits the graph: spectral clustering
and GNNs (lesson 19).
Classification. Fisher's linear discriminant analysis (LDA) maximizes a generalized Rayleigh
quotient w⊤SBw/w⊤SWw (see the folded block in section 3).
ML for science. Normal modes of a structure solve the generalized symmetric eigenproblem
Kx=ω2Mx(K,M symmetric, M positive definite). In quantum mechanics the
ground-state energy is minψRH(ψ) (the variational principle). Neural-network
wavefunctions such as FermiNet minimize this Rayleigh quotient (estimated by Monte Carlo
sampling), and every trial state gives an upper bound.
Numerics. A backward-stable symmetric eigensolver returns the exact eigenvalues of S+E
with ∥E∥2 about u∥S∥2(u≈1.1×10−16) times a modest factor. By Weyl, every
computed eigenvalue has an absolute error of that size: large eigenvalues are accurate, tiny ones
may have no correct digits.
Using the spectral theorem for a non-symmetric matrix.(1023)
has eigenvectors (1,0) and (1,1): not orthogonal.
Maximizing x⊤Ax for non-symmetric A with λmax(A). Only the symmetric part
counts: x⊤Ax=x⊤21(A+A⊤)x.
Thinking the maximizer of R is unique. It is the whole λ1-eigenspace.
Calling every critical point of R a max or a min. Middle eigenvectors are saddles.
Index conventions. Here λ1≥⋯≥λn, but np.linalg.eigh returns ascending
order. In Courant–Fischer the min–max is over dimension n−k+1, not n−k.
Weyl misuse. Comparing eigenvalues without sorting both spectra the same way; applying it to
non-symmetric matrices; concluding that eigenvectors are stable too.
np.linalg.eig on a symmetric matrix. It does not use the symmetry: it may return complex
dtype, and with a repeated eigenvalue the eigenvectors need not be orthogonal. Use eigh.
Is (1023) orthogonally diagonalizable?AnswerNo. QΛQ⊤ with real Λ is always symmetric, and this matrix is not. Its eigenvectors (1,0) and (1,1) have dot product 1.
S=diag(4,4,1). Which x maximize R(x)?AnswerAll nonzero x∈span(e1,e2), with R=4: the whole λmax-eigenspace.
S=diag(3,2,1). Starting at e2, in which directions does R go up and down?AnswerR(e2cost+e1sint)=2+sin2t goes up toward e1;R(e2cost+e3sint)=2−sin2t goes down toward e3. So e2 is a saddle point.
A is symmetric with eigenvalues 10,5,1, and E is symmetric with ∥E∥2=0.3. Where can λ2(A+E) be? Can it reach the ends?AnswerIn [4.7,5.3] by Weyl. Yes: E=±0.3I reaches each end.
Why is the Rayleigh-quotient eigenvalue estimate more accurate than the eigenvector it uses?Answer∇R=0 at eigenvectors, so the first-order error vanishes: R(q+εd)−λ=ε2(R(d)−λ)/(1+ε2) for unit d⊥q.
In the Courant–Fischer proof, why must a k-dimensional U meet span(qk,…,qn)?AnswerThe dimensions add up to k+(n−k+1)=n+1>n, so the intersection has dimension at least 1.
In the proof that q1⊥ is invariant, where is S⊤=S used? Give a matrix where q1 is an eigenvector but q1⊥ is not invariant.AnswerIn q1⊤(Sx)=(S⊤q1)⊤x=(Sq1)⊤x. Example: M=(1012) has Me1=e1, but e2⊥e1 goes to Me2=(1,2), which is not perpendicular to e1.
Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
State the spectral theorem for a real symmetric matrix S.
S=QΛQ⊤ with Q orthogonal (orthonormal eigenvectors as columns) and Λ real diagonal. Conversely, every such product is symmetric.
Why are the eigenvalues of a symmetric 2×2 matrix (abbc) real?
The discriminant of λ2−(a+c)λ+(ac−b2) is (a−c)2+4b2≥0.
Why are eigenvectors of a symmetric matrix for different eigenvalues orthogonal?
λy⊤x=y⊤Sx=(Sy)⊤x=μy⊤x, so (λ−μ)y⊤x=0 and y⊤x=0.
What is the key step that gives a symmetric matrix enough eigenvectors?
If Sq1=λ1q1, then S maps q1⊥ into itself: q1⊤Sx=(Sq1)⊤x=0 for x⊥q1. Repeat inside q1⊥.
Write (2112) as a sum of projectors.
3P1+1P2 with P1=21(1111) and P2=21(1−1−11).
What is the range of the Rayleigh quotient R(x)=x⊤Sx/x⊤x, and why?
[λmin,λmax]. In eigen-coordinates R is a weighted average of the eigenvalues with weights yi2/∥y∥2.
What are the critical points of the Rayleigh quotient?
Exactly the eigenvectors, since ∇R=x⊤x2(Sx−R(x)x). Middle eigenvectors are saddle points.
Courant–Fischer in words, for λ2 of a 3×3 symmetric matrix.
λ2 is the best worst value of R over all planes: maxplanes Uminx∈UR(x).
State Weyl's inequality.
For symmetric A and E with eigenvalues sorted the same way, ∣λk(A+E)−λk(A)∣≤∥E∥2 for every k.
Why does Weyl's inequality need symmetry? Give the example.
(0ε10) has eigenvalues ±ε, but the perturbation has norm ε; for ε=10−6 the move is 1000 times larger.
"Why are the eigenvalues of a covariance matrix real and its principal components
orthogonal?" — It is symmetric, so the spectral theorem applies.
"Maximize x⊤Sx subject to ∥x∥=1." — Lagrangian: 2Sx−2μx=0, so Sx=μx and the
value is μ; take λmax (symmetrize first if S is not symmetric).
"Your covariance estimate has error ∥E∥2=0.05. How far off can the top variance be? And
the top PC?" — At most 0.05 (Weyl); the PC depends on the eigengap (Davis–Kahan).
"How does deflation find the second eigenvector?" — S−λ1q1q1⊤=∑i≥2λiqiqi⊤.
Alex Levis, "Weyl's inequality"
(Harvard BST 235 note): Courant–Fischer and Weyl for singular values; the last section gives
both for symmetric matrices.