Projections & Least Squares
00 · Symbol Glossary
The least squares solution to — the value of that minimises . The hat accent is standard notation for estimated quantities throughout statistics. is the solution to the normal equations .
The projection of onto the column space of : . It is the closest point in to . The residual vector is orthogonal to .
The residual . Measures how far the best approximation is from the target . The fundamental orthogonality condition is — the residual is orthogonal to every column of .
The matrix that projects any vector onto a subspace: . Satisfies (idempotent) and (symmetric). Applying twice is the same as once — you cannot project more than once.
The Moore-Penrose pseudoinverse for a matrix with independent columns: . Satisfies , so it is a left inverse. Also written in the general case.
01 · Projection onto a Subspace
The projection from Chapter 12 generalised: instead of projecting onto a single vector , project onto an entire subspace spanned by a matrix's columns.
Let have linearly independent columns. The orthogonal projection of onto is:
The matrix is the projection matrix onto . It satisfies:
- (idempotent: projecting twice gives the same result)
- (symmetric)
- for all
- for all
Project onto the line spanned by .
Here . .
.
.
Residual: . Check: ✓.
02 · Derivation of the Normal Equations
When has no exact solution (overdetermined: more equations than unknowns), the best we can do is find making as small as possible.
The geometric insight: the minimum of over all is achieved when is the point in closest to — i.e., the projection . The error must be orthogonal to every column of .
The least squares solution satisfies the normal equations:
Derivation: Orthogonality condition means , i.e. , which rearranges to .
Unique solution: When has linearly independent columns, is invertible and .
State the residual: . This is the difference between the target and our approximation .
Apply the orthogonality requirement: is the closest point in to for every column of .
Written in matrix form: .
Substitute the residual: .
Expand: .
Rearrange: . These are the normal equations.
Solve (when is invertible):
is a square matrix; it is invertible the columns of are linearly independent.
If the columns of are linearly dependent, then is singular — the normal equations have either no solution or infinitely many. The least squares problem still has a geometric solution (the projection still exists), but the representation in terms of is not unique. This happens in regression when predictors are perfectly collinear — one is a linear combination of others. The fix: either remove dependent predictors or use regularisation (ridge/LASSO, Chapter 10).
03 · Why Is Invertible Exactly When Columns Are Independent
is invertible has linearly independent columns .
Proof: Suppose . Then , which equals , so . If columns of are independent, the only solution is , so and is invertible.
Conversely, if some satisfies , then , so is singular.
Write the design matrix: each row is for the model .
4 observations, 2 parameters .
Compute :
: . : . : .
Compute :
Row 1: . Row 2: . (Recalculating: .)
Solve :
.
.
.
Interpret: . The fitted line has intercept and slope . Predicted values: , , , . Residuals: , , , . Sum of residuals: ✓ (always true for OLS with intercept).
04 · The Projection Matrix
The matrix can be applied to any to get its projection. Its properties follow algebraically from the formula.
✓.
The bracketed middle simplifies to , eliminating the inner two factors. Projecting twice is the same as projecting once — once you are in the subspace, you stay there.
The matrix projects onto the orthogonal complement of — the subspace of vectors orthogonal to all columns of . Any vector decomposes as with and . The residual is the projection.
05 · Quant Application — OLS Regression as Projection
Ordinary Least Squares regression is the projection of the response vector onto the column space of the design matrix .
Given observations, predictors, and the model :
is the OLS estimator. The fitted values are the projection of onto .
Geometric interpretation: is the closest point in to . Minimising is equivalent to finding the foot of the perpendicular from to the plane spanned by the regressors.
Why must be invertible: must have no perfectly collinear columns. In finance: if two factor exposures are identical across all assets, and is singular — the factor contribution is not identified.
06 · Practice Exercises
is a scalar here since has one column. The formula simplifies to , which is the projection from Chapter 12.
, .
.
.
.
.
.
Verify: ✓.
Project onto the column space of . Compute and the residual . Verify .
Form the design matrix with one column of 1s (intercept) and one column of -values. Compute , , and solve the normal equations.
Data: .
, .
. .
. .
.
Fitted line: .
Predictions: , , .
Residuals: , , . Sum: ✓.
Fit the line to the data points using least squares. Set up the normal equations, solve them, write the fitted line, and compute residuals.
Compute explicitly. Check by matrix multiplication and by inspection.
.
. .
.
Symmetry: since every row equals every column in this matrix ✓.
Idempotency: . Each entry of is . So ✓.
Geometric meaning: projects onto the line spanned by — the "constant" direction in . is the vector where is the mean.
For , compute the projection matrix explicitly. Verify and . Describe geometrically what does to a vector .
where is the mean of . Compute numerator and denominator .
From Exercise 12.2: residuals , .
.
.
.
.
Interpretation: the line explains of the variance in . The remaining is in the residuals — the component of orthogonal to .
Using the least squares fit from Exercise 12.2, compute the coefficient of determination . Interpret geometrically in terms of projections.
Show that the residuals from an OLS regression always satisfy (when an intercept is included) using the normal equations. The column of ones in ensures .
The design matrix includes a column of all ones: .
The normal equations require , which means in particular that .
.
Consequence: is not an assumption — it is a theorem that follows from including an intercept in the model. Geometrically: the residual is orthogonal to the intercept column , which means the residuals are mean-zero.
For each additional column : means the residuals are uncorrelated with each regressor — the fundamental OLS property.
Prove algebraically that OLS residuals sum to zero () whenever the design matrix includes a column of ones (intercept). Use the normal equations. State what this means about the residual vector's relationship to the column space of .
Fit separate OLS regressions of each asset's returns on the factor return. The OLS beta is where is the factor column and is the asset return vector. Then use to measure how much the factor explains.
Market factor returns , asset returns .
Design matrix with intercept: .
(using and ).
. Row 1: sum of returns . Row 2: .
: sample covariance numerics give market beta . This means for each 1% market move, asset A moves — it is more volatile than the market (beta ).
The measures how much return variance the single factor explains; the residual is idiosyncratic (firm-specific) risk not captured by market exposure.
A factor model regresses each asset's returns on a single market factor (with intercept). Factor returns are over four periods; asset A returns are . Set up the normal equations and describe what the estimated slope (market beta) and measure for this asset.
07 · Chapter Summary
| Concept | Formula / Rule |
|---|---|
| Projection onto | |
| Projection matrix | ; ; |
| Orthogonality of residual | ; |
| Normal equations | |
| Least squares solution | when has independent cols |
| invertible iff | Columns of are linearly independent |
| OLS regression | ; |
| Residuals mean-zero | whenever has intercept column |
| geometric | Fraction of explained by projection |
Next: Chapter 14 — Positive Definite Matrices establishes four equivalent characterisations of positive definiteness — including the quadratic form that generalises the sum-of-squares residual minimised in this chapter's least squares problems — and connects them to eigenvalues, Cholesky decomposition, and valid covariance matrices.