Newton polynomial interpolation error

I am trying to use Newtons algorithm for polynomial interpolation. The original polynomial is $$p(x) = 3x^2+4x+7$$ and the Points from which I am trying to interpolate the polynomial are $$p(1) = 14$$, $$p(6) = 139$$ and $$p(7) = 182$$.

Now as far as I know the formula for the interpolated polynomial should be $$r(x) = a_0+a_1(x-x_0)+a_2(x-x_0)(x-x_1)$$.

To find $$a_0$$ I calculate $$y_0 = 14 = a_0$$. Then, $$y_1 = 139 = a_0 + a_1 (x_1-x_0)=14+a_1(6-1)$$ so by solving for $$a_1$$ the result is $$a_1 = 25$$. At last, $$y_2 = 182 = a_0 + a_1(x_1-x_0)+a_2(x_2-x_0)(x_2-x_1)=14+25(6-1)+a_2(7-1)(7-6)$$ and solving for $$a_2$$ results in $$a_2=\frac{43}{6}$$.

By inserting the found values into the formula I get $$r(x)=14+25(x-1)+\frac{43}{6}(x-1)(x-6)=\frac{43}{6}x^2-\frac{151}{6}x+32$$.

This polynomial doesn't go though the last point though: $$r(7)=\frac{43}{6}\cdot49-\frac{151}{6}\cdot7+32=207 \ne 182=p(7)$$.

Am I doing something wrong or does this usually happen with this algorithm?

• You must have made a calculation mistake since the interpolation of degree $n$ of a polynomial of degree $n$ should always be the original polynomial – Maximilian Janisch Aug 26 at 14:37

At your calculation of $$a_2$$ you substituted the value of $$x_1$$ for $$x$$ instead of $$x_2$$, which should have caused the error.
At last, $$y_2 = 182 = a_0 + a_1(x_1-x_0)+a_2(x_2-x_0)(x_2-x_1)=14+25(6-1)+a_2(7-1)(7-6)$$ and solving for $$a_2$$ results in $$a_2=\frac{43}{6}$$.
This should have been: $$y_2 = 182 = a_0 + a_1(x_2-x_0)+a_2(x_2-x_0)(x_2-x_1)=14+25(7-1)+a_2(7-1)(7-6)$$ and solving for $$a_2$$ results in $$a_2=3$$.
Note that any interpolating polynomial should be exact in the given points. This is not the case here because you made a calculation mistake for $$a_2$$.
Note that (using notation for divided differences) we have $$a_2=[14,139,182]=\frac{182-139}6-\frac{139-14}{30}=3$$.