15. Projections onto Subspaces
Overview
The lecture derives orthogonal projection first onto a line and then onto the column space of a matrix, showing that the nearest point is characterized by an error perpendicular to the subspace. It develops the normal equations A^T A x̂ = A^T b and the projection matrix A(A^T A)^-1A^T, then applies the setup to fitting a line to three data points that cannot all lie on one line.
Key takeaways
- The closest point on a line through a nonzero vector a is a(a^T b)/(a^T a), obtained by requiring the residual b - P to be perpendicular to a.
- An orthogonal projection matrix is symmetric and idempotent: P^T = P and P^2 = P, since projecting twice has the same result as projecting once.
- For a full-column-rank matrix A, the least-squares coefficients satisfy A^T A x̂ = A^T b and equal (A^T A)^-1 A^T b.
- The residual e = b - A x̂ lies in N(A^T), which is orthogonal to Col(A); this algebraic condition is exactly the geometric requirement for the nearest-point projection.
- The projection onto Col(A) is A(A^T A)^-1A^T, and A itself cannot generally be inverted or canceled because it is rectangular.
- Fitting b = C + Dt to (1,1), (2,2), and (3,2) creates a 3-equation, 2-unknown inconsistent system; least squares finds the line minimizing the residual through the normal equations.
Chapters
- The closest point P on the line through a has the form P = ax, so the unknown is the scalar coefficient x.
- The error e = b - ax must be perpendicular to a, giving a^T(b - ax) = 0.
- Solving yields x = (a^T b)/(a^T a) and P = a(a^T b)/(a^T a), assuming a is nonzero.
- Writing P as a matrix acting on b gives the projection matrix aa^T/(a^T a).
- The matrix has rank one and column space equal to the line spanned by a.
- It is symmetric, P^T = P, and idempotent, P^2 = P, because projecting a point already on the line leaves it unchanged.
- Doubling b doubles its projection, while scaling a does not change the line or the projection.
- When b is outside the column space of A, the equation Ax = b has no solution.
- Instead, choose the closest vector in Col(A), the projection P of b, and solve Ax̂ = P.
- The least-squares solution x̂ gives the coefficients of the best approximation to b using the columns of A.
- In the three-dimensional example, independent vectors a₁ and a₂ form a basis for a plane.
- Putting a₁ and a₂ into the columns of A makes that plane equal to Col(A); the same setup extends to n columns.
- The projected point is P = A x̂, and the residual e = b - A x̂ is perpendicular to the plane.
- For a plane spanned by a₁ and a₂, the residual must satisfy a₁^T e = 0 and a₂^T e = 0.
- Combining those conditions gives A^T(b - A x̂) = 0.
- The equation is equivalent to A^T A x̂ = A^T b, with one equation for each column coefficient.
- The condition A^T e = 0 places the residual e in the null space of A^T.
- The null space of A^T is orthogonal to Col(A), matching the geometric requirement that the error be perpendicular to the projected subspace.
- The line-projection equation is the one-column special case of the same normal-equation framework.
- When A has linearly independent columns, A^T A is invertible and x̂ = (A^T A)^-1 A^T b.
- Substituting x̂ into P = A x̂ gives P = A(A^T A)^-1A^T b.
- The projection matrix is therefore A(A^T A)^-1A^T, extending aa^T/(a^T a) from a line to a higher-dimensional column space.
- A is generally rectangular when there are more equations than unknowns, so A has no ordinary inverse and the factors in (A^T A)^-1 cannot be split apart.
- If A is square and invertible, Col(A) is all of R^n, so projection onto that space is the identity matrix.
- The higher-dimensional projection matrix remains symmetric and idempotent, as confirmed by transposing it and simplifying its square.
- The example fits b = C + Dt to the points (1,1), (2,2), and (3,2), which do not lie on a single line.
- The desired equations are C + D = 1, C + 2D = 2, and C + 3D = 2, giving A = [[1,1],[1,2],[1,3]], x = [C,D]^T, and b = [1,2,2]^T.
- Because the system has three equations and two unknowns, it is inconsistent; the next step is to solve A^T A x̂ = A^T b for the best-fit line.
Transcript excerpt
0:10 OK, guys the -- we're almost ready to make this lecture immortal. OK. Are we on? All right. This is an important lecture. It's about projections. Let me start by just projecting a vector b down on a vector a. So just to so you see what the geometry looks like in when I'm in -- in just two dimensions, I'd like to find the point along this line so that line through a is a one-dimensional subspace, so I'm starting with one dimension.
0:56 I'd like to find the point on that line closest to a. Can I just take that problem first and then I'll explain why I want to do it and why I want to project on other subspaces. So where's the point closest to b that's on that line? It's somewhere there. And let me connect that and -- and what's the whole point of my picture now? What's the -- where does orthogonality come into this picture? The whole point is that this best point, that's the projection, P, of b onto the line, where's orthogonality? It's the fact that that's a right angle.
1:46 That this -- the error -- this is like how much I'm wrong by -- this is the difference between b and P, the whole point is -- that's perpendicular to a. That's got to give us the equation. That's got to tell us -- that's the one fact we know, that's got to tell us where that projection is. Let me also say, look -- I've drawn a triangle there. So if we were doing trigonometry we would do like we would have angles theta and distances that would involve sine theta and cos theta that leads to lousy formulas compared to linear algebra. The formula that we want comes out nicely and what's the --
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, MIT OpenCourseWare.