Skip to main content
The new Teacher Workspace is here. Your first 3 assignments are free. Try it →
A colleague sent you $30 off Fiveable. Get the annual plan for $99 →

3.6 Numerical Integration

Updated September 2026Fiveable Content Team
Fiveable

➗Calculus II Unit 3 Review

QR code for Calculus II practice questions

3.6 Numerical Integration

Numerical Integration

Numerical integration gives you practical ways to approximate definite integrals when you can't find an antiderivative (or when one doesn't exist in closed form). These methods break the area under a curve into simpler geometric shapes, then sum those areas to estimate the integral. The key questions are always: how close is the approximation? and how can you make it more accurate?

Midpoint and Trapezoidal Rule Applications

The midpoint rule approximates the integral by building rectangles whose heights are determined by the function value at the midpoint of each subinterval. Because it samples the middle rather than the edges, it often performs surprisingly well.

∫abf(x) dx≈Δx∑i=1nf(xi∗)\int_a^b f(x)\,dx \approx \Delta x \sum_{i=1}^n f(x_i^*)

where Δx=b−an\Delta x = \frac{b-a}{n} and xi∗=xi−1+xi2x_i^* = \frac{x_{i-1} + x_i}{2} is the midpoint of the iith subinterval.

The trapezoidal rule connects function values at the endpoints of each subinterval with straight lines, forming trapezoids instead of rectangles. This captures some of the curve's slope that rectangles miss.

∫abf(x) dx≈Δx2[f(x0)+2f(x1)+2f(x2)+⋯+2f(xn−1)+f(xn)]\int_a^b f(x)\,dx \approx \frac{\Delta x}{2}\left[f(x_0) + 2f(x_1) + 2f(x_2) + \cdots + 2f(x_{n-1}) + f(x_n)\right]

where Δx=b−an\Delta x = \frac{b-a}{n}.

Notice the pattern in the trapezoidal formula: the first and last function values get a coefficient of 1, while every interior point gets a coefficient of 2. This comes from each interior point being shared by two adjacent trapezoids.

Both methods are Riemann sum approximations. They partition [a,b][a,b] into nn equal subintervals and sum the areas of simpler shapes to estimate the total.

Quick example: To approximate ∫01ex dx\int_0^1 e^x\,dx with n=4n = 4, you'd use Δx=0.25\Delta x = 0.25. For the midpoint rule, evaluate exe^x at x=0.125,0.375,0.625,0.875x = 0.125, 0.375, 0.625, 0.875. For the trapezoidal rule, evaluate at x=0,0.25,0.5,0.75,1x = 0, 0.25, 0.5, 0.75, 1 and apply the weighting pattern above.

Error Calculations in Numerical Integration

Once you have an approximation, you need to measure how good it is.

Absolute error is the straightforward difference between the exact value and your approximation:

Ea=∣exact value−approximation∣E_a = |\text{exact value} - \text{approximation}|

For instance, the exact value of ∫01x2 dx=13\int_0^1 x^2\,dx = \frac{1}{3}. If your trapezoidal approximation with n=4n = 4 gives 0.34375, then Ea=∣0.3333...−0.34375∣=0.01042E_a = |0.3333... - 0.34375| = 0.01042.

Relative error expresses that absolute error as a proportion of the true value, which is more useful for comparing accuracy across different problems:

Er=∣exact value−approximation∣∣exact value∣E_r = \frac{|\text{exact value} - \text{approximation}|}{|\text{exact value}|}

In the example above, Er=0.010420.3333≈0.03125E_r = \frac{0.01042}{0.3333} \approx 0.03125, or about 3.1%.

Midpoint and trapezoidal rule applications, The Midpoint and Trapezoidal Rules | Calculus II

Error-Bound Formulas

You won't always know the exact value (that's the whole point of numerical integration). Error-bound formulas give you a guaranteed upper limit on the error without needing the exact answer.

  • Midpoint rule error bound:

∣EM∣≤K(b−a)324n2|E_M| \leq \frac{K(b-a)^3}{24n^2}

  • Trapezoidal rule error bound:

∣ET∣≤K(b−a)312n2|E_T| \leq \frac{K(b-a)^3}{12n^2}

In both formulas, KK is the maximum value of ∣f′′(x)∣|f''(x)| on [a,b][a,b].

A few things to notice here:

  • The midpoint bound has 24 in the denominator while the trapezoidal bound has 12. This means the midpoint rule's error bound is actually half that of the trapezoidal rule for the same nn. The midpoint rule is often more accurate than it looks.
  • Both errors shrink proportionally to 1n2\frac{1}{n^2}. Doubling nn cuts the maximum error by a factor of 4.
  • Finding KK requires you to compute f′′(x)f''(x), then find its maximum absolute value on [a,b][a,b]. You can often use calculus techniques or just evaluate ∣f′′(x)∣|f''(x)| at the endpoints and any critical points.

Over- vs. Underestimation

The concavity of ff determines whether each method overshoots or undershoots the true value. This is worth memorizing because it comes up on exams constantly.

ConcavityMidpoint RuleTrapezoidal Rule
Concave up (f′′(x)>0f''(x) > 0)UnderestimatesOverestimates
Concave down (f′′(x)<0f''(x) < 0)OverestimatesUnderestimates

Why this happens: When a curve is concave up, it bends upward like a bowl. Trapezoids connect the endpoints of each subinterval with a straight chord, and that chord sits above the curve, so trapezoids include extra area. A midpoint rectangle has the same area as the trapezoid under the tangent line at the midpoint, and that tangent line sits below a concave up curve, so midpoint rectangles miss area.

The pattern flips for concave down. If the function changes concavity on the interval, the over- and underestimation effects partially cancel, and you can't make a clean prediction about which direction the error goes.

Midpoint and trapezoidal rule applications, Midpoint method - Wikipedia

Simpson's Rule for Definite Integrals

Simpson's rule takes accuracy a step further by fitting parabolas (not lines or flat tops) through consecutive groups of three points. Because parabolas can match curvature, this method is significantly more precise.

∫abf(x) dx≈Δx3[f(x0)+4f(x1)+2f(x2)+4f(x3)+⋯+2f(xn−2)+4f(xn−1)+f(xn)]\int_a^b f(x)\,dx \approx \frac{\Delta x}{3}\left[f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + \cdots + 2f(x_{n-2}) + 4f(x_{n-1}) + f(x_n)\right]

where Δx=b−an\Delta x = \frac{b-a}{n} and nn must be even.

The coefficient pattern is: 1, 4, 2, 4, 2, ..., 4, 2, 4, 1. The alternating 4s and 2s come from how adjacent parabolic segments share points.

Simpson's rule error bound:

∣ES∣≤K(b−a)5180n4|E_S| \leq \frac{K(b-a)^5}{180n^4}

where KK is the maximum value of ∣f(4)(x)∣|f^{(4)}(x)| on [a,b][a,b]. Note that this uses the fourth derivative, not the second.

The error decreases as 1n4\frac{1}{n^4}, which is dramatically faster than the 1n2\frac{1}{n^2} rate of the midpoint and trapezoidal rules. Doubling nn cuts the error by a factor of 16.

A remarkable consequence: Simpson's rule gives exact results for any polynomial of degree 3 or less, because the fourth derivative of such polynomials is zero, making K=0K = 0.

Finding nn for a specified accuracy:

  1. Compute f(4)(x)f^{(4)}(x) and find its maximum absolute value KK on [a,b][a,b].
  2. Set the error bound less than your desired tolerance: K(b−a)5180n4<ϵ\frac{K(b-a)^5}{180n^4} < \epsilon.
  3. Solve for nn: n>(K(b−a)5180ϵ)1/4n > \left(\frac{K(b-a)^5}{180\epsilon}\right)^{1/4}.
  4. Round nn up to the next even integer (since Simpson's rule requires even nn).

Advanced Numerical Integration Techniques

  • Composite rules are what you've already been using: applying the midpoint, trapezoidal, or Simpson's rule across many subintervals and summing the results. The formulas above are all composite versions of their respective rules.
  • Gaussian quadrature methods choose evaluation points and weights strategically (not equally spaced) to achieve higher accuracy with fewer function evaluations. These are common in engineering and scientific computing.
  • Adaptive quadrature algorithms automatically use more subintervals where the function changes rapidly and fewer where it's smooth, optimizing the tradeoff between accuracy and computation.

See Fiveable more often in Google

Mark Fiveable as a preferred source and Google is more likely to show you our guides in Top Stories, with a "preferred" badge in AI Mode and AI Overviews.

Prefer us on Google