Eigenvalues and Eigenvectors
Most vectors, hit by a matrix, come out both turned and stretched. A few special ones come out only stretched — same direction, different length. Those are the eigenvectors, and the stretch factors are the eigenvalues.
The word is German: eigen means “characteristic”, “self” or “own”. These are the matrix’s own directions, and finding them tells you what the matrix is actually doing, in a way that reading its entries never does.
What you’ll learn
Section titled “What you’ll learn”- Definition 4.6, the eigenvalue equation, and the four equivalent conditions for to be an eigenvalue.
- The characteristic polynomial as the route to the eigenvalues (Theorem 4.8), and why it is not how anyone computes them.
- Algebraic against geometric multiplicity (Definitions 4.9 and 4.11), and what defective means (Definition 4.13).
- The spectral theorem (Theorem 4.15): symmetric matrices always have an orthonormal eigenbasis and real eigenvalues.
- Theorems 4.16 and 4.17: and .
- Why a rotation has no real eigenvectors, and why that is the right answer rather than a failure.
- PageRank as the dominant eigenvector of a transition matrix, with the measured convergence rate.
Intuition: the directions a map does not turn
Section titled “Intuition: the directions a map does not turn”Take a matrix and feed it every direction on the unit circle. Watch the angle between and as you sweep round.
For most directions that angle is nonzero: the matrix turned the vector. At a few special angles it drops to zero (or to , which is the same line pointing the other way). Those are the eigenvector directions, and the ratio of lengths there is the eigenvalue.
Three things follow immediately, and each is a theorem later:
- There are at most of these directions, because you cannot have more than independent directions in .
- There can be fewer. A shear turns every direction except one. A rotation turns every direction, so it has none at all — over the reals.
- A negative eigenvalue is still an eigenvector: the line is preserved, the arrow flips along it.
flowchart TD EQ["Ax = λx, x ≠ 0
Def 4.6"] EQ --> HOM["(A − λI)x = 0 has a nonzero solution"] HOM --> SING["so A − λI is singular"] SING --> DET["so det(A − λI) = 0"] DET --> CP["λ is a root of the
characteristic polynomial
Thm 4.8"] CP --> ALG["algebraic multiplicity:
how many times the root repeats
Def 4.9"] HOM --> ES["eigenspace E_λ = ker(A − λI)
Def 4.10"] ES --> GEO["geometric multiplicity:
dim E_λ
Def 4.11"] ALG --> CMP["geom ≤ alg, always"] GEO --> CMP CMP --> DEF["geom sum < n ⟹ DEFECTIVE
Def 4.13, no eigenbasis"] CP --> THM["det A = ∏λᵢ (Thm 4.16)
tr A = Σλᵢ (Thm 4.17)"] EQ --> SPEC["A symmetric ⟹ real λ and an
ORTHONORMAL eigenbasis
Thm 4.15, the spectral theorem"]
The math
Section titled “The math”The exclusion is not pedantry. holds for every , so without it every number would be an eigenvalue of every matrix.
Four equivalent statements
Section titled “Four equivalent statements”Read that chain forwards and it is the derivation of the whole method. An eigenvector is a nonzero solution of a homogeneous system, a homogeneous system has a nonzero solution exactly when its matrix is rank-deficient, and a square matrix is rank-deficient exactly when its determinant vanishes (§4.1, Theorem 4.3). So the eigenvalues are the roots of , which §4.1 named the characteristic polynomial.
Eigenvectors are not unique
Section titled “Eigenvectors are not unique”An eigenvector is really a direction, or more precisely a line through the origin. Definition 4.7 distinguishes codirected (same direction) from collinear (same or opposite direction), and eigenvectors come in collinear families. This is why libraries return unit vectors, and why their signs are arbitrary — a fact that costs people reproducibility bugs in PCA plots.
Eigenspaces and multiplicity
Section titled “Eigenspaces and multiplicity”That inequality is the entire subtlety of this section, and §4.4 depends on it.
Defective matrices
Section titled “Defective matrices”Distinct eigenvalues are sufficient for an eigenbasis, not necessary. What is required is that the eigenspace dimensions add to ; a defective matrix has some with algebraic multiplicity and geometric multiplicity below . And the book’s remark closes the loop: a defective matrix cannot have distinct eigenvalues, since Theorem 4.12 would then give it a basis.
Useful properties
Section titled “Useful properties”- and have the same eigenvalues, though generally different eigenvectors.
- .
- Similar matrices have the same eigenvalues, so the eigenvalues — like the determinant and the trace — characterise the mapping, not the representation.
- Symmetric positive definite matrices always have positive, real eigenvalues.
Symmetrising, and the spectral theorem
Section titled “Symmetrising, and the spectral theorem”Both halves are one line. Symmetry: . Semidefiniteness: — a sum of squares.
This theorem is the hinge of §4.5. It says any matrix, of any shape, can be turned into a symmetric one — and symmetric matrices have the best behaviour available:
Consequences, in order of usefulness: a symmetric matrix always diagonalises; the diagonalising matrix can be taken orthogonal, so with no inverse to compute; and no complex arithmetic ever appears. Every result in Chapters 10 and 12 that assumes a covariance or kernel matrix behaves nicely is cashing this theorem.
Back to the determinant and the trace
Section titled “Back to the determinant and the trace”The geometry is in the book’s Figure 4.6. Take an orthonormal eigenbasis of ; the unit square they span has area and circumference . Applying sends them to and , still orthogonal, so the image is a rectangle of area and circumference . The determinant is the area change; the sum of the absolute eigenvalues is the circumference change.
Worked example by hand
Section titled “Worked example by hand”Example 4.5 — the full procedure
Section titled “Example 4.5 — the full procedure”Step 1 — the characteristic polynomial.
Step 2 — the eigenvalues. Expand and factor:
giving and .
Two free checks against §4.1: the constant term should be ✓, and the coefficient should be ✓. And Theorems 4.16 and 4.17: , ✓.
Step 3 — the eigenspaces. Solve for each.
For :
Both rows say the same thing, , so
For :
Both rows say , so
Both eigenspaces are one-dimensional. Their dimensions add to , so the eigenvectors form a basis of and is not defective.
A sanity check that catches sign errors. ✓.
Example 4.6 — a defective matrix
Section titled “Example 4.6 — a defective matrix”Triangular, so the determinant of is the product of its diagonal: . One eigenvalue , algebraic multiplicity 2.
which has rank , so its null space is one-dimensional: , and
Geometric multiplicity 1. One independent eigenvector where two are needed — the matrix is defective, and §4.4’s Theorem 4.20 will refuse to diagonalise it.
Example 4.8 — the spectral theorem in action
Section titled “Example 4.8 — the spectral theorem in action”The characteristic polynomial is , so (repeated) and . The eigenspaces come out as
Here has algebraic multiplicity and geometric multiplicity , so the matrix is not defective. But look at the given basis of : , so and are not orthogonal, even though is orthogonal to both.
The spectral theorem says an orthogonal basis exists, not that the one you happened to compute is it. And the fix is available: by Equation 4.40, any linear combination of eigenvectors sharing an eigenvalue is again an eigenvector for that eigenvalue,
so Gram-Schmidt applied within the eigenspace produces an orthogonal pair. The book’s result is
Check: ✓, and ✓.
import numpy as np
def report(A, name):
A = np.asarray(A, dtype=float)
n = A.shape[0]
vals = np.linalg.eigvals(A)
print(f"{name}: eigenvalues {np.round(vals, 6)}")
print(f" det {float(np.linalg.det(A)):+.6f} = prod {float(np.prod(vals).real):+.6f} "
f"trace {float(np.trace(A)):+.6f} = sum {float(np.sum(vals).real):+.6f}")
total = 0
for lam in np.unique(np.round(np.real(vals), 6)):
alg = int(np.sum(np.abs(np.real(vals) - lam) < 1e-6))
geo = n - np.linalg.matrix_rank(A - lam * np.eye(n), tol=1e-8)
total += geo
print(f" lambda {lam:+.4f}: algebraic {alg}, geometric {geo}")
print(f" eigenspace dimensions sum to {total} of {n} -> "
f"{'defective' if total < n else 'has an eigenbasis'}")
report([[4, 2], [1, 3]], "Example 4.5")
report([[2, 1], [0, 2]], "Example 4.6")
report([[3, 2, 2], [2, 3, 2], [2, 2, 3]], "Example 4.8")
# Example 4.8's non-orthogonal eigenbasis, and the orthogonal one.
x1, x2, x3 = np.array([-1.0, 1, 0]), np.array([-1.0, 0, 1]), np.array([1.0, 1, 1])
print()
print("given basis of E_1: x1.x2 =", float(x1 @ x2), " (not orthogonal)")
x2p = 0.5 * np.array([-1.0, -1.0, 2.0])
print("after Gram-Schmidt: x1.x2' =", float(x1 @ x2p), " x3.x2' =", float(x3 @ x2p))
A8 = np.array([[3.0, 2, 2], [2, 3, 2], [2, 2, 3]])
for v, nm in ((x1, "x1"), (x2p, "x2'"), (x3, "x3")):
lam = float((A8 @ v) @ v) / float(v @ v)
print(f" A {nm} = {lam:.6f} * {nm}, residual "
f"{float(np.linalg.norm(A8 @ v - lam * v)):.2e}")Example 4.5: eigenvalues [5. 2.]
det +10.000000 = prod +10.000000 trace +7.000000 = sum +7.000000
lambda +2.0000: algebraic 1, geometric 1
lambda +5.0000: algebraic 1, geometric 1
eigenspace dimensions sum to 2 of 2 -> has an eigenbasis
Example 4.6: eigenvalues [2. 2.]
det +4.000000 = prod +4.000000 trace +4.000000 = sum +4.000000
lambda +2.0000: algebraic 2, geometric 1
eigenspace dimensions sum to 1 of 2 -> defective
Example 4.8: eigenvalues [1. 7. 1.]
det +7.000000 = prod +7.000000 trace +9.000000 = sum +9.000000
lambda +1.0000: algebraic 2, geometric 2
lambda +7.0000: algebraic 1, geometric 1
eigenspace dimensions sum to 3 of 3 -> has an eigenbasis
given basis of E_1: x1.x2 = 1.0 (not orthogonal)
after Gram-Schmidt: x1.x2' = 0.0 x3.x2' = 0.0
A x1 = 1.000000 * x1, residual 0.00e+00
A x2' = 1.000000 * x2', residual 0.00e+00
A x3 = 7.000000 * x3, residual 0.00e+00Every book number reproduced, and note the residuals: exactly zero, not , because these are integer matrices acting on integer and half-integer vectors.
See it move
Section titled “See it move”The first sketch is the definition, swept. Drag round the circle and watch the angle between and collapse at the eigendirections.
The second sketch plots the characteristic polynomial itself, so the roots are visible and the complex case is visibly a curve that misses the axis.
And the stepped version on the book’s own Example 4.5, which runs the full three-step procedure and checks both theorems:
The dashed white arrow is a direction that is NOT an eigenvector, drawn beside its image so the turning is visible. The amber and blue lines are the two eigenspaces.
Then the defective case, where the procedure runs to completion and the verdict changes:
Algebraic multiplicity 2 and geometric multiplicity 1. The last frame is the verdict: the eigenspaces do not add up to the dimension, so no eigenbasis exists.
And the spectral theorem’s case, with a repeated eigenvalue whose eigenspace is genuinely two-dimensional:
Lambda = 1 has algebraic multiplicity 2 and geometric multiplicity 2, so the dimensions add to 3. Above two dimensions the stage shows the numbers rather than a misleading picture.
From scratch
Section titled “From scratch”import numpy as np
def eigen_report(A, tol=1e-8):
"""Everything section 4.2 defines, computed and checked."""
A = np.asarray(A, dtype=float)
n = A.shape[0]
vals = np.linalg.eigvals(A)
out = {
"spectrum": np.sort_complex(vals),
"all_real": bool(np.all(np.abs(vals.imag) < 1e-12)),
"det_matches_product": abs(float(np.linalg.det(A)) - float(np.real(np.prod(vals)))) < 1e-8,
"trace_matches_sum": abs(float(np.trace(A)) - float(np.real(np.sum(vals)))) < 1e-8,
"multiplicities": [],
}
total = 0
for lam in np.unique(np.round(np.real(vals[np.abs(vals.imag) < 1e-12]), 8)):
alg = int(np.sum(np.abs(np.real(vals) - lam) < 1e-6))
geo = n - np.linalg.matrix_rank(A - lam * np.eye(n), tol=tol)
total += geo
out["multiplicities"].append((float(lam), alg, int(geo)))
out["independent_eigenvectors"] = total
out["defective"] = total < n
return out
cases = {
"Ex 4.5 [[4,2],[1,3]]": [[4, 2], [1, 3]],
"Ex 4.6 [[2,1],[0,2]]": [[2, 1], [0, 2]],
"Ex 4.8 3x3 symmetric": [[3, 2, 2], [2, 3, 2], [2, 2, 3]],
"identity (Ex 4.4)": np.eye(3),
"rotation by 30 deg": [[np.cos(np.pi / 6), -np.sin(np.pi / 6)],
[np.sin(np.pi / 6), np.cos(np.pi / 6)]],
"A^T A for a 2x3 A": np.array([[1.0, 0, 1], [-2, 1, 0]]).T @ np.array([[1.0, 0, 1], [-2, 1, 0]]),
}
for name, A in cases.items():
r = eigen_report(A)
mult = ", ".join(f"{l:+.2f}(a{a},g{g})" for l, a, g in r["multiplicities"])
print(f"{name:24} real {str(r['all_real']):5} "
f"det=prod {str(r['det_matches_product']):5} tr=sum {str(r['trace_matches_sum']):5} "
f"defective {str(r['defective']):5} {mult}")Ex 4.5 [[4,2],[1,3]] real True det=prod True tr=sum True defective False +2.00(a1,g1), +5.00(a1,g1)
Ex 4.6 [[2,1],[0,2]] real True det=prod True tr=sum True defective True +2.00(a2,g1)
Ex 4.8 3x3 symmetric real True det=prod True tr=sum True defective False +1.00(a2,g2), +7.00(a1,g1)
identity (Ex 4.4) real True det=prod True tr=sum True defective False +1.00(a3,g3)
rotation by 30 deg real False det=prod True tr=sum True defective True
A^T A for a 2x3 A real True det=prod True tr=sum True defective False -0.00(a1,g1), +1.00(a1,g1), +6.00(a1,g1)Four things to read off that table.
Example 4.4, the identity. , so with algebraic multiplicity — and geometric multiplicity too, because for every vector. The sole eigenspace spans all of and every standard basis vector is an eigenvector.
The rotation. all_real is False, the multiplicity list is empty, and it is reported defective —
correctly, because over the reals it has no eigenvectors at all. Note that det=prod and tr=sum still
hold: the complex eigenvalues multiply to and add to , both real, because
conjugate pairs cancel their imaginary parts.
. Eigenvalues , , — all real and all non-negative, which is Theorem 4.14. It is positive semidefinite rather than definite here because the matrix has rank , so one eigenvalue is exactly zero. Those numbers reappear in §4.5: the singular values are and .
Example 4.6. Algebraic , geometric , defective — and det=prod still holds with the repeated
eigenvalue counted twice, .
On real data
Section titled “On real data”Reading the plot
Section titled “Reading the plot”From the five mappings. Every case in the table below is a real possibility you will meet, and the figure has one of each:
| matrix | eigenvalues | determinant | what it does |
|---|---|---|---|
| , | stretches one axis, compresses the other; area preserved | ||
| , | a shear; one eigendirection, drawn twice in opposite directions | ||
| a rotation; no real eigenvectors, so none are drawn | |||
| , | collapses the plane onto a line; area zero | ||
| , | shear and stretch; symmetric, so the eigenvectors are orthogonal |
The two to dwell on are the third and fourth. The rotation has determinant — it preserves area perfectly — and yet has no eigenvectors, which shows that “well behaved” and “has eigenvectors” are unrelated. The collapsing map has a zero eigenvalue, and a zero eigenvalue is exactly a nonzero vector in the kernel: . So appearing in a spectrum is the eigenvalue statement of singularity.
From the eigenspectrum. Both matrices are symmetrised as , exactly as the book does for the C. elegans connectivity matrix, and for exactly the reason the book gives: the raw connectivity matrix is not symmetric, so its eigenvalues need not be real. After symmetrising, Theorem 4.15 guarantees they are.
The shape measurement is the interesting part. Rescale each sorted spectrum to and read its height at fixed index fractions: the clustered network gives and the random one . The random spectrum is close to a straight line; the clustered one falls off a cliff and then flattens. That knee is the book’s S-shape, and it comes from local clustering rather than from anything biological.
From PageRank. The bar chart is the fixed point of : page 3 gets the most weight at because everything links to it, and page 6 the least at . The book’s description is exact — the sequence converges to an with , i.e. an eigenvector with eigenvalue .
The right panel measures the rate. exactly (the matrix is column-stochastic, so it must be), , and the fitted decay rate over iterations to is . The error falls from at one iteration to at sixty.
That ratio is the whole story of why PageRank was practical: the number of iterations you need depends on the spectral gap, not on the size of the web. A gap of buys about one decimal digit every four iterations regardless of how many pages there are.
Pitfalls
Section titled “Pitfalls”Compare
Section titled “Compare”| quantity | what it is | basis independent? | how many |
|---|---|---|---|
| eigenvalue | a scale factor with | yes | at most distinct |
| eigenvector | a direction the matrix only scales | no (it moves with the basis) | a whole line per eigenvalue, at least |
| eigenspace | as a subspace, yes | one per eigenvalue | |
| algebraic multiplicity | root multiplicity in | yes | sums to exactly over |
| geometric multiplicity | yes | between and the algebraic multiplicity | |
| eigenspectrum | the set of all eigenvalues | yes | — |
-
Why does Definition 4.6 insist the eigenvector be nonzero?
The same reason forces the eigenspace to be defined as the eigenvectors TOGETHER WITH zero: the eigenvectors alone are not a subspace, since they exclude the origin.
pch.quizShowAnswer
B — Because A times the zero vector equals lambda times the zero vector for every lambda — without the exclusion, every number would be an eigenvalue of every matrix — The same reason forces the eigenspace to be defined as the eigenvectors TOGETHER WITH zero: the eigenvectors alone are not a subspace, since they exclude the origin.
-
A 3x3 matrix has one eigenvalue with algebraic multiplicity 2 and geometric multiplicity 1, plus one simple eigenvalue. What follows?
That is the book's Exercise 4.6(a) exactly: eigenvalues 1 (twice, one eigenvector) and 5. The geometric multiplicity can never exceed the algebraic one and here it is strictly less.
pch.quizShowAnswer
B — The eigenspace dimensions add to 2 out of 3, so there is no eigenbasis, the matrix is defective, and Theorem 4.20 will refuse to diagonalise it — That is the book's Exercise 4.6(a) exactly: eigenvalues 1 (twice, one eigenvector) and 5. The geometric multiplicity can never exceed the algebraic one and here it is strictly less.
-
A rotation by 30 degrees has determinant 1 and no real eigenvectors. What does that combination show?
The determinant and trace theorems still hold: the conjugate pair multiplies to 1 and adds to 1.732, both real, because the imaginary parts cancel.
pch.quizShowAnswer
B — That being well behaved and having eigenvectors are unrelated — the map is invertible, area-preserving and perfectly conditioned, and still fixes no direction, because its eigenvalues are the complex pair 0.866 plus or minus 0.5i — The determinant and trace theorems still hold: the conjugate pair multiplies to 1 and adds to 1.732, both real, because the imaginary parts cancel.
-
In the PageRank measurement, the error decays at 0.5719 per iteration against an eigenvalue ratio of 0.5755. What does that rate depend on?
That independence from size is why the method scaled. A gap of 0.575 buys roughly one decimal digit every four iterations whether the graph has six nodes or six billion.
pch.quizShowAnswer
B — The spectral gap — the ratio of the second-largest to the largest eigenvalue modulus — and not on the size of the graph at all — That independence from size is why the method scaled. A gap of 0.575 buys roughly one decimal digit every four iterations whether the graph has six nodes or six billion.
-
Theorem 4.14 says A-transpose A is symmetric and positive semidefinite for any A. Why does the chapter need that?
Both halves are one line: symmetry from transposing the product, and semidefiniteness because x-transpose A-transpose A x is the squared length of Ax. Measured on a 2x3 matrix, the eigenvalues of A-transpose A come out 0, 1 and 6 — non-negative, with a zero because the rank is only 2.
pch.quizShowAnswer
B — Because it turns any matrix, of any shape, into a symmetric one — and the spectral theorem then gives that symmetric matrix a real orthonormal eigenbasis, which is exactly how section 4.5 constructs the SVD — Both halves are one line: symmetry from transposing the product, and semidefiniteness because x-transpose A-transpose A x is the squared length of Ax. Measured on a 2x3 matrix, the eigenvalues of A-transpose A come out 0, 1 and 6 — non-negative, with a zero because the rank is only 2.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Example 4.5 by hand
Section titled “Exercise 1 – Example 4.5 by hand”Exercise 2 – Algebraic against geometric multiplicity
Section titled “Exercise 2 – Algebraic against geometric multiplicity”Exercise 3 – The rotation has no real eigenvectors
Section titled “Exercise 3 – The rotation has no real eigenvectors”Exercise 4 – Fix Example 4.8’s non-orthogonal eigenbasis
Section titled “Exercise 4 – Fix Example 4.8’s non-orthogonal eigenbasis”Exercise 5 – Power iteration and the spectral gap
Section titled “Exercise 5 – Power iteration and the spectral gap”Recall card
Section titled “Recall card”- An eigenvector is a nonzero direction the matrix only scales, and the eigenvalue is the scale factor. Every collinear vector is also an eigenvector, so an eigenvector is really a line.
- Four equivalent conditions: a nonzero solution of Ax = lambda x, a nontrivial null space for A minus lambda I, rank below n, determinant zero — which is why the eigenvalues are the roots of the characteristic polynomial.
- Algebraic multiplicity counts polynomial roots; geometric multiplicity is the eigenspace dimension. Geometric is at least one and never exceeds algebraic.
- A matrix is defective when the eigenspace dimensions add to less than n, and then no eigenbasis exists. Distinct eigenvalues are sufficient for a basis but not necessary.
- The spectral theorem is the result to remember: a symmetric matrix has real eigenvalues and an orthonormal eigenbasis — but not necessarily the basis you computed, so Gram-Schmidt within a repeated eigenspace may be needed.
- A-transpose A is symmetric and positive semidefinite for any A, which is how section 4.5 turns an arbitrary matrix into one the spectral theorem applies to.
- The determinant is the product of the eigenvalues and the trace is their sum, repeats included, and both hold for complex eigenvalues because conjugate pairs cancel.
- A rotation has no real eigenvectors despite being invertible and area-preserving, so being well behaved and having eigenvectors are unrelated.
- Never compute eigenvalues from the characteristic polynomial. Root-finding is badly conditioned, a double root lands about 1e-8 off, and an eigenvalue that far off destroys the eigenspace computation entirely.
- PageRank is the dominant eigenvector of a column-stochastic matrix, and power iteration converges at the spectral gap — measured 0.5719 against a predicted 0.5755, independent of graph size.
Next: Cholesky Decomposition — the first factorisation, and the one with the strictest hypothesis.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading