Definitions, animated
The chapter's definitions and key theorems. Animations are paced for following step by step; use the speed buttons under a video to change the pace. Jump to a card here.The scalar product in ℝn
Length, angle, projectionThe scalar product of x, y ∈ ℝn is xTy = x1y1 + ⋯ + xnyn. It gives length ‖x‖ = (xTx)1/2, distance ‖x − y‖, and angle: xTy = ‖x‖ ‖y‖ cos θ. Vectors are orthogonal when xTy = 0.
The vector projection of x onto y is p = (xTy / yTy) y. What is left over, x − p, is orthogonal to y. Everything in this chapter grows from that picture.
Angle and projection
Theorem 5.1.1 · Examples 5.1.2–5.1.4 · Exercises 5.1.1–5.1.3Drag the tips of x and y. Square roots that do not simplify are shown as decimals.
- Make xTy negative. Where does p point now?
- Load Exercise 1(b). The projection is 0: the vectors are orthogonal.
- Drag x along a line perpendicular to y. Why does p not move?
Orthogonal subspaces
The four fundamental subspacesThe orthogonal complement of a subspace Y of ℝn is Y⊥ = {x : xTy = 0 for every y ∈ Y}. For an m × n matrix A, the equation Ax = 0 says exactly that x is orthogonal to every row, so N(A) = R(AT)⊥; applied to AT, N(AT) = R(A)⊥ (Theorem 5.2.1).
Dimensions add up: dim S + dim S⊥ = n, and every vector splits uniquely as ℝn = S ⊕ S⊥ (Theorems 5.2.2, 5.2.3).
The four fundamental subspaces
Theorem 5.2.1 · Exercises 5.2.1, 5.2.12Least squares problems
The best approximate solution of an inconsistent systemWhen Ax = b has no solution, choose x̂ to make the residual r = b − Ax as short as possible. Then Ax̂ is the projection p of b onto the column space, and r is orthogonal to every column: ATr = 0. That is the system of normal equations ATAx̂ = ATb, which has a unique solution when A has rank n (Theorem 5.3.2).
Fitting a polynomial of degree k to data points is the special case where column j of A holds the powers xij.
Least squares fit
Examples 5.3.2, 5.3.3 · Exercises 5.3.5, 5.3.6 · Figure 5.3.3- Drag one point far away (an outlier). How much does the line move?
- With 3 points, set the degree to 2. The residual is 0: the parabola interpolates.
- Check the claim ATr = 0 in the status line for any data you like.
Inner product spaces
Inner products, norms, distanceAn inner product ⟨x, y⟩ is any rule that is positive (⟨x, x⟩ > 0 for x ≠ 0), symmetric, and linear in each argument. Examples: weighted sums Σwixiyi, ⟨A, B⟩ = Σaijbij for matrices, ∫f g for functions. Every inner product gives a norm, angles, projections, the Pythagorean law and the Cauchy–Schwarz inequality |⟨x, y⟩| ≤ ‖x‖ ‖y‖.
A norm need not come from an inner product. The 1-norm and the ∞-norm are norms whose unit circles have corners.
Norms and unit balls
Example 5.4.5 · Exercises 5.4.13–5.4.23Drag x. Faint curves are the unit balls ‖x‖ = 1 of the 1-, 2- and ∞-norms; the bold curve is the ball of the chosen p-norm passing through x.
- Find a nonzero x with ‖x‖1 = ‖x‖2 = ‖x‖∞ (Exercise 23).
- Where on the unit circle is ‖x‖1 largest? What is its value?
Orthonormal sets
Coordinates without solving, orthogonal matrices, projectionsAn orthonormal set consists of mutually orthogonal unit vectors. In an orthonormal basis u1, …, un, the coordinates of x are simply ci = ⟨x, ui⟩, and ‖x‖2 = Σci2 (Parseval). A square matrix Q with orthonormal columns is an orthogonal matrix: QTQ = I, so Q−1 = QT, and Q preserves lengths and angles.
The projection of x onto a subspace with orthonormal basis u1, …, uk is p = Σ⟨x, ui⟩ui = UUTx, the closest point of the subspace (Theorems 5.5.7, 5.5.8).
Orthonormal coordinates and orthogonal matrices
Theorems 5.5.2, 5.5.5, 5.5.7 · Example 5.5.6The Gram–Schmidt process
Orthonormalize a basis; QR factorizationGiven independent a1, …, an, set q1 = a1/‖a1‖ and, for each next vector, subtract its projections onto the q's already built and normalize what is left: rik = qiTak, rkk = ‖ak − Σrikqi‖. The numbers rik fill an upper triangular R with A = QR (Theorem 5.6.2). Then least squares is easy: Rx̂ = QTb (Theorem 5.6.3).
Gram–Schmidt and QR, step by step
Examples 5.6.2–5.6.4 · Exercises 5.6.1–5.6.8, 5.6.12Orthogonal polynomials
Legendre and ChebyshevA sequence p0, p1, … with deg pi = i and ⟨pi, pj⟩ = 0 for i ≠ j is a sequence of orthogonal polynomials. They always satisfy a three-term recursion (Theorem 5.7.2). Legendre polynomials use ⟨p, q⟩ = ∫−11 p q dx; Chebyshev polynomials Tn(cos θ) = cos nθ use the weight (1 − x2)−1/2.