A general method for fitting n-coordinates to an equation of degree n-1:
1) Find a function f(x) which fits all the given points from {x1, y1} to {x(n-1), y(n-1)}:
This means starting with 2 points and fitting them to an equation of degree 1 in the form y=ax+b. We then move up to fitting 3 points to a quadratic (using the following method) and so on until we reach the points {x(n-1), y(n-1)}, for which we have fitted a polynomial f(x) of degree n-2.
2) Find a function g(x), for which g(x)=0 when x=x1, x2, …, x(n-1):
This will be a polynomial of degree n-1, which we will next add to f(x) in order to form our ‘foundation’; an equation which is of the right degree and which we may modify to meet other points without moving it away from the points it already covers. g(x) will be equal to (x-x1)(x-x2)(x-x3)…(x-x(n-1)).
3) Define a function h(x) which equals f(x)+g(x):
This is our ‘foundation’ made.
4) Calculate a value d for which d=y(n)-h(x(n)):
This value of d is the amount by which our foundation equation misses the final point {x(n), y(n)}. We will use this value to create another equation that hits this point yet still goes through each of the others.
5) Solve ag(xn)=d, thereby calculating a value for a. Define the new polynomial I(x) as ag(x):
By multiplying g(x) by a constant a, we can modify it to make up the difference d whilst keeping it equal to zero at each of the covered points.
I(x)= zero at all previous points
= x(n) at y(n), so fits the point {x(n), y(n)}
h(x)= fits all of the previous points
6) We may therefore add I(x) and h(x) to gain our equation which fits each of the points:
j(x)= h(x) + I(x)
(PS. I went to the Experience Cambridge Mathematics day last month, it was brilliant. Cheers for introducing me to the site, it's got some great problems to help me improve my problem solving before going onto STEP hopefully next year!)