Projections, Least Squares and Quadratic Forms
Orthogonal projection onto a line and onto a subspace, projection matrices and their properties, least squares and the normal equations, distance to a subspace, quadratic forms and their symmetric matrices, definiteness tests (eigenvalues, leading minors), the Rayleigh quotient, and diagonalising a quadratic form by a change of variables.
Projection onto a line
The closest point to on the line through is the orthogonal projection
The error is perpendicular to . is a rank-1, symmetric, idempotent matrix.
Projection onto a subspace
For a subspace where has independent columns:
If the columns are orthonormal (), this simplifies to and .
Properties of an orthogonal projection matrix onto :
| Property | |
|---|---|
| Idempotent | (projecting twice changes nothing) |
| Symmetric | |
| Eigenvalues | 1 on , 0 on |
| Rank | |
| Complement | projects onto |
| Best approximation | for all |
Least squares
When has no solution (more equations than unknowns), choose to minimise . The minimiser makes the residual orthogonal to every column of :
This is exactly linear regression: , fitted values , residuals .
Numerically, solving via QR () or the SVD is more stable than forming , which squares the condition number.
Quadratic forms
A quadratic form is with symmetric (any matrix can be replaced by its symmetric part without changing ).
Reading off the matrix: the coefficient of goes on the diagonal; half the coefficient of goes in each of positions and .
Definiteness
| Type | Condition on | Eigenvalues of |
|---|---|---|
| Positive definite | for all | all |
| Positive semi-definite | all | |
| Negative definite | for | all |
| Indefinite | takes both signs | some , some |
Sylvester's criterion: is positive definite iff all leading principal minors are positive. For : and . Negative definite iff the leading minors alternate in sign starting negative.
Equivalent characterisations of positive definiteness: all eigenvalues positive; with invertible (Cholesky exists); all pivots positive. Covariance matrices, Gram matrices and kernel matrices are positive semi-definite.
Rayleigh quotient
For symmetric with eigenvalues :
with equality at the corresponding eigenvectors. This is why the first principal component (direction of maximum variance) is the top eigenvector of the covariance matrix.
Principal axes
With and new coordinates , the cross terms disappear:
The level set of a positive definite form is an ellipsoid with axes along the eigenvectors and semi-axis lengths .
Quick revision
Practice questions
GATE-style questions: 4 one-mark and 5 two-mark. Wrong MCQs cost ⅓ of their marks in the real exam; MSQ and NAT have no negative marking. Attempt each before opening the solution.
The orthogonal projection of onto the line spanned by is . The value of is ______.
The least-squares line through the points , and has slope ______.
The quadratic form is
The maximum value of over unit vectors , where , is ______.
is the orthogonal projection matrix onto a subspace of with . Which statements are true?
One or more options are correct.
The largest integer for which is positive definite is ______.
The distance from the point to the plane is ______ (round to two decimals).
The quadratic form is written as with symmetric. The entry is ______.
For an matrix with linearly independent columns, the least-squares solution of satisfies