The Least-Squares mth Degree Polynomials

When using an mth degree polynomial

y=a0+a1x+a2x^2+...+amx^m
Least-Squares Polynomials Related Calculator

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

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

Expanding the above equations, we have

The unknown coefficients a0, a1, a2, ..., and am can hence be obtained by solving the above linear equations.