LINEAR-ALGEBRA ยท Unit 15 ยท Video 2 ยท Interactive Practice
| Formula | Name | Description |
|---|---|---|
| Best-fit line | Intercept , slope | |
| Total squared error | Sum of squared residuals | |
| Normal equations | Solve for best-fit parameters | |
| Orthogonality | Error is perpendicular to column space |
The best fit for , , is the line whose squared residuals โ drawn as literal squares โ have the least total area.
๐ก The line where that total area bottoms out is exactly the solution of the normal equations .
Three ways to total the residuals as the slope varies โ but only squaring gives a smooth curve with a single, calculus-findable minimum.
๐ก Setting the squared curve's slope to zero, , is a linear equation โ exactly what encodes.
One rogue point can tilt the whole fit, because squaring magnifies its single large error.
๐ก Robust fits (least absolute deviations, Huber loss) blunt this by not squaring large errors โ so always plot your data before trusting a formula.
Question 1
For data points , , , the system uses:
What is ?
โ Correct! Top-left = sum of ones = 3, off-diagonal = sum of t-values = 6, bottom-right = sum of tยฒ = 1 + 4 + 9 = 14.
โ Not quite. Each entry of A^T A is a dot product of columns of A. Try computing the bottom-right entry: 1ยฒ + 2ยฒ + 3ยฒ = ?
Solution:
Multiply row by column:
Question 2
The normal equations for the same data reduce to:
Solving by elimination, what is the least-squares best-fit line ?
โ Correct! The best-fit line is , with intercept and slope .
โ Not quite. Try elimination: multiply the first equation by 2, then subtract from the second to isolate D.
Solution:
From the normal equations:
Step 1: Multiply by 2:
Step 2: Subtract from : , so , giving .
Step 3: Back-substitute into : , so .
Question 3
True or False: The calculus approach (setting and ) yields different equations than the linear algebra normal equations .
โ Correct! Both methods produce the same normal equations. Two roads, one destination โ because both minimize the same quadratic objective.
โ Not quite. Both methods are minimizing the same thing โ the total squared error. Think about whether the same objective function can lead to different optimality conditions.
Answer: False โ both approaches give exactly the same equations.
Calculus route: Expand , then set and . After simplification:
Linear algebra route: Compute directly:
These are identical. The deep reason: differentiating a squared linear expression always produces a linear equation โ exactly what encodes.
Question 4
A least-squares fit includes three well-behaved points with errors of about 1 unit each, plus one outlier with an error of 8 units. Approximately what fraction of the total squared error comes from the outlier alone?
โ Correct! Since 8ยฒ = 64 dwarfs 3 ร 1ยฒ = 3, the outlier alone accounts for roughly 96% of the total squared error.
โ Not quite. Remember to square each error before comparing. The outlier contributes 8ยฒ = 64, while the three good points together contribute only 3.
Solution: About 96%.
Compute squared errors:
Outlier's share:
Squaring amplifies large errors disproportionately. The outlier contributes about 96% of the total despite being only one of four data points. This is why one extreme value can dominate the entire least-squares fit.
Solved: 0 / 4