Inner-Product Spaces, Orthogonality, and Projections
Geometry for abstract vectors: angles, orthonormal bases, orthogonal projection, and the least-squares solution.
Leads to: Projections power least squares (Phase 11) and orthonormal bases feed the spectral theorem (4.6) and QR (Phase 5).
Learning Objectives
Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.
- State the inner-product axioms and derive the induced norm and Cauchy–Schwarz inequality.
- Construct an orthonormal basis via the Gram–Schmidt process.
- Compute the orthogonal projection onto a subspace.
- Derive the least-squares normal equations and interpret them geometrically.
Key Vocabulary
- Inner product
- A map \(\langle\cdot,\cdot\rangle\) that is linear, symmetric, and positive-definite; generalizes the dot product.
- Orthonormal set
- Vectors that are mutually orthogonal and of unit norm: \(\langle q_i,q_j\rangle=\delta_{ij}\).
- Orthogonal projection
- The closest point \(\operatorname{proj}_U x\) in a subspace \(U\) to a given \(x\).
- Gram–Schmidt
- An algorithm turning any independent list into an orthonormal basis of the same span.
- Orthogonal complement
- \(U^\perp=\{v:\langle v,u\rangle=0\ \forall u\in U\}\); \(V=U\oplus U^\perp\).
- Least squares
- Minimizing \(\lVert Ax-b\rVert^2\) by projecting \(b\) onto the column space of \(A\).
Intuition & Motivation
Inner products, norms, and Cauchy–Schwarz
An inner product \(\langle x,y\rangle\) is linear in each argument, symmetric, and positive-definite (\(\langle x,x\rangle\gt 0\) for \(x\neq0\)). It induces the norm \(\lVert x\rVert=\sqrt{\langle x,x\rangle}\) and the angle via \(\langle x,y\rangle=\lVert x\rVert\lVert y\rVert\cos\theta\). Cauchy–Schwarz \(|\langle x,y\rangle|\le\lVert x\rVert\lVert y\rVert\) follows from expanding \(\lVert x-ty\rVert^2\ge0\).
Orthogonal projection
For a general (not-necessarily-orthonormal) basis assembled into a matrix \(A\) with independent columns, the projection onto \(\operatorname{col}(A)\) is \(P=A(A^\top A)^{-1}A^\top\).
Gram–Schmidt
Least squares as projection
The system \(Ax=b\) with more equations than unknowns is usually inconsistent (\(b\) is off the column space). The best we can do is minimize the residual norm \(\lVert Ax-b\rVert\). The minimizer makes the residual orthogonal to the column space, giving the normal equations:
This is ordinary least-squares regression: \(\hat b\) are the fitted values, the projection of the data onto the span of the predictors, and the residual is orthogonal to every predictor.
Interactive: implement Gram–Schmidt
- Forgetting to normalize after orthogonalizing - you then have an orthogonal but not orthonormal set.
- Projecting onto a non-orthonormal basis with the simple dot-product formula; that only works when the basis is orthonormal.
- Solving \(Ax=b\) directly when it is inconsistent instead of the normal equations \(A^\top A\hat x=A^\top b\).
- Assuming the residual is small; least squares only guarantees it is orthogonal to the column space, not tiny.
- In statistics the inner product of centered variables is their covariance; orthogonality means zero correlation.
- Prefer QR (numerically stable Gram–Schmidt) over forming \(A^\top A\) directly - the latter squares the condition number (Phase 5).
- Every regression is a projection: fitted values live in the predictors’ span, residuals are orthogonal to it.
Knowledge Check
Practical Exercise
Fit a line \(y=\beta_0+\beta_1 t\) to the points \((0,1),(1,1),(2,3)\) by least squares. Set up \(A,b\), solve the normal equations, and report \(\hat\beta\).
Design matrix and target: \(A=\begin{bmatrix}1&0\\1&1\\1&2\end{bmatrix},\ b=\begin{bmatrix}1\\1\\3\end{bmatrix}\).
Solve \(\begin{bmatrix}3&3\\3&5\end{bmatrix}\hat\beta=\begin{bmatrix}5\\7\end{bmatrix}\). Determinant \(15-9=6\), so \(\hat\beta=\tfrac16\begin{bmatrix}5&-3\\-3&3\end{bmatrix}\begin{bmatrix}5\\7\end{bmatrix}=\tfrac16\begin{bmatrix}4\\6\end{bmatrix}=\begin{bmatrix}2/3\\1\end{bmatrix}\).
So \(\hat\beta_0=2/3,\ \hat\beta_1=1\): the fitted line is \(\hat y=\tfrac23+t\). The fitted values \((2/3,\,5/3,\,8/3)\) are the projection of \(b\) onto \(\operatorname{col}(A)\).
Lesson Summary
Formula Sheet Additions
Retrieval Practice
Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.
A: The residual b - A x-hat is orthogonal to the column space of A, giving the normal equations A^T A x-hat = A^T b.
A: An orthonormal basis of the same span; with it, projections and coordinates reduce to simple inner products (the basis of QR).
Completion Checklist
- I can explain the core ideas in my own words
- I worked the derivations/examples by hand
- I completed the interactive workbench(es)
- I passed the knowledge check
Source References
This lesson synthesizes and paraphrases concepts from the sources below. No copyrighted text, problem sets, or solutions are reproduced. Return to the originals for full depth.
- Linear Algebra Done Right (Sheldon Axler, 4th ed., 2024) current - Ch. 6 - Ch. 6: inner-product spaces, orthonormal bases, Gram-Schmidt, orthogonal projection.
- The Elements of Statistical Learning (Hastie, Tibshirani & Friedman, 2nd ed.) current - Ch. 3 - Ch. 3: linear regression as orthogonal projection and the normal equations.