Reference: Least Squares entry of the Wikipedia.
Our function is
where {fj(x)} are a basis of linear independent functions: {1,x,x2,x3,...,xm} and {cj } are the coefficients.
The objective is to minimize the sum:
.
To this end, we have to differentiate with respect to ci , and equate to zero:
Obtaining the follow system:
where (a,b)d are defined as:
.