I have the following data, representing the values of a function at given points:
$f(1)=0$
$f(2)=5$
$f(3)=12$
$f(4)=21$
$f(5)=32$
I want to know the exact quadratic equation which was used above to get values of $f(x)$. How can I get to know it?
I remember that, at school, we used Newton's interpolation and backward/forward interpolation formula. But all I see on the internet regarding the above methods is that we can find $f(x)$ for any $x$ given the above table, eg. we can find $f(4.5)$ by using above table. However I need to trace the original quadratic formula: is there any way to do so? (The answer should be $f(x)=x^2+2x-3$.)
We can use Lagrange Interpolation as mentioned in the comments by @lulu.
First, we find the Lagrange Polynomials for the five points:
$$L_0(x) = \dfrac {(x - x_1) (x - x_2) (x-x _3) (x - x_4)} {(x_0 - x_1 ) (x_0 - x_2)(x_0 - x_3) (x_ 0 -x_4)} \\ L_1(x) = \dfrac {(x - x_0) (x - x_2) (x-x _3) (x - x_4)} {(x_1 -x_0 ) (x_1 - x_2)(x_1 - x_3) (x_1 -x_4)} \\ L_2(x) = \dfrac {(x - x_0) (x - x_1) (x-x _3) (x - x_4)} {(x_2 - x_0) (x_2 - x_1)(x_2 - x_3) (x_2 -x_4)}\\ L_3(x) = \dfrac {(x - x_0) (x - x_1) (x-x _2) (x - x_4)} {(x_3 - x_0 ) (x_3 - x_1)(x_3 - x_2) (x_3 -x_4)} \\ L_4(x) = \dfrac {(x - x_0) (x - x_1) (x-x _2) (x - x_3)} {(x_4 - x_0 ) (x_4- x_1)(x_4 - x_2) (x_4 -x_3)}$$
The final result is given by
$$f(x) = f(x_0) L_0(x) + f(x_1) L_1(x) + f(x_2) L_2(x) + f(x_3) L_3(x) + f(x_4) L_4(x) = x^2+2 x-3$$
We can verify that $f(x)$ produces $$f(1)=0, f(2)=5, f(3)=12, f(4)=21, f(5)=32$$