Assignment 1 · Problem 1 · submitted 11 Sep 2023
Covariance & eigen playground
Before any principal component analysis, the assignment checked the basics: which matrices can be covariance matrices at all, and how a symmetric matrix factors into rotations and stretches. Drag the entries below and the spectral decomposition and its ellipse follow along.
Problem 1(a)
Which a and b make this a covariance matrix?
The question gave . A covariance matrix must be symmetric (because ) and positive semi-definite. Symmetry forces ; then the determinant gives . The valid set is a single ray, not a region.
| 1.0 | 1.0 |
| 3.0 | 4.0 |
- Symmetric: a = 3 (Cov(X₁,X₂) = Cov(X₂,X₁))
- Variances on the diagonal are non-negative (1 and b ≥ 0)
- Determinant 1·b − 3a = 1.00 ≥ 0
The (a, b) plane
- valid covariance matrices: a = 3, b ≥ 9
- accepted by the 2023 rule b ≥ 3a
Problems 1(b) and 1(d)
Eigen-decomposition you can drag
Every symmetric positive semi-definite matrix factors as : an orthogonal matrix of eigenvectors (a rotation) and a diagonal of eigenvalues (the variances along those directions). The density contours of a normal distribution with covariance are ellipses whose axes are exactly these eigenvectors.
| 4.00 | -1.73 |
| -1.73 | 2.00 |
= Γ Λ Γᵀ, with
| 0.866 | 0.500 |
| -0.500 | 0.866 |
| 5.000 | 0 |
| 0 | 1.000 |
| 0.866 | -0.500 |
| 0.500 | 0.866 |
check: ΓΛΓᵀ = [[4.000, -1.732], [-1.732, 2.000]]
Ellipse of constant density
The axes are the eigenvectors γ₁, γ₂; their half-lengths are 1 and 2 standard deviations √λ.
- 1σ and 2σ ellipses
- γ₁ (largest variance)
- γ₂
- 260 simulated draws
Problem 1(b), worked by hand
The 2 × 2 example without software
Find the eigenvalues and orthonormal eigenvectors of using only the characteristic polynomial, then write it as .
1 · eigenvalues
so and . Their sum is the trace (6) and their product the determinant (5), a quick check.
2 · eigenvectors
Both are normalised to length 1 and are orthogonal (), as they must be for a symmetric matrix with distinct eigenvalues. Signs are arbitrary.
3 · spectral decomposition
eigen(). The explicit and are written out here for completeness. Load the “Problem 1(b)” preset in the playground to see them numerically.Problem 1(d) does the same for the 7 × 7 sample covariance of the wheat measurements; it is shown with the PCA it feeds into.
S = ΓΛΓᵀ for the wheat data