The closed form: normal equations
Find the bottom of the least-squares bowl in one step — derive the normal equations twice, by calculus and by a right angle, and learn when the famous formula breaks and what libraries do instead.
40 min
After this lesson you can
- Derive by setting the gradient of the squared error to zero
- Derive the same equations geometrically, as an orthogonal projection onto the column space of
- Read every symbol of and check its shapes
- Recognise when is singular or ill-conditioned, and what the pseudoinverse and minimum-norm solution do then
- Explain the cost and why numerical code uses QR or the SVD instead of an inverse
In this lesson
- Setting up
- Derivation 1: set the gradient to zero
- Derivation 2: a right angle
- Decoding (X⊤X)−1X⊤y
- When the formula breaks
- Cost, and what libraries actually do
- In code
This lesson is part of Descent Pro
Descent Pro unlocks every lesson on the route, from base camp to the summit. Every plan starts with a free trial.