Interactive Linear Algebra
Dan Margalit & Joseph Rabinoff · Georgia Tech · Open textbook
Read §6.1 for dot products and §6.3 for orthogonal projection and residual.
Open the sourceLength and angle are extra structure, not part of independence alone.
Prerequisites: 07 · Independence: when a choice adds something, 09 · Rank and the information that disappears
Draw u=(2,1) and the line through b=(1,1) and the origin. Predict the nearest point on that line to u. A right-angle drop gives p=(1.5,1.5), leaving residual (0.5,−0.5). It is not enough merely to land on the line: the error must be perpendicular to it. The MIT projection excerpt begins with this perpendicular error at 0:26. [1]
For vectors a and b in real Euclidean space, the dot product a·b sums their coordinate products; a·a is the square of its Euclidean length. Orthogonality means a·b=0; it is a different question from linear independence. To project a vector v onto the line spanned by a nonzero direction u, write the candidate as cu and require the residual v−cu to be perpendicular to u. Solving u·(v−cu)=0 gives the orthogonal-projection theorem:
The symbol projᵤ(v) is the point on the line nearest to v in Euclidean distance; u·v is a scalar, and u·u is positive because u≠0. The residual is perpendicular because u·(v−projᵤ(v))=0. This perpendicularity proves nearest distance: for any other line point cu, the squared distance is the squared residual length plus the squared distance along the line.
For v=(3,1) and u=(1,2), the dot products are u·v=5 and u·u=5, so the coefficient is 1. The projection is (1,2) and the residual is (2,−1); (1,2)·(2,−1)=0. For the opening sketch, b·(u−p)=(1,1)·(0.5,−0.5)=0.
| Vector to project | Line direction | Projection | Residual | Dot check |
|---|---|---|---|---|
| (2,1) | (1,1) | (1.5,1.5) | (0.5,−0.5) | 0 |
| (3,1) | (1,2) | (1,2) | (2,−1) | 0 |
Counterexample to “every projection is nearest-point projection”: P(x,y)=(x+y,0) lands on the horizontal axis and satisfies P(P(v))=P(v), but P(0,1)=(1,0) is farther from (0,1) than (0,0) is. Its residual is not perpendicular to the axis. With u=(0,0), the displayed line-direction formula divides by zero; projection onto the zero subspace is separately the zero vector.
Use the projection lab’s Initial vectors u=(2,1), b=(1,1) and calculate p=(1.5,1.5). Scale b by 2 and compare p; try Zero direction · invalid, then Nonorthogonal example. Read the residual dot product and distance in the numeric result.
Could two configurations have exactly the same independent sets but different angles?
Project v=(4,3) onto u=(1,2). What is the second coordinate of the projection?
What is the orthogonal projection of v=(3,6) onto the line in direction u=(0,4)?
Derive the coefficient for v=(3,1) and u=(1,2) from the perpendicular-error equation, then compare with the nonorthogonal P(x,y)=(x+y,0).
Dan Margalit & Joseph Rabinoff · Georgia Tech · Open textbook
Read §6.1 for dot products and §6.3 for orthogonal projection and residual.
Open the sourceDeisenroth, Faisal & Ong · Freely readable textbook
Read §§3.2, 3.4 and 3.8, printed pp.72, 76 and 81, for inner products, orthogonality and projections.
Open the sourceGilbert Strang · MIT OpenCourseWare · Lecture excerpt · 0:26–20:00 of 49 min
Start at 0:26. Watch the short core 0:26–4:26; then the longer passage 0:26–20:00.
Open the source