Least squares
Gist
The method for finding the best fit line in Linear regression
Calculus-derived
Imagine the simplest case:
and let us define the residuals (
The sum of squared errors is then:
If we want to minimize the SSE, we should then find the derivative in respect to
And if you set it to 0 and solve for
and
Linear algebra- derived
If we look at Multiple regression regression in matrix form