The Least-Squares Line

The least-squares line uses a straight line

Least-Squares Line Related Calculator

to approximate the given set of data, (x1,y1), (x2,y2), ..., (xn,yn), where n>=2. The best fitting curve f(x) has the least square error, i.e.,

Please note that a and b are unknown coefficients while all xi and yi are given. To obtain the least square error, the unknown coefficients a and b must yield zero first derivatives.

Expanding the above equations, we have:

The unknown coefficients a and b can therefore be obtained:

where Sigma stands for Sigma...i.