The projection matrix carried through a numerical example: the best line through three points is C = 2/3, D = 1/2, and AᵀA is invertible exactly when the columns of A are independent.
Case one: b is already in the column space. Then b=Ax, and
Pb=A(A⊤A)−1A⊤Ax=Ax=b.
The projection does not move it.
Case two: b is perpendicular to the column space. Then b∈N(A⊤), so A⊤b=0 and Pb=0.
A general vector splits as
b=Pb+(I−P)b,
the first part in the column space and the second perpendicular to it. I−P is also a projection matrix, onto the orthogonal complement. It is likewise symmetric and idempotent:
(I−P)⊤=I−P,(I−P)2=I−P.
Timeline
Time
Topic
0:07
Reviewing the projection formula
2:32
Two extreme cases as a check
7:44
I−P is also a projection
9:48
The error and the projection
11:11
The matrix for the three-point fit
13:47
Sum of squared errors as the measure
15:06
Two pictures: projection and best line
23:13
The normal equations in numbers
24:32
Partial derivatives in C and D
27:52
Solving C=2/3, D=1/2
30:13
The error and projection vectors
31:58
The error is orthogonal to the column space
37:32
Independence makes ATA invertible
40:18
The proof by dot product
43:01
Ax=0 forces x=0
46:23
A preview of orthonormal vectors
Computing least squares
Fit a line b=C+Dt to the points (1,1),(2,2),(3,2).
The error is perpendicular to both columns of A, hence to the whole column space. Also
p⋅e=67(−61)+35⋅31+613(−61)=36−7+20−13=0.
Two pictures of one calculation
Data picture: three points, a line, and three vertical errors. Minimize e12+e22+e32.
Vector picture:b decomposes into p in the column space and e perpendicular to it.
C and D are the coefficients that combine the two columns into p. The pictures are the same numbers drawn two ways.
The normal equations from calculus
Minimize
E(C,D)=(C+D−1)2+(C+2D−2)2+(C+3D−2)2.
Set the partial derivative with respect to C to zero:
2(C+D−1)+2(C+2D−2)+2(C+3D−2)=0,
which simplifies to 3C+6D=5.
Set the partial derivative with respect to D to zero:
2(C+D−1)⋅1+2(C+2D−2)⋅2+2(C+3D−2)⋅3=0,
which simplifies to 6C+14D=11.
These are exactly the normal equations. Squaring pays off here: the derivative stays linear.
A limitation
A point far from the line has its error squared, so it can dominate and drag the fit. Statisticians call such a point an outlier and have developed robust regression in response. Least squares remains the most widely used method, but it is not the only one.
Proof: AᵀA is invertible when the columns are independent
This is the central fact of the chapter, since the whole computation depends on (A⊤A)−1 existing.
Assume the columns of A are independent. To show A⊤A is invertible, it suffices to show N(A⊤A)={0}.
Suppose
A⊤Ax=0.
Multiply on the left by x⊤:
x⊤A⊤Ax=0.
The left side is
(Ax)⊤(Ax)=∥Ax∥2.
A zero norm forces Ax=0.
Independence of the columns means the null space contains only the zero vector, so
x=0.
Hence N(A⊤A)={0} and A⊤A is invertible.
The converse
If the columns are dependent, some nonzero x has Ax=0, hence A⊤Ax=0, so A⊤A is singular. Therefore
A⊤A is invertible⟺the columns of A are independent.
The columns (1,1,1) and (1,2,3) are not multiples, so they are indeed independent.
Takeaways
A projection splits b into a column-space part Pb and an orthogonal part (I−P)b.
Least squares is given by the normal equations and is geometrically a projection.
The three-point fit is b=2/3+t/2, with an error vector orthogonal to the column space.
The normal equations also follow by differentiating the squared error.
A⊤A is invertible exactly when A has independent columns, proved via N(A⊤A)=N(A).
Check your understanding
1. Why is I−P a projection matrix, and onto which space does it project?
Reference answer: Check the two properties:
(I−P)⊤=I⊤−P⊤=I−P,(I−P)2=I−2P+P2=I−2P+P=I−P,
so I−P is symmetric and idempotent — a projection matrix.
It projects onto the orthogonal complement of C(A), namely the left null space N(A⊤). Two observations: for any b, (I−P)b=b−Pb is exactly the error e, already shown orthogonal to C(A); and if b∈C(A) then Pb=b, so (I−P)b=0, meaning I−P collapses the column space to zero. Thus
b=∈C(A)Pb+∈N(A⊤)(I−P)b
is the decomposition of b along the two orthogonal complementary subspaces.
2. Differentiate E(C,D) and verify that you recover the normal equations.
Reference answer: The objective is
E(C,D)=(C+D−1)2+(C+2D−2)2+(C+3D−2)2.
Differentiate with respect to C and set to zero:
∂C∂E=2[(C+D−1)+(C+2D−2)+(C+3D−2)]=0,
which simplifies to 3C+6D−5=0, i.e. 3C+6D=5.
Differentiate with respect to D and set to zero:
∂D∂E=2[(C+D−1)⋅1+(C+2D−2)⋅2+(C+3D−2)⋅3]=0,
which simplifies to 6C+14D−11=0, i.e. 6C+14D=11.
Both equations are exactly
[36614][CD]=[511]⟺A⊤Ax^=A⊤b.
This is the payoff of squaring: the derivative is still linear, so the optimum solves a linear system.
3. For the three-point example, verify p⋅e=0.
Reference answer: With
p=7/65/313/6,e=−1/61/3−1/6,
multiply term by term and add:
p⋅e=67(−61)+35⋅31+613(−61)=−367+95−3613.
Over the common denominator 36: −367+3620−3613=360=0.
So p⊥e. This is the right triangle b=p+e, with p the foot of b on the column space.
4. Prove N(A⊤A)=N(A), naming what each step uses.
Reference answer: Two inclusions.
N(A)⊆N(A⊤A): if Ax=0, multiply on the left by A⊤ to get A⊤Ax=0. This uses only matrix multiplication and the definition of the zero vector.
N(A⊤A)⊆N(A): if A⊤Ax=0, multiply on the left by x⊤:
0=x⊤A⊤Ax=(Ax)⊤(Ax)=∥Ax∥2.
This uses x⊤A⊤=(Ax)⊤. Finally, a squared norm is zero exactly when the vector is zero (positive definiteness), so Ax=0.
Both inclusions give N(A⊤A)=N(A); the dimensions and ranks agree as well.
5. If the points were (1,1),(2,2),(3,3), what would the best line and the error be?
Reference answer: The three points lie exactly on b=t, so the best line is b=t, i.e. C=0, D=1, and the error is zero.
Solve 3C+6D=6 and 6C+14D=14: the first gives C=2−2D; substituting yields 12−12D+14D=14, so 2D=2, D=1, and C=0. Hence p=Ax^=(1,2,3)⊤=b, the error is e=b−p=0, consistent with the points lying on the line.
How this connects to the course
The previous lecture built the projection formula; this one finishes the arithmetic and proves invertibility. The next changes the basis to the best possible columns — orthonormal vectors — so that projection and least squares require almost no inversion.