I must find the simpson's rule by integrating the interpolant polynomial P_2(x) of f(x). The simpson's rule states that \int_{a}^{b} f(x) dx \approx \int_{a}^{b} P_2(x) dx = \frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right].
I have some data : x_0=a, x_1=(a+b)/2 and x_2=b.
Therefore by a theorem, there exist an unique polynomial of degree < or equal to 2 passing by f(a), f((a+b)/2) and f(b).
I won't write all, but finding the polynomial via Lagrange's form is not so hard. I found P_2(x)=f(a)(\frac{x-(\frac{a+b}{2})}{a-(\frac{a+b}{2})})(\frac{x-b}{a-b})+f(\frac{a+b}{2})(\frac{x-a}{\frac{a+b}{2}-a})(\frac{x-b}{\frac{a+b}{2}-b})-f(b)(\frac{x-a}{b-a})(\frac{x-\frac{a+b}{2}}{b-\frac{a+b}{2}})
Developing the expression, I don't come that close from the simpson's rule. I have a factor 4 in front of f(\frac{a+b}{2}) but it is still multiplied by a complicated expression that I'm not able to get rid of. And in front of f(a) and f(b) I don't have any common factor, but an expression with x^2 and so on. Still can't get rid of this. Can anyone help me finding the simpson's rule?