An orthogonal set of nonzero vectors is automatically independent, and relative to an orthogonal basis the coordinates of any vector are ratios of dot products, with no row reduction. The same ratios give the orthogonal projection of a vector y onto a subspace W: the sum of its projections onto the orthogonal basis vectors. The error y − ŷ is orthogonal to W, and the Pythagorean theorem then shows that ŷ is the point of W closest to y, which is the idea behind least squares.
What you'll learn
Recognize orthogonal and orthonormal sets
Find coordinates relative to an orthogonal basis with dot products
A set of vectors is orthogonal when every pair has dot product 0. The
standard basis of ℝⁿ is one example; so is
u1=(3,1,1)u2=(−1,2,1)u3=(−21,−2,27)
since u1⋅u2=−3+2+1=0, and the other two
pairs also give 0.
An orthogonal set of nonzero vectors is automatically linearly independent. If
c1u1+⋯+cpup=0, taking the dot product
of both sides with uj kills every term but one, leaving
cjuj⋅uj=0, so cj=0.
The same move finds coordinates. If y=c1u1+⋯+cpup,
dotting with uj isolates cj:
The dot product lesson found the shadow of one
vector on another. For a line L spanned by u,
y^=projLy=u⋅uy⋅uu
and the leftover y−y^ is orthogonal to u.
For y=(7,6) and u=(4,2) the ratio is
16+428+12=2, so y^=(8,4), and the leftover
(−1,2) has dot product −4+4=0 with u. The distance from
y to the line is ∥(−1,2)∥=5.
line spanned by (4, 2)
Projecting y = (7, 6) onto the line through (4, 2)
For a subspace W with an orthogonal basis u1,…,up,
the projection adds up the projections onto each basis vector:
y^=u1⋅u1y⋅u1u1+⋯+up⋅upy⋅upup
Dotting y−y^ with any uj gives
y⋅uj−cjuj⋅uj=0, so
the error is orthogonal to every basis vector and therefore to all of W. Now
take any other point w in W. The vector y−w
splits as (y−y^)+(y^−w),
the first piece orthogonal to W and the second inside it, so by the
Pythagorean theorem
∥y−w∥2=∥y−y^∥2+∥y^−w∥2≥∥y−y^∥2
Because the error y−y^ is perpendicular to W,
every other point of W is farther from y: the projection is the
best approximation to y from inside W.
Are (1,1,0), (1,−1,0) and (0,0,2) an orthogonal set?
Answer
Yes
Full solution
The three dot products are 1−1+0=0, 0+0+0=0 and 0+0+0=0.
Find the coordinates of (3,1,4) relative to the basis in exercise 1.
Answer
2, 1 and 2
Full solution
23+1=2, 23−1=1 and 48=2. Check: 2(1,1,0)+(1,−1,0)+2(0,0,2)=(3,1,4).
Find the coordinates of (5,5) relative to the orthogonal basis (1,2), (−2,1).
Answer
3 and −1
Full solution
55+10=3 and 5−10+5=−1.
Project (4,2) onto the line spanned by (1,1).
Answer
(3,3)
Full solution
1+14+2=3, so the projection is 3(1,1).
Find the distance from (4,2) to that line.
Answer
2
Full solution
The error is (4,2)−(3,3)=(1,−1), of length 2.
Project (1,1,1) onto the xy-plane, using the basis e1, e2.
Answer
(1,1,0)
Full solution
The two coefficients are 1 and 1. The error (0,0,1) points straight out of the plane.
Scale (1,2,2) to a unit vector.
Answer
(31,32,32)
Full solution
Its length is 1+4+4=3.
Project (2,3) onto the line spanned by (1,0).
Answer
(2,0)
Full solution
Projecting onto the x-axis keeps the first coordinate and zeroes the second.
If y is already in W, what is its projection onto W?
Answer
y itself
Full solution
The closest point of W to a point already in W is that point, at distance 0. The coordinate formula reproduces y exactly.
A student projects (0,1) onto ℝ² using the basis (1,0), (1,1) and the sum-of-projections formula, and gets (0.5,0.5). What went wrong?
Hint
Is the basis orthogonal?
Answer
The basis is not orthogonal, so the formula does not apply. The projection is (0,1).
Full solution
(1,0)⋅(1,1)=1=0. With a non-orthogonal basis the pieces overlap and the sum misses the target. Replacing (1,1) by (0,1), which makes the basis orthogonal, gives (0,0)+(0,1)=(0,1).
Frequently asked questions
What is an orthogonal set?
A set of vectors in which every pair has dot product 0. If the vectors are also unit vectors, the set is orthonormal.
Why are orthogonal bases convenient?
The coordinates of y are c_j = (y · u_j)/(u_j · u_j), one dot product each, with no system of equations to solve.
How do you project a vector onto a subspace?
Take an orthogonal basis u₁, …, u_p of the subspace and add the projections of y onto each: ŷ = Σ (y · u_j)/(u_j · u_j) u_j.
Why is the projection the closest point?
The error y − ŷ is orthogonal to the subspace. For any other point w in it, the Pythagorean theorem gives ‖y − w‖² = ‖y − ŷ‖² + ‖ŷ − w‖², which is larger.
Does the projection formula work with any basis?
No. Adding the projections onto each basis vector gives the projection onto the subspace only when the basis is orthogonal.