A zero dot product is the test for orthogonality; row space is perpendicular to null space and column space to left null space, each pair an orthogonal complement. This leads directly to the least-squares equation AᵀA x̂ = Aᵀb.
Orthogonal means perpendicular. Two vectors x,y∈Rn are orthogonal exactly when
x⊤y=x1y1+x2y2+⋯+xnyn=0.
That is the only test needed in this chapter. The zero vector is orthogonal to everything, since every dot product with it is zero.
Why a zero dot product means perpendicular
Let the legs of a right triangle be x and y, with hypotenuse x+y. Pythagoras says
∥x∥2+∥y∥2=∥x+y∥2.
Expand the right side:
∥x+y∥2=(x+y)⊤(x+y)=x⊤x+x⊤y+y⊤x+y⊤y.
For real vectors x⊤y=y⊤x, so
∥x+y∥2=∥x∥2+2x⊤y+∥y∥2.
The Pythagorean identity holds exactly when
2x⊤y=0.
Pythagoras and the dot-product test are the same statement in two forms.
A numerical example
Take x=(1,2,3)⊤. First try y=(1,2,−1)⊤:
x⊤y=1+4−3=2=0,
so they are not orthogonal. Now take y=(2,−1,0)⊤:
x⊤y=2−2+0=0,
so they are orthogonal. Then
∥x∥2=14,∥y∥2=5,∥x+y∥2=∥(3,1,3)∥2=9+1+9=19,
and 14+5=19, confirming Pythagoras.
Timeline
Time
Topic
0:11
Orthogonal vectors and the dot product
3:42
Right angles and a zero inner product
5:33
Pythagoras
7:19
Length squared as xTx
10:55
The zero vector is orthogonal to everything
16:30
Orthogonal subspaces: every pair of vectors
23:31
Orthogonal complements
25:34
Row space and null space are orthogonal complements
27:15
Their dimensions add to n
30:46
Normal vectors and planes
34:16
Least squares: the main problem of the chapter
36:00
The satellite example
44:26
When the system is solvable
46:09
Is ATA always invertible
48:01
ATA is invertible when the columns are independent
Orthogonal subspaces
Two subspaces S and T are orthogonal when
every vector in S is orthogonal to every vector in T.
This is stronger than "the intersection is zero". Two planes through the origin in R3 (a blackboard and the floor, say) intersect in a line, so they are not orthogonal: a vector on that line cannot be orthogonal to itself.
In R2 the only subspaces are the zero space, lines through the origin, and the whole plane. Two lines are orthogonal exactly when they meet at 90 degrees; a line is always orthogonal to the zero subspace and never to the whole plane.
Orthogonality of the four subspaces
Row space and null space
Let x∈N(A), so Ax=0. Writing A row by row,
Ax=row1⋮rowmx=row1⋅x⋮rowm⋅x=0⋮0.
Thus x is orthogonal to every row of A.
Any vector in the row space is a combination ∑cirowi, and
(i∑cirowi)⋅x=i∑ci(rowi⋅x)=0.
Therefore every null-space vector is orthogonal to every row-space vector:
Two orthogonal subspaces whose dimensions add to the whole space are orthogonal complements:
N(A)=C(A⊤)⊥,N(A⊤)=C(A)⊥.
"Complement" means more than "contains some orthogonal vectors": the null space consists of all vectors orthogonal to the row space, no more and no fewer.
This is part two of the fundamental theorem of linear algebra. Part one is dimensions; part two is orthogonality; part three, next lecture, is orthogonal bases.
Example: a rank-one matrix
Take the single-row matrix
A=[125].
The row space is the line through (1,2,5).
The null space is the solution set of x1+2x2+5x3=0, a plane perpendicular to that line.
The dimensions are 1+2=3.
In R3 a line and a plane can be perpendicular with dimensions summing to 3. Two perpendicular lines have dimensions summing only to 2, so they are not orthogonal complements.
Least squares: the main problem of the chapter
When Ax=b has no solution, a best approximation is still required.
The typical setting: m>n, more equations than unknowns, and noise in b. A satellite position estimated from a thousand measurements, or a pulse rate measured repeatedly. Discarding equations is unsatisfying because every measurement carries information.
The right move is to multiply both sides by A⊤:
A⊤Ax^=A⊤b.
These are the normal equations, and x^ is the least-squares solution. They always have a solution, and the solution is unique when the columns of A are independent.
Properties of A⊤A
Property
Reason
Square
A is m×n, so A⊤A is n×n
Symmetric
(A⊤A)⊤=A⊤A
Rank equals rank(A)
See below
Null space equals N(A)
See below
Invertible ⟺ columns of A are independent
Follows from the previous two
The key step: if A⊤Ax=0, multiply on the left by x⊤:
x⊤A⊤Ax=(Ax)⊤(Ax)=∥Ax∥2=0.
A zero norm means Ax=0. Hence
N(A⊤A)=N(A),
and the ranks agree. Therefore A⊤A is invertible exactly when N(A)={0}, that is, when the columns of A are independent.
A numerical example
A=111125.
Then
A⊤A=[111215]111125=[38830].
Its determinant is 3⋅30−8⋅8=90−64=26=0, so it is invertible, as expected for independent columns.
If the second column is made a multiple of the first, for instance
A=123123,A⊤A=[14141414],
the rank is 1 and A⊤A is singular. The columns are dependent and the normal equations have infinitely many solutions.
Takeaways
Vectors are orthogonal iff their dot product is zero; Pythagoras and the dot-product test are equivalent.
Subspace orthogonality requires every pair of vectors to be orthogonal, which is stronger than a zero intersection.
Row space ⊥ null space and column space ⊥ left null space, each pair an orthogonal complement.
When no solution exists, solve A⊤Ax^=A⊤b.
A⊤A is symmetric, has the same null space and rank as A, and is invertible when the columns of A are independent.
Check your understanding
1. Why is the zero vector orthogonal to everything, and how does that relate to every subspace containing zero?
Reference answer: For any y, 0⊤y=0, so the dot product always vanishes and the zero vector is orthogonal to every vector.
Every subspace contains zero, so zero is orthogonal to every vector in every subspace. That does not make arbitrary subspaces orthogonal: subspace orthogonality requires every vector of S to be orthogonal to every vector of T, and if S∩T contains a nonzero v then v⊤v=∥v∥2>0, so orthogonality fails at once. "The intersection is only zero" is therefore necessary for orthogonal subspaces — exactly because zero is orthogonal to everything — but not sufficient: two planes through the origin in three dimensions meet in a line and are not orthogonal.
2. If two planes through the origin share a nonzero line, why can they not be orthogonal?
Reference answer: Let the shared direction be v=0. Then v lies in both planes, so take v from S and v from T; their dot product is
v⊤v=∥v∥2>0.
Subspace orthogonality demands that every vector of S be orthogonal to every vector of T, and here is a pair that is not. In short, a nonzero vector can never be orthogonal to itself.
3. Prove from Ax=0 that the null space is orthogonal to the row space, including combinations of rows.
Reference answer: Let x∈N(A), so Ax=0. Writing A by rows, each component of the product is a dot product of a row with x:
Ax=row1⋅x⋮rowm⋅x=0,
so every row is orthogonal to x.
Any vector of the row space is ∑icirowi, and bilinearity of the dot product gives
(i∑cirowi)⋅x=i∑ci(rowi⋅x)=i∑ci⋅0=0.
So every row-space vector is orthogonal to x; since x was arbitrary in N(A), we get C(A⊤)⊥N(A).
4. Why do A⊤A and A have the same null space? Write the crucial step.
Reference answer: Two directions.
If Ax=0, then A⊤Ax=A⊤0=0, so N(A)⊆N(A⊤A).
Conversely, if A⊤Ax=0, multiply on the left by x⊤:
0=x⊤A⊤Ax=(Ax)⊤(Ax)=∥Ax∥2.
The crucial step: a squared norm is zero only when the vector itself is zero, so Ax=0 and N(A⊤A)⊆N(A).
Hence N(A⊤A)=N(A), with equal dimensions and equal ranks. Therefore A⊤A is invertible exactly when N(A)={0}, i.e. when the columns of A are independent.
5. If a 5×2 matrix has dependent columns, what is the rank of A⊤A, and how many least-squares solutions are there?
Reference answer: With A of size 5×2 and dependent columns, rank(A)≤1. If A=0 then rank(A)=1, and since rank(A⊤A)=rank(A),
rank(A⊤A)=1.
So the 2×2 matrix A⊤A is singular, and N(A⊤A)=N(A) has dimension 2−1=1.
The normal equations A⊤Ax^=A⊤b are always consistent (A⊤b lies in the column space of A⊤A), but here the solution is not unique:
x^=x^p+cv,
where v spans N(A) and c is arbitrary — infinitely many least-squares solutions. (If A=0, the rank is 0 and every x^ is a solution.)
How this connects to the course
The previous lecture showed only that the row and null spaces intersect at zero. This one proves they are perpendicular orthogonal complements. The next lecture constructs orthogonal bases with Gram-Schmidt and gives the full geometry of least squares.