Day 21. Eigenvalues, Eigenvectors & Quadratic Forms
The directions a matrix only stretches, and what they reveal about variances, collinearity and stability.
- ●Compute eigenvalues and eigenvectors of 2×2 matrices and check trace and determinant identities.
- ●Use the spectral decomposition of a symmetric matrix and classify quadratic forms.
- ●Interpret the eigenvalues of a covariance matrix (principal components) and of X′X (condition number).
- ●Use eigenvalues to judge the stability of a linear dynamic system.
Theory
Definition
A non-zero vector is an eigenvector of a square matrix , with eigenvalue , if
maps onto its own line, stretching it by . Eigenvalues solve the characteristic equation . For 2×2 matrices,
Symmetric matrices: the spectral theorem
If (covariance matrices, ), then all eigenvalues are real, eigenvectors can be chosen orthonormal, and
Consequences: , (if all ), and .
Quadratic forms and definiteness
A quadratic form is . Writing in eigen-coordinates gives , so a symmetric is
| eigenvalues | for | |
|---|---|---|
| positive definite (PD) | all | always |
| positive semi-definite (PSD) | all | always |
| indefinite | mixed signs | both signs |
The Rayleigh quotient ranges between and .
Three uses in econometrics
- Principal components: the eigenvectors of a covariance matrix are the directions of greatest variance; eigenvalues are those variances.
- Collinearity: the condition number of (for standardised regressors) measures how close is to rank deficiency.
- Dynamics: converges to zero iff every .
Part 1 · Warm-up
Exercise 1 · A diagonal matrix
Find the eigenvalues and eigenvectors of .
Show solution
with and with : a diagonal matrix stretches along the axes.
Exercise 2 · A symmetric matrix
Find the eigenvalues and eigenvectors of .
Show solution
Step 1. Characteristic equation: , so .
Step 2. For : , e.g. .
Step 3. For : , e.g. .
Step 4. Check orthogonality: .
Answer: along and along .
Exercise 3 · Trace and determinant
Check the trace and determinant identities for Exercise 2.
Show solution
and . ✓
Exercise 4 · Evaluating a quadratic form
Compute for Exercise 2's with and with .
Show solution
Step 1. .
Step 2. At : .
Step 3. At : .
Step 4. Along eigenvectors, the form is .
Exercise 5 · Classifying a form
Write as and classify it.
Show solution
Step 1. (split the cross term evenly).
Step 2. , so the eigenvalues have opposite signs: indefinite (e.g. gives ).
Part 2 · Proofs
Exercise 6 · Orthogonal eigenvectors
Prove that eigenvectors of a symmetric matrix belonging to distinct eigenvalues are orthogonal.
Show solution
Step 1. Let , .
Step 2. Then , using .
Step 3. So , and forces .
Exercise 7 · Trace and determinant from the roots
For a 2×2 matrix, show and .
Show solution
Step 1. .
Step 2. A monic quadratic with roots equals .
Step 3. Match coefficients.
Exercise 8 · Powers and inverses
Show that if then , and, if is invertible, .
Show solution
, and by induction . Applying to gives ; invertibility forces , so .
Exercise 9 · Positive definite ⇔ positive eigenvalues
Using , prove that a symmetric matrix is PD iff all its eigenvalues are positive.
Show solution
Step 1. With (and since is invertible), .
Step 2. If every this is positive for .
Step 3. Conversely, taking gives , which must be positive.
Exercise 10 · The Rayleigh quotient
Prove that for symmetric .
Show solution
Step 1. (since preserves length).
Step 2. Then , with equality at .
Step 3. This is the first principal component: the unit direction of greatest variance.
Part 3 · Applied
Exercise 11 · Principal components
Two test scores have covariance matrix . Find the eigenvalues and the share of total variance captured by the first principal component.
Show solution
Step 1. and , so .
Step 2. .
Step 3. Total variance is the trace, 7, so the first component's share is .
Answer: one "ability" index (the first principal component) summarises about 80% of the variation in the two scores.
Exercise 12 · Stability of a dynamic system
Employment shares evolve as with (deviations from steady state). Do deviations die out?
Show solution
Step 1. and .
Step 2. .
Step 3. Both satisfy , so and .
Answer: yes; shocks die out, by 30% per period along the slower direction ().
Exercise 13 · Two almost identical wealth measures
A poverty study includes both an asset index and household income as regressors. After standardising, they have correlation 0.99, so . Find its eigenvalues and condition number, and say which combination of the two coefficients the data cannot pin down.
Show solution
Step 1. For the eigenvectors are and with eigenvalues and (as in Exercise 2).
Step 2. With : eigenvalues 1.99 and 0.01.
Step 3. Condition number .
Step 4. The tiny eigenvalue belongs to : the data contain almost no variation in "assets minus income".
Answer: condition number 199. The sum of the two coefficients is well estimated, their difference hardly at all (see the collinearity simulator).
Exercise 14 · Ridge repairs the spectrum
Add to the diagonal (ridge regression). What happens to the eigenvalues and condition number?
Show solution
Step 1. Adding keeps the eigenvectors and adds to each eigenvalue: .
Step 2. New eigenvalues: and .
Step 3. New condition number: .
Answer: ridge cuts the condition number from 199 to 19, trading a little bias for a large drop in variance (Day 8).
Exercise 15 · How different are two pupils?
A matching estimator compares a tutored pupil with an untutored one. Their two baseline test scores (maths, reading) differ by points, and the scores' covariance matrix is from Exercise 11. Compute the Mahalanobis distance and compare it with the Euclidean distance.
Show solution
Step 1. , so .
Step 2. Quadratic form: .
Step 3. Mahalanobis distance ; Euclidean distance .
Answer: 1 versus 2.24. The difference lies along the high-variance "general ability" direction, where such gaps are common, so the two pupils are a good match. Mahalanobis distance is scale-free and accounts for correlation.
Verify in Python
import numpy as np
A = np.array([[2, 1], [1, 2.]])
lam, Q = np.linalg.eigh(A)
print("eigenvalues:", lam, "\neigenvectors (columns):\n", Q.round(3))
print("Q diag(lam) Q' == A:", np.allclose(Q @ np.diag(lam) @ Q.T, A))
S = np.array([[4, 2], [2, 3.]])
ev = np.linalg.eigvalsh(S)[::-1]
print("PC variances:", ev.round(3), " first PC share:", round(ev[0] / ev.sum(), 3))
D = np.array([[0.5, 0.2], [0.1, 0.6]])
print("dynamic eigenvalues:", np.sort(np.linalg.eigvals(D)).round(3))
C = np.array([[1, 0.99], [0.99, 1]])
print("condition number:", round(np.linalg.cond(C)), " with ridge 0.1:", round(np.linalg.cond(C + 0.1 * np.eye(2))))
d = np.array([2, 1.])
print("Mahalanobis:", np.sqrt(d @ np.linalg.solve(S, d)), " Euclidean:", round(np.linalg.norm(d), 3))
Key takeaways
- Eigenvectors are the directions a matrix only stretches; eigenvalues are the stretch factors.
- Symmetric matrices diagonalise in an orthonormal basis, so definiteness is read off the eigenvalues.
- Eigenvalues tell you the main directions of variance, how collinear your regressors are, and whether a dynamic system is stable.
Simulation Lab: Eigenvectors & Quadratic Forms
Open full screen →A symmetric matrix turns the unit circle into an ellipse whose axes are its eigenvectors.
The grey circle is every unit vector; the coloured ellipse is where A sends them. The eigenvectors are the ellipse's axes, and the eigenvalues are its semi-axis lengths. Rotate the probe v: Av lines up with v only along an eigenvector.