# The quadrature weights for the trapezoid and the Simpsons rule

How to derive the quadrature weights for the trapezoid and the Simpsons rule?

Trapeziod rule:$\int\limits_a^b f(x)$$\approx$$\frac{b-a}{2}$[f(a)+f(b)]

Simpson's rule:$\int\limits_a^b f(x)$$\approx$$\frac{b-a}{6}$[f(a)+4f((a+b)/2)+f(b)]

I know the definition of the quadrature weights is $\omega_i$=$\int\limits_a^b$ $l_i$(x) dx, but still have no idea to do this question.

The Trapezoid and Simpson's rules are Newton-Cotes formulae. Derivation of the weights come from integrating Lagrange basis polynomials. Let $L(x)$ be a lagrange polynomial which interpolates $f(x)$ at $n+1$ points, $x_0, x_1, ... x_n$. Then

$$\int_a^b f(x) dx \approx \int_a^b L(x) dx = \int_a^b \sum_{i=0}^n f(x_i) l_i (x) dx = \sum_{i = 0}^n f(x_i)\int_a^b l_i (x) dx,$$ and here $\int_{a}^b l_i (x) dx$ is the weight for the $i$-th interpolation point.

The trapezoid rule comes from interpolating $f(x)$ using 2 points. Simpson's rule comes from interpolating $f(x)$ using 3 points.
• The points $x_j$, must be equally spaced. To get equally spaced points, use the formula $x_j = h*j + a$, where $h$ is the step size with the formula $h = (b - a)/n$. Try doing this with $j = 0, j = 1, n =1$ to get the interpolation points for the trapezoidal rule. You should just get $x_0 = a$ and $x_1 = b$, which are just the endpoints. This is why the Trapezoid-rule formula has $\sum_{i = 0}^{n} f(x_i) = f(a) + f(b)$. – amarney Mar 21 '17 at 15:00
• Just change $n = 2$ and do a similar calculation to get the $x_j$. Since you have the formula for Simpson's rule already, you can just look to see what the equally spaced points are. Also, way you have written Simpson's rule is incorrect. you should have $f(\frac{a+b}{2})$, not $\frac{f(a+b)}{2}$. – amarney Mar 21 '17 at 15:15
• @user5555, what you describe in your answer is the case for any quadrature of interpolatory type, not only for Newton-Cotes formulae. I recall that the $n$-point quadrature rule is interpolatory if it is exact on polynomials of degree $\le n-1$. The nice book for this topic is Brass, Petras, "Quadretyre theory". – szw1710 Mar 21 '17 at 21:27