Lesson 3.3 · 15 of 25 lessons
Least squares
Carry the right angle created by a dot product into projection and least-squares error.
Open the interactive animation01 · Story
What to verify in this scene
Follow the explanations and operations, then identify the mathematical evidence that remains in the final scene.
- 01
When target b is not on direction a, choose its closest shadow p
- 02
Add residual e to p to reconstruct the original target b
- 03
dot(a, e) = 0
A least-squares residual is orthogonal to the chosen subspace
02 · Notebook
The runnable notebook
This source creates the mathematical objects and controls the order of operations and animation. Read it here, then play the same scene yourself.
2d
zoom 4/5
coordinates on
2, 1 #a@
point(2, 3) #b@
14/5, 7/5 #p@
// When target {{b}} is not on direction {{a}}, choose its closest shadow {{p}}
focus a p b
checkpoint Least squares
focus -
-4/5, 8/5 #e@
// Add residual {{e}} to {{p}} to reconstruct the original target {{b}}
sum(p, e) #rebuild@
dot(a, e) #ortho@
// `dot({{a}}, {{e}}) = 0`\nA least-squares residual is **orthogonal** to the chosen subspace
focus a e
Open the interactive animation
03 · Unit 3
Lessons in this unit
Orthogonality, projection & least squares — Carry the right angle created by a dot product into projection and least-squares error.