Tutorials › Calculus II › Deriving Simpson Weights

Quadrature and Error Bounds · Tutorial 359 of 998

Deriving Simpson Weights

See how integrating a three-point quadratic produces Simpson’s weights, and how adjoining panels create the composite rule.

Intermediate 9 min read

What You'll Learn

  • Construct the quadratic interpolant through three equally spaced data points
  • Integrate its Lagrange basis functions to derive the one-panel weights
  • Explain why the panel formula uses the factor \(h/3\)
  • Combine adjacent panels to obtain the composite Simpson weights
  • Calculate and check one-panel and composite Simpson approximations

From Three Values to Simpson’s Weights

Simpson’s one-third rule estimates an integral using the function values at the two endpoints of an interval and its midpoint. Its weights, \(1,4,1\), are not arbitrary: they result from integrating the quadratic polynomial that passes through those three equally spaced data points.

This derivation also explains why the interval’s full width and the spacing between consecutive data points must not be confused. After deriving the one-panel formula, we will add adjacent panels to see how the composite weights arise.

Setup: Let the three equally spaced nodes be \(a\), \(a+h\), and \(a+2h\), where \(h>0\). The panel has width \(2h\). Write \(f_0=f(a)\), \(f_1=f(a+h)\), and \(f_2=f(a+2h)\).

Build the Quadratic Interpolant

A quadratic interpolant is a polynomial of degree at most two that agrees with \(f\) at the three specified nodes. To make the spacing simple in the algebra, set \(t=(x-a)/h\). Then the three nodes correspond to \(t=0,1,2\).

The Lagrange basis polynomials take value \(1\) at their own node and \(0\) at the other two. For these nodes they are:

$$ L_0(t)=\frac{(t-1)(t-2)}{2},\qquad L_1(t)=-t(t-2),\qquad L_2(t)=\frac{t(t-1)}{2}. $$

For example, \(L_0(0)=1\), while \(L_0(1)=L_0(2)=0\). The corresponding checks for \(L_1\) and \(L_2\) show that each basis polynomial selects its own node. Thus the interpolant is:

$$ p(x)=f_0L_0(t)+f_1L_1(t)+f_2L_2(t), \qquad t=\frac{x-a}{h}. $$

At \(x=a\), \(a+h\), and \(a+2h\), this polynomial takes the respective values \(f_0\), \(f_1\), and \(f_2\). The change of variable gives \(x=a+ht\) and \(dx=h\,dt\), so integrating \(p\) over the panel amounts to integrating its basis polynomials from \(t=0\) to \(t=2\), then multiplying by \(h\).

Deriving the One-Panel Formula

Integrate each basis polynomial. Expanding them first makes every integral visible:

$$ \begin{aligned} \int_0^2 L_0(t)\,dt &=\frac12\int_0^2(t^2-3t+2)\,dt\\ &=\frac12\left[\frac{t^3}{3}-\frac{3t^2}{2}+2t\right]_0^2 =\frac12\left(\frac83-6+4\right)=\frac13,\\[4pt] \int_0^2 L_1(t)\,dt &=\int_0^2(-t^2+2t)\,dt\\ &=\left[-\frac{t^3}{3}+t^2\right]_0^2 =-\frac83+4=\frac43,\\[4pt] \int_0^2 L_2(t)\,dt &=\frac12\int_0^2(t^2-t)\,dt\\ &=\frac12\left[\frac{t^3}{3}-\frac{t^2}{2}\right]_0^2 =\frac12\left(\frac83-2\right)=\frac13. \end{aligned} $$

By linearity of integration, the integral of \(p\) is the sum of the three node values multiplied by their basis integrals. The factor \(h\) comes from \(dx=h\,dt\).

$$ \begin{aligned} \int_a^{a+2h}p(x)\,dx &=h\int_0^2\left(f_0L_0(t)+f_1L_1(t)+f_2L_2(t)\right)\,dt\\ &=h\left(\frac13 f_0+\frac43 f_1+\frac13 f_2\right)\\ &=\frac{h}{3}(f_0+4f_1+f_2). \end{aligned} $$
One-panel Simpson formula: For equally spaced nodes \(a\), \(a+h\), and \(a+2h\), Simpson’s rule replaces the integral of \(f\) over \([a,a+2h]\) with the integral of its quadratic interpolant: $$ \int_a^{a+2h}f(x)\,dx\ \approx\ \frac{h}{3}\bigl(f(a)+4f(a+h)+f(a+2h)\bigr). $$ Here \(h\) is the distance between consecutive nodes, so the panel width is \(2h\).

Worked Example: Integrating a Three-Point Interpolant

Worked Example: Integrating a Three-Point Interpolant

Suppose \(f(0)=1\), \(f(1)=3\), and \(f(2)=2\). Use the quadratic interpolant to estimate the integral from \(0\) to \(2\), and verify the calculation by integrating the interpolant directly.

The node spacing is \(h=1\). The Lagrange basis polynomials in the variable \(x\) are \(L_0(x)=(x-1)(x-2)/2\), \(L_1(x)=-x(x-2)\), and \(L_2(x)=x(x-1)/2\). Therefore:

$$ \begin{aligned} p(x) &=1\cdot\frac{(x-1)(x-2)}{2} +3\cdot\bigl(-x(x-2)\bigr) +2\cdot\frac{x(x-1)}{2}\\ &=\frac{x^2-3x+2}{2}-3x^2+6x+x^2-x\\ &=-\frac32x^2+\frac72x+1. \end{aligned} $$

Integrating this polynomial gives:

$$ \begin{aligned} \int_0^2p(x)\,dx &=\left[-\frac12x^3+\frac74x^2+x\right]_0^2\\ &=-4+7+2=5. \end{aligned} $$

Now use the derived weights. They give \(\frac{1}{3}(1+4(3)+2)=\frac{15}{3}=5\), the same result. As a final check, \(p(0)=1\), \(p(1)=-\frac32+\frac72+1=3\), and \(p(2)=-6+7+1=2\), so the polynomial does interpolate all three supplied values.

Why the Composite Weights Alternate

To form the composite rule, divide an interval \([a,b]\) into an even number \(n=2m\) of equal subintervals. Let \(h=(b-a)/n\), and label the nodes \(x_i=a+ih\) for \(i=0,1,\ldots,n\). Apply the one-panel formula to each pair of subintervals: the first panel uses nodes \(x_0,x_1,x_2\), the next uses \(x_2,x_3,x_4\), and so on.

For panel \(k\), where \(k=0,1,\ldots,m-1\), the one-panel contribution is:

$$ \frac{h}{3}\bigl(f(x_{2k})+4f(x_{2k+1})+f(x_{2k+2})\bigr). $$

Add these \(m\) contributions. The first and last nodes appear just once, as the outer endpoints. Every odd-indexed interior node is the midpoint of one panel and receives weight \(4\). Every even-indexed interior node is shared by two neighbouring panels; it receives weight \(1\) from each, for a total weight of \(2\). That collection of contributions gives the composite rule:

$$ \int_a^b f(x)\,dx\ \approx\ \frac{h}{3}\left[ f(x_0)+4\sum_{\substack{i=1\\i\ \mathrm{odd}}}^{n-1} f(x_i) +2\sum_{\substack{i=2\\i\ \mathrm{even}}}^{n-2} f(x_i) +f(x_n) \right],\qquad n=2m. $$
Weight pattern: Read from left to right, the node weights are \(1,4,2,4,2,\ldots,4,1\). The factor outside the brackets is \(h/3\), where \(h\) is the spacing between neighbouring nodes.

Worked Example: A Composite Rule for a Quadratic

Worked Example: A Composite Rule for a Quadratic

Use four subintervals to approximate \(\int_0^2 x^2\,dx\) with the composite Simpson rule. Here \(n=4\), so \(h=(2-0)/4=1/2\). The nodes and function values are:

$$ \begin{array}{c|ccccc} x_i&0&\frac12&1&\frac32&2\\ \hline f(x_i)=x_i^2&0&\frac14&1&\frac94&4 \end{array} $$

Apply the weights \(1,4,2,4,1\), and retain the common factor \(h/3=1/6\):

$$ \begin{aligned} S_4 &=\frac16\left(0+4\cdot\frac14+2\cdot1+4\cdot\frac94+4\right)\\ &=\frac16(0+1+2+9+4)\\ &=\frac{16}{6}=\frac83. \end{aligned} $$

Check against direct integration: \(\int_0^2x^2\,dx=[x^3/3]_0^2=8/3\). The approximation agrees with the integral in this case. The arithmetic can also be checked by summing the weighted values inside the brackets, which total \(16\), before multiplying by \(1/6\).

Worked Example: A Composite Estimate for a Nonlinear Function

Worked Example: A Composite Estimate for a Nonlinear Function

Use four subintervals to estimate \(\int_0^2\frac{1}{1+x}\,dx\). The spacing is \(h=1/2\), and the node values are:

$$ \begin{array}{c|ccccc} x_i&0&\frac12&1&\frac32&2\\ \hline f(x_i)=\frac{1}{1+x_i}&1&\frac23&\frac12&\frac25&\frac13 \end{array} $$

Use the composite weights \(1,4,2,4,1\). The result is:

$$ \begin{aligned} S_4 &=\frac16\left(1+4\cdot\frac23+2\cdot\frac12+4\cdot\frac25+\frac13\right)\\ &=\frac16\left(1+\frac83+1+\frac85+\frac13\right)\\ &=\frac16\left(2+3+\frac85\right)\\ &=\frac16\cdot\frac{33}{5} =\frac{11}{10}=1.1. \end{aligned} $$

Check the weighted sum: \(1+8/3+1+8/5+1/3=2+3+8/5=33/5\); multiplying by \(1/6\) gives \(11/10\). For comparison, direct integration gives \(\int_0^2\frac{1}{1+x}\,dx=\ln 3\), approximately \(1.0986\) to four decimal places. This comparison confirms that the rule is an estimate here, not an identity for every function.

A Common Mistake: Using the Panel Width Twice

The panel spans from \(a\) to \(a+2h\), but its nodes are spaced by \(h\). The formula’s factor is \(h/3\), not \((2h)/3\). Substituting the full panel width where the node spacing belongs doubles the result.

For example, take the constant function \(f(x)=1\) on \([0,2]\). The node spacing is \(h=1\), so the correct rule gives:

$$ \frac{1}{3}(1+4\cdot1+1)=\frac63=2. $$

This matches the area of a rectangle of width \(2\) and height \(1\). The incorrect substitution of the panel width \(2\) for \(h\) would give \(\frac{2}{3}(1+4+1)=4\), which fails this simple check. When setting up a panel, identify both quantities explicitly: the full width is \(2h\), and the spacing between consecutive nodes is \(h\).

Why the Derivation Is Useful

The derivation explains what the weights mean: they are the integrals of the interpolating polynomial’s basis functions. This makes the procedure more reliable than memorizing the pattern alone. The one-panel weights come from three nodes, and the composite weights follow by adding the contributions of the panels that share nodes.

It also clarifies what the rule does and does not assert. Each panel uses a quadratic that matches the function at its three nodes; the rule integrates that interpolant. The function itself need not equal the interpolant between the nodes, which is why the resulting integral is generally an approximation.

Check Your Understanding

Answer these questions using the derivation and examples above.

  1. For a panel with node spacing \(h\), what is its full width, and what factor multiplies the weighted node values?
  2. What are the integrals from \(0\) to \(2\) of \(L_0(t)\), \(L_1(t)\), and \(L_2(t)\)?
  3. Why does an interior node with an even index receive weight \(2\) in the composite formula?
  4. Write the composite Simpson weights for \(n=6\) subintervals, from the first node to the last.
  5. For \(f(x)=1\) on a single panel of width \(2h\), use the one-panel rule to verify the panel’s area.