Introduction
A definite integral can describe accumulated quantity, area, or total change. When an exact antiderivative is unavailable or inconvenient, a quadrature rule uses function values at selected points to estimate the integral.
The composite Simpson rule uses equally spaced points and approximates the function over successive pairs of subintervals. Its weights follow a repeating pattern: the endpoints have weight one, alternate interior points have weight four, and the remaining interior points have weight two. Applying the rule requires an even number of subintervals.
The Grid and the Composite Rule
Let \(f\) be defined on the finite interval \([a,b]\), where \(a<b\), and suppose its values can be evaluated at the grid points. Choose an even positive integer \(n\), so \(n=2m\) for some positive integer \(m\). Divide \([a,b]\) into \(n\) equal subintervals. The step size is \(h=(b-a)/n\), and the grid nodes are \(x_i=a+ih\) for \(i=0,1,\ldots,n\).
The odd-indexed interior nodes receive weight four; the even-indexed interior nodes receive weight two. The two endpoints are included separately, each with weight one. For \(n=2\), there is just one interior node, \(x_1\), and the rule reduces to \(h[f(x_0)+4f(x_1)+f(x_2)]/3\). The even-indexed interior sum is empty in that case.
The rule is designed for a finite interval with equally spaced nodes and an even panel count. It is not the stated composite Simpson rule if the grid has unequal spacing or if \(n\) is odd. In either situation, a different setup or rule is needed.
Why the Weights Alternate
The composite formula comes from applying the one-third Simpson rule over each pair of adjacent subintervals. On the pair from \(x_{2j}\) to \(x_{2j+2}\), that local estimate is \(h[f(x_{2j})+4f(x_{2j+1})+f(x_{2j+2})]/3\). Each pair has width \(2h\), so its midpoint is \(x_{2j+1}\), and the local rule uses the same step \(h\) as the full grid.
Adding these local estimates explains the composite weights. The endpoint nodes \(x_0\) and \(x_n\) occur in only one pair. Each odd-indexed node is the midpoint of one pair and receives coefficient four. Every even-indexed interior node is an endpoint of two neighboring pairs, so its two coefficients of one combine to give two. This is why the weights alternate rather than assigning the same coefficient to every interior node.
Choose an even \(n\), calculate \(h=(b-a)/n\), and list the nodes \(x_i=a+ih\).
Find \(f(x_i)\) at every node, keeping exact values as long as practical.
Add the endpoints, four times the odd-indexed interior values, and twice the even-indexed interior values.
Multiply the weighted sum by \(h/3\), then round only the final result and state the precision.
Worked Examples
Worked Example: A Two-Subinterval Estimate
Approximate \(\int_0^1 x^4\,dx\) with the composite Simpson rule using \(n=2\) subintervals.
First calculate the step size and nodes:
The function values are
For \(n=2\), the only interior point is odd-indexed, so it receives weight four:
The exact integral is \(1/5=0.2\), since an antiderivative is \(x^5/5\). Thus this estimate is not the exact integral: its difference from the exact value is \(5/24-1/5=(25-24)/120=1/120\). The computation is also checked directly by substituting the three function values into the \(n=2\) rule.
Worked Example: Four Subintervals on a Rational Function
Approximate \(\int_0^1 \frac{1}{1+x}\,dx\) using \(n=4\).
The grid spacing is \(h=(1-0)/4=1/4\), with nodes \(0,1/4,1/2,3/4,1\). Evaluating \(f(x)=1/(1+x)\) gives
The odd-indexed interior values are \(4/5\) and \(4/7\); the even-indexed interior value is \(2/3\). Therefore
The integral itself is \(\ln 2\), approximately \(0.693147181\), so the estimate is about \(0.000106787\) larger. The weighted sum and the final factor \(1/12\) reproduce \(1747/2520\), checking the calculation.
Worked Example: A Wider Interval with Four Subintervals
Approximate \(\int_0^2 \frac{1}{1+x^2}\,dx\) using \(n=4\).
Here \(h=(2-0)/4=1/2\), and the nodes are \(0,1/2,1,3/2,2\). The corresponding function values are
Use weight four on \(x_1,x_3\), weight two on \(x_2\), and weight one on the endpoints:
As a check, the exact integral is \(\arctan(2)-\arctan(0)=\arctan(2)\), approximately \(1.107148718\). The Simpson estimate is about \(0.002020513\) smaller. Substituting the listed node values into the formula gives the same exact fraction \(431/390\).
A Common Weighting Error
A frequent mistake is to give every interior node weight four. The four-subinterval example with \(f(x)=1/(1+x)\) makes the error visible. If all three interior values were given weight four, the calculation would be
That is not the composite Simpson estimate. The middle interior node \(x_2\) has even index, so it must have weight two, not four. Correcting that coefficient subtracts \((4-2)(2/3)\) from the bracket; after multiplication by \(1/12\), the estimate decreases by \(1/9=280/2520\). Thus the corrected result is \(2027/2520-280/2520=1747/2520\), matching the full calculation above.
Using the Rule Reliably
Before calculating, verify that the interval is finite, the nodes are equally spaced, and the number of subintervals is even. Then check the indexing: with \(n+1\) nodes, the endpoints are \(x_0\) and \(x_n\), while the interior indices run from \(1\) to \(n-1\). The parity of the index, not the value of the function, determines whether an interior value receives weight four or two.
Keep fractions or exact function values through the weighted sum when possible. This reduces avoidable rounding error and makes it easier to find arithmetic mistakes. If decimal values are needed, calculate with adequate precision and round only the final estimate. The rule supplies a numerical approximation; it does not by itself state how large the error is. An error bound requires additional information about the function and is a separate question.
The method is useful because it replaces an integral by a finite, organized combination of function evaluations. The paired-subinterval structure is especially important: it explains both the alternating weights and the even-panel requirement. Once the grid and weights are set correctly, the calculation is a repeatable process rather than a guess about which values to emphasize.
Check Your Understanding
Use the definitions and weighting pattern to answer the following questions.
- For \([a,b]=[2,5]\) and \(n=6\), what are \(h\) and the general formula for the nodes \(x_i\)?
- For \(n=6\), which interior indices receive weight four, and which receive weight two?
- Why does an even-indexed interior node receive weight two when the local estimates over adjacent pairs are added?
- What is the specific weighting error in the pattern \(1,4,4,4,1\) for four subintervals?
- Can the stated composite Simpson rule be applied unchanged to five equally spaced subintervals? Explain which condition fails.