Chapter 8 · Introduction

Chapter 8 — Orthogonality and Least Squares

Right angles everywhere: perpendicular vectors turn messy, noisy and overdetermined problems into ones we can solve one dot product at a time.

Real data never fits perfectly. A physics student times a falling ball six times and gets six slightly different answers; an economist plots fuel prices against demand and sees a cloud of points that is almost a line; a GPS receiver hears from eight satellites when four would be enough to fix its position, and every signal carries a little noise. In each case the system of equations $A\mathbf{x}=\mathbf{b}$ has no exact solution — too many equations, all slightly inconsistent. Chapter 1 would simply say "inconsistent" and stop. This chapter finds the best possible answer instead.

The key idea is geometric and very old: the shortest path from a point to a line or a plane is the perpendicular one. Turn that into algebra and you get orthogonal vectors, orthogonal bases, projections and the method of least squares — the engine behind best-fit lines, satellite navigation, image and sound compression, and much of modern statistics and machine learning. Along the way we meet the Gram–Schmidt process, which manufactures perpendicular directions from any basis, and we finish with the Spectral Theorem: every symmetric matrix can be diagonalised using perpendicular eigenvectors.

Dot product & inner products→Orthogonal sets & complements→Gram–Schmidt & QR→Orthogonal projection→Least squares→Symmetric matrices & the Spectral Theorem
🎯 By the end of this chapter you can…
  • compute lengths, distances and orthogonality with the dot product and with other inner products (weighted, on polynomials, and — with calculus — on functions);
  • find orthogonal complements, and use $(\operatorname{Row}A)^{\perp}=\operatorname{Nul}A$;
  • find coordinates in an orthogonal basis with one dot product per vector, and recognise and use orthogonal matrices;
  • turn any basis into an orthonormal one with the Gram–Schmidt process, and factorise $A=QR$;
  • project a vector onto a subspace, and solve inconsistent systems in the least-squares sense — including fitting lines and curves to data;
  • diagonalise a symmetric matrix with an orthogonal matrix, $A=PDP^{T}$.
Teaser — The Best-Fit Line Is About Right Angles

Six measurements and a line through their centre. The red segments are the residuals (data minus line); the sum of their squares measures how bad the line is. Press Play and watch the line settle, or drag the slider yourself. At the best line the residual vector $\mathbf{r}$ becomes perpendicular to the vector of $x$-values: $\mathbf{r}\cdot\mathbf{x}=0$. That right angle is the whole secret of least squares.

0.2
line—
sum of squared residuals—
smallest possible (132/35)—
$\mathbf{r}\cdot\mathbf{x}$ (zero only at the best line)—

Sections in this chapter

✅ Before you start
You will use the dot product, length and the projection $\operatorname{proj}_{\mathbf{u}}\mathbf{v}$ from 4.2 Dot Product, Length and Angle on almost every page. Be fluent with row reduction (1.2), transposes and inverses (2.1, 2.2), basis and dimension (5.3), and the row, column and null spaces of a matrix (5.4). Section 8.4 builds directly on eigenvectors and diagonalisation (7.1, 7.2). A few clearly marked examples use integrals of polynomials (Calculus I, 4.2); you can skip them without losing the thread.