I must find the simpson's rule by integrating the interpolant polynomial $\displaystyle P_2(x)$ of $\displaystyle f(x)$. The simpson's rule states that $\displaystyle \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 : $\displaystyle x_0=a$, $\displaystyle x_1=(a+b)/2$ and $\displaystyle x_2=b$.
Therefore by a theorem, there exist an unique polynomial of degree $\displaystyle <$ or equal to 2 passing by $\displaystyle 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 $\displaystyle 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 $\displaystyle 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 $\displaystyle x^2$ and so on. Still can't get rid of this. Can anyone help me finding the simpson's rule?