Symmetric matrices are the most well-behaved matrices in linear algebra. The Spectral Theorem guarantees that every real symmetric matrix is orthogonally diagonalisable — its eigenvectors always form an orthonormal basis, and all its eigenvalues are real.
Quadratic forms — expressions like — arise in optimisation, statistics (covariance), and physics (kinetic energy). Classifying them as positive definite, indefinite, etc. determines the shape of level sets and the nature of critical points.
The Singular Value Decomposition (SVD) extends diagonalisation to any matrix, not just square or symmetric ones. It underlies the most important algorithms in modern data science, including PCA, compressed sensing, and recommender systems.
The Spectral Theorem
Spectral Theorem: every real symmetric matrix () is orthogonally diagonalisable. That is, where is orthogonal () and . The columns of are orthonormal eigenvectors of .
Three crucial consequences: (1) all eigenvalues of a real symmetric matrix are real; (2) eigenvectors corresponding to distinct eigenvalues are automatically orthogonal; (3) even with repeated eigenvalues, a full orthonormal eigenvector basis always exists.
These facts hold for every real symmetric matrix without exception — they do not hold for general matrices, which may have complex eigenvalues, non-orthogonal eigenvectors, or insufficient independent eigenvectors.
Note that means for each column of . The decomposition is also written as — a sum of rank-one symmetric matrices scaled by eigenvalues.
💡Explain it simply
For symmetric matrices, everything aligns perfectly. The natural directions (eigenvectors) of the transformation are guaranteed to be perpendicular to each other. It's like a perfect axis-aligned stretch — no rotation, no shear, just scaling along clean orthogonal axes.
Orthogonal diagonalisation
- Find and for .
- Characteristic equation: .
- For : . Eigenvector: , normalised: .
- For : eigenvector , normalised: .
- ,. Verify: ✓.
Quadratic forms
A quadratic form is where is symmetric. In two variables: corresponding to .
Classification by eigenvalues: (1) positive definite: all , so for all ; (2) positive semidefinite: all ; (3) negative definite: all ; (4) negative semidefinite: all ; (5) indefinite: mixed signs.
The principal axes theorem: by changing to eigenvector coordinates (), the quadratic form simplifies to — a pure sum of squares with no cross terms. The eigenvalues determine the shape; the eigenvectors give the principal axes.
In optimisation: at a critical point of a smooth function , the Hessian (which is symmetric) determines the nature of the critical point. Positive definite means local minimum; negative definite means local maximum; indefinite means saddle point.
Positive definite test without computing eigenvalues: use Sylvester's criterion — is positive definite iff all leading principal minors (determinants of upper-left submatrices) are positive.
💡Explain it simply
A quadratic form is a bowl-shaped (or saddle-shaped) surface over the -plane. Positive definite means it's a bowl opening upward — every direction goes up from the bottom. Indefinite means it's a saddle — some directions go up, others go down. The eigenvalues tell you the curvature in each principal direction.
Singular Value Decomposition
Every matrix (any shape, any rank) has an SVD: , where is orthogonal, is orthogonal, and is with nonneg diagonal entries (the singular values), where .
Computing the SVD: the singular values are ; the columns of are orthonormal eigenvectors of ; the columns of are orthonormal eigenvectors of .
The four fundamental subspaces from the SVD: , , etc.
Best rank- approximation: truncate to . By the Eckart-Young theorem, this is the closest rank- matrix to in any unitarily invariant norm. Used for image compression, latent semantic analysis, and noise reduction.
The condition number measures numerical stability. A large condition number means small perturbations in can cause large changes in the solution .
💡Explain it simply
Every matrix transformation can be broken into three steps: first rotate (by ), then stretch each axis differently (by ), then rotate again (by ). The singular values are the stretch factors — the 'size' of the transformation in each independent direction. The first singular value is the biggest stretch; if it's much bigger than the last, the matrix is hard to 'invert' numerically.
Principal Component Analysis
PCA finds the directions of maximum variance in a dataset. Given a centered data matrix ( observations, features, mean subtracted), the sample covariance matrix is , which is symmetric and positive semidefinite.
The eigenvectors of (the principal components) are the directions of maximum variance. Eigenvalue equals the variance explained by the -th component. Projecting the data onto the top eigenvectors gives the best -dimensional linear approximation.
Connection to SVD: if , the principal components are the columns of , and the explained variances are . The SVD gives a numerically stable way to perform PCA.
Dimensionality reduction: retain only the top principal components (those with the largest eigenvalues). Choose to capture a target percentage (e.g., ) of total variance: .
💡Explain it simply
PCA rotates your coordinate system to align with the directions the data actually varies. The first principal component is the direction the data is most spread out. The second is the next most spread-out direction perpendicular to the first. By keeping only the top few directions, you can summarise a high-dimensional dataset in 2D or 3D without losing much information.
Common Mistakes to Avoid
- Assuming every matrix is orthogonally diagonalisable. Only symmetric matrices are guaranteed this by the Spectral Theorem. A non-symmetric matrix may fail to diagonalise at all.
- Confusing SVD with eigendecomposition. The SVD always exists for any matrix; eigendecomposition requires linearly independent eigenvectors. For non-symmetric matrices, in general.
- Forgetting to centre data before PCA. Without subtracting the mean, the first principal component often just aligns with the mean vector rather than the direction of maximum variance.
- Misidentifying positive definiteness. Checking that diagonal entries are positive is not enough. Use Sylvester's criterion (leading principal minors) or verify all eigenvalues are positive.
- Confusing the condition number with the determinant. A nearly singular matrix () has a large condition number, but a matrix with small determinant is not necessarily ill-conditioned if all singular values are small and roughly equal.