IB Mathematics: Analysis and Approaches • Calculus

Numerical Integration — AHL 5.13 Numerical integration techniques (trapezoidal/Simpson) (HL enrichment-to-standard)

Approximate definite integrals when exact antiderivatives are impossible, using trapezoids and parabolas.

IB Mathematics Analysis and Approaches emblem with a function, curved graph, and sigma notation
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

Long before modern computers existed, mathematicians faced a fundamental challenge: many functions simply cannot be integrated using a neat formula. Imagine trying to find the exact area under a curve like f(x) = e−x² — there is no elementary antiderivative for this function, yet scientists and engineers desperately needed its area for applications in probability and statistics. The solution? Approximate the area by breaking the region into simple geometric shapes whose areas are easy to compute.

This idea of numerical integration — estimating definite integrals through approximation — stretches back thousands of years. Ancient Greek mathematicians used methods of exhaustion to estimate areas, and later thinkers refined these ideas into the structured techniques we use today: the trapezoidal rule and Simpson's rule.

~250 BCE • Archimedes' Method of Exhaustion

Archimedes approximated the area of a parabolic segment by inscribing triangles, laying the conceptual groundwork for numerical area estimation.

1670s • Newton & Leibniz Develop Calculus

The invention of calculus provided exact integration methods, but it quickly became clear that many integrals have no closed-form antiderivative.

1743 • Thomas Simpson Publishes His Rule

Thomas Simpson formalized a quadratic approximation technique that uses parabolic arcs to achieve remarkably accurate area estimates — now called Simpson's rule.

1800s • Trapezoidal Rule Becomes Standard

As engineering and physics demanded rapid calculations, the trapezoidal rule became a workhorse for its simplicity, and error analysis helped mathematicians understand when each method is most appropriate.

1950s–Today • Computer-Age Numerical Methods

Modern computers apply these classical rules with millions of subintervals, making numerical integration an essential tool in science, finance, and engineering.

The central question these methods answer is straightforward: How can we accurately estimate the value of a definite integral when we cannot find — or choose not to find — an antiderivative? This is not just an academic exercise; it arises constantly in real-world modeling, from calculating distance traveled using speed data to estimating probabilities under bell curves.

SECTION 2

Core Principles & Definitions

Before diving into formulas, let's establish the key ideas that underpin both the trapezoidal rule and Simpson's rule. Both methods share a common strategy: divide the interval [a, b] into smaller pieces, approximate the curve on each piece with a simple shape, and add up those areas.

1

Subintervals & Strip Width

We divide [a, b] into n equal subintervals, each of width h = (b − a) / n. The more subintervals we use, the better our approximation.
2

Ordinates (y-values)

At each boundary point x₀, x₁, x₂, …, xₙ we evaluate the function to get ordinates y₀, y₁, y₂, …, yₙ. These are the heights used in our approximation.
3

Trapezoidal Approximation

Each strip is approximated by a trapezoid — a shape with a straight line connecting consecutive function values. Simple, but it can miss curvature.
4

Parabolic Approximation (Simpson's)

Simpson's rule fits a parabola through every group of three consecutive points, capturing curvature far better than straight lines.
5

Even Number Requirement

The trapezoidal rule works with any number of subintervals, but Simpson's rule requires an even number of subintervals (n must be even) because it groups strips in pairs.
✦

KEY TAKEAWAY

Think of numerical integration like estimating the area of an irregularly shaped swimming pool. The trapezoidal rule is like laying straight planks across the pool and measuring — it's quick but rough. Simpson's rule is like bending flexible rods into smooth curves across the pool — it follows the shape much more closely. Both work, but the curved approach (Simpson's) is usually more accurate for the same number of measurements.

SECTION 3

Visual Explanation — Trapezoids Under a Curve

Trapezoidal Rule — 4 Subintervalsxf(x)x₀x₁x₂x₃x₄y₀y₁y₂y₃y₄hf(x)Trapezoidapproximation
The curve f(x) (pink) is approximated by four trapezoids (cyan shading). Each trapezoid has a straight-line top connecting consecutive ordinates y₀ through y₄. The strip width h = (b − a)/4 is uniform. Notice the gap between the straight dashed lines and the actual curve — this error decreases as n increases.

In the diagram above, you can see that each trapezoid has two parallel vertical sides (the ordinates yi and yi+1) and a slanted top edge connecting them. The area of a single trapezoid is ½ × h × (yi + yi+1). When the curve is concave up, the trapezoids tend to overestimate the area; when the curve is concave down, they underestimate it. This systematic error is what motivates the more sophisticated Simpson's rule, which fits parabolas instead of straight lines.

SECTION 4

Mathematical Framework

The Trapezoidal Rule

We partition the interval [a, b] into n equal subintervals, each of width h. The endpoints generate n + 1 ordinates. The trapezoidal rule sums the areas of all n trapezoids.

STRIP WIDTH

h=(b−a)/nh = (b − a) / n

where a and b are the limits of integration and n is the number of subintervals.

TRAPEZOIDAL RULE

∫abf(x)dx≈(h/2)(y0+2y1+2y2+…+2yn−1+yn)∫ₐᵇ f(x) dx ≈ (h/2)(y₀ + 2y₁ + 2y₂ + … + 2yₙ₋₁ + yₙ)

The first and last ordinates appear once; all interior ordinates are multiplied by 2. This is the IB formula booklet version.

Simpson's Rule

Simpson's rule takes things a step further by fitting a quadratic (parabolic) curve through each group of three consecutive points. Because a parabola can bend, it follows the actual curve much more faithfully than a straight line. The requirement is that n must be even, since the parabolas are fitted over pairs of subintervals.

SIMPSON'S RULE

∫abf(x)dx≈(h/3)(y0+4y1+2y2+4y3+2y4+…+4yn−1+yn)∫ₐᵇ f(x) dx ≈ (h/3)(y₀ + 4y₁ + 2y₂ + 4y₃ + 2y₄ + … + 4yₙ₋₁ + yₙ)

The coefficients follow the pattern 1, 4, 2, 4, 2, …, 4, 1. The first and last ordinates have coefficient 1, odd-indexed ordinates get 4, and even-indexed interior ordinates get 2. The factor is h/3 rather than h/2.

💡

IB Exam Tip

Both formulas appear in the IB formula booklet. However, you must know when to apply each one and how to set up the table of x- and y-values. Pay close attention to whether the question specifies n (number of subintervals) or n + 1 (number of ordinates), and always double-check that n is even before using Simpson's rule.

SECTION 5

Comparing Trapezoids and Parabolas

Let's visualize the fundamental difference between these two methods side by side. The trapezoidal rule connects consecutive points with straight lines, whereas Simpson's rule fits smooth parabolic arcs through groups of three points. This seemingly small change has a dramatic effect on accuracy.

Trapezoidal RuleSimpson's Rulex₀x₁x₂x₃x₄Straight-line topsx₀x₁x₂x₃x₄Parabolic arcsGap visible ↑Much closer fit ↑
Left: the trapezoidal rule uses straight-line segments (cyan), leaving visible gaps between the approximation and the true curve (pink). Right: Simpson's rule uses parabolic arcs (violet) that hug the curve much more closely, yielding a more accurate area estimate with the same five data points.
FeatureTrapezoidal RuleSimpson's Rule
Shape usedStraight-line segments (linear)Parabolic arcs (quadratic)
Coefficient pattern1, 2, 2, …, 2, 11, 4, 2, 4, …, 4, 1
Multiplierh / 2h / 3
Requirement for nAny positive integerMust be even
Error orderO(h²) — proportional to h²O(h⁴) — proportional to h⁴ (much smaller)
Exact forLinear functionsPolynomials up to degree 3

Key differences between the trapezoidal and Simpson's rules

The error order is particularly important. Saying the trapezoidal rule has error O(h²) means that if you halve the strip width (double the number of subintervals), the error decreases by roughly a factor of 4. For Simpson's rule with error O(h⁴), halving h reduces the error by roughly a factor of 16. This is why Simpson's rule achieves excellent accuracy even with relatively few subintervals.

SECTION 6

Worked Example

Let's estimate ∫₁³ (1/x) dx using both rules with n = 4 subintervals. The exact answer is ln 3 − ln 1 = ln 3 ≈ 1.0986, so we can check our approximations.

Trapezoidal Rule for ∫₁³ (1/x) dx with n = 4

  1. 1

    Step 1 — Calculate the strip width h

    h = (b − a) / n = (3 − 1) / 4 = 2 / 4 = 0.5
    h = 0.5
  2. 2

    Step 2 — Determine the x-values and compute ordinates

    x₀ = 1.0, x₁ = 1.5, x₂ = 2.0, x₃ = 2.5, x₄ = 3.0. Now evaluate f(x) = 1/x at each point: y₀ = 1/1 = 1, y₁ = 1/1.5 = 0.6667, y₂ = 1/2 = 0.5, y₃ = 1/2.5 = 0.4, y₄ = 1/3 ≈ 0.3333.
    Ordinates: 1, 0.6667, 0.5, 0.4, 0.3333
  3. 3

    Step 3 — Apply the trapezoidal rule formula

    T = (h/2)(y₀ + 2y₁ + 2y₂ + 2y₃ + y₄) = (0.5/2)(1 + 2(0.6667) + 2(0.5) + 2(0.4) + 0.3333) = 0.25 × (1 + 1.3334 + 1.0 + 0.8 + 0.3333) = 0.25 × 4.4667.
    T ≈ 1.1167
  4. 4

    Step 4 — Compare to exact value

    The exact value is ln 3 ≈ 1.0986. Our trapezoidal estimate of 1.1167 has an error of about 0.0181, which is roughly 1.6%.
    Error ≈ 1.6% overestimate

Simpson's Rule for ∫₁³ (1/x) dx with n = 4

  1. 1

    Step 1 — Verify n is even and use same h

    n = 4 is even ✓, so Simpson's rule can be applied. We already computed h = 0.5 and all five ordinates in the trapezoidal example.
    h = 0.5, n = 4 ✓
  2. 2

    Step 2 — Apply the coefficient pattern 1, 4, 2, 4, 1

    S = (h/3)(y₀ + 4y₁ + 2y₂ + 4y₃ + y₄) = (0.5/3)(1 + 4(0.6667) + 2(0.5) + 4(0.4) + 0.3333) = (0.1667)(1 + 2.6668 + 1.0 + 1.6 + 0.3333) = (0.1667)(6.6001).
    S ≈ 1.1000
  3. 3

    Step 3 — Compare to exact value

    The exact value is ln 3 ≈ 1.0986. Simpson's estimate of 1.1000 has an error of about 0.0014, which is roughly 0.13%. This is more than 10 times more accurate than the trapezoidal rule with the same number of subintervals!
    Error ≈ 0.13% overestimate

SECTION 7

Strengths, Limitations & When to Use Each

Both methods are powerful, but each has situations where it shines and situations where it struggles. Understanding these trade-offs is essential for making good choices on exams and in real applications.

ConsiderationTrapezoidal RuleSimpson's Rule
StrengthsWorks with any n; simple to apply; easy to remember (coefficient pattern 1, 2, 2, …, 2, 1)Much higher accuracy for the same n; exact for polynomials up to degree 3; coefficient pattern (1, 4, 2, …) is still manageable
LimitationsLarger error for curved functions; tends to overshoot on concave-up curves and undershoot on concave-down curvesRequires n to be even; slightly more complex arithmetic; coefficient errors can cascade in hand calculations
Best used whenData comes from experiments (odd number of points allowed); a quick rough estimate is neededHigh accuracy is required; the function is smooth; n can be chosen freely (pick an even number)
IB exam frequencyVery common in Paper 2; often with data in a tableCommon in HL papers; sometimes compared with the trapezoidal rule in the same question

Strengths, limitations, and exam relevance

✦

KEY TAKEAWAY

If you're asked to choose a method and can pick n freely, almost always go with Simpson's rule because its error shrinks much faster as you add more subintervals. Think of it like upgrading from a ruler to a French curve — both measure a shape, but the flexible tool captures bends that the straight one misses.

SECTION 8

Connection to Riemann Sums & Beyond

You may have already encountered Riemann sums — left-endpoint, right-endpoint, and midpoint approximations — which use rectangles to estimate area. The trapezoidal rule can be viewed as the average of the left and right Riemann sums, which is why it's generally more accurate than either one alone. Simpson's rule goes further by being equivalent to a weighted combination of the midpoint and trapezoidal estimates.

MethodShapeError OrderIB Level
Left / Right Riemann SumRectangleO(h)SL & HL (conceptual)
Midpoint RuleRectangle (midpoint height)O(h²)Supplementary
Trapezoidal RuleTrapezoidO(h²)AHL 5.13
Simpson's RuleParabolic arcO(h⁴)AHL 5.13 (HL enrichment)
Gaussian QuadratureOptimal polynomial nodesO(h²ⁿ)University level

Hierarchy of numerical integration methods

At university, you'll encounter even more powerful techniques such as Gaussian quadrature and adaptive methods that automatically concentrate subintervals where the function changes most rapidly. For now, mastering the trapezoidal and Simpson's rules gives you a solid foundation in the core idea: replace a hard integral with a sum of areas under simple shapes. This principle never changes, no matter how sophisticated the method becomes.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain why Simpson's rule requires an even number of subintervals, while the trapezoidal rule does not. What geometric feature of Simpson's rule creates this requirement?
Show answer
Simpson's rule fits a parabola through every group of three consecutive points. Because each parabola spans two subintervals, the subintervals must come in pairs, which forces n to be even. For example, with n = 4, the first parabola passes through (x₀, y₀), (x₁, y₁), (x₂, y₂), and the second through (x₂, y₂), (x₃, y₃), (x₄, y₄). The trapezoidal rule, by contrast, fits independent straight lines on each single subinterval, so any positive integer n works.

Question 2: BASIC CALCULATION

Use the trapezoidal rule with n = 4 to estimate ∫₀² x² dx. Compare your answer with the exact value.
Show answer
First, h = (2 − 0)/4 = 0.5. The x-values are 0, 0.5, 1.0, 1.5, 2.0 with corresponding y-values 0, 0.25, 1, 2.25, 4. Applying the formula: T = (0.5/2)(0 + 2(0.25) + 2(1) + 2(2.25) + 4) = 0.25 × (0 + 0.5 + 2 + 4.5 + 4) = 0.25 × 11 = 2.75. The exact value is [x³/3]₀² = 8/3 ≈ 2.6667. The trapezoidal estimate overestimates by about 0.0833, or roughly 3.1%, because x² is concave up on this interval.

Question 3: INTERMEDIATE

Use Simpson's rule with n = 4 to estimate ∫₀² x² dx. How does the accuracy compare to the trapezoidal result from Problem 2?
Show answer
Using the same h = 0.5 and the same ordinates (0, 0.25, 1, 2.25, 4), apply Simpson's formula: S = (0.5/3)(0 + 4(0.25) + 2(1) + 4(2.25) + 4) = (0.1667)(0 + 1 + 2 + 9 + 4) = (0.1667)(16) = 2.6667. This equals 8/3 exactly! Simpson's rule gives the exact answer because x² is a polynomial of degree 2, and Simpson's rule is exact for polynomials up to degree 3. The trapezoidal rule had a 3.1% error; Simpson's rule has 0% error — a dramatic improvement.

Question 4: APPLIED

A car's velocity (in m/s) is recorded every 2 seconds: t = 0, 2, 4, 6, 8 with velocities v = 0, 5, 12, 18, 20. Use Simpson's rule to estimate the total distance traveled over 8 seconds.
Show answer
Distance equals ∫₀⁸ v(t) dt. Here n = 4 (even ✓) and h = 2. The ordinates are y₀ = 0, y₁ = 5, y₂ = 12, y₃ = 18, y₄ = 20. Applying Simpson's rule: S = (2/3)(0 + 4(5) + 2(12) + 4(18) + 20) = (0.6667)(0 + 20 + 24 + 72 + 20) = (0.6667)(136) ≈ 90.67 metres. This parabolic approximation captures the acceleration and deceleration phases of the car's motion better than the trapezoidal rule, which would give T = (2/2)(0 + 2(5) + 2(12) + 2(18) + 20) = 1 × 90 = 90 metres.

Question 5: CRITICAL THINKING

A student applies the trapezoidal rule to ∫₀π sin x dx with n = 2 and gets an answer of approximately 1.5708. The exact value is 2. (a) Why does the trapezoidal rule underestimate here? (b) If the student doubles n to 4, would you expect the error to be reduced by a factor of approximately 2 or 4? Justify your answer.
Show answer
(a) On [0, π], sin x is concave down (its second derivative −sin x is negative). When a curve bends downward, the straight-line tops of the trapezoids lie below the curve, so the trapezoids miss area above them. This is why the estimate of 1.5708 is less than 2. (b) The trapezoidal rule has error proportional to h². Doubling n halves h, so the error should decrease by a factor of h² → (h/2)² = h²/4 — that is, the error drops by a factor of approximately 4, not 2. With n = 4, the new estimate would be about 1.8961, and the error (≈ 0.104) is indeed roughly one-quarter of the original error (≈ 0.429). This illustrates the O(h²) convergence rate of the trapezoidal rule.

SUMMARY

Lesson Summary

Summary

Numerical integration allows us to estimate definite integrals when no elementary antiderivative exists — or when data comes from measurements rather than a formula. The trapezoidal rule divides [a, b] into n subintervals of width h = (b − a)/n and approximates the curve with straight-line segments, using the coefficient pattern 1, 2, 2, …, 2, 1 multiplied by h/2. It works for any n and has error of order O(h²).

Simpson's rule fits parabolic arcs through groups of three points, using the coefficient pattern 1, 4, 2, 4, …, 4, 1 multiplied by h/3. It requires n to be even and achieves error of order O(h⁴), making it significantly more accurate for smooth functions. Both methods build on the same fundamental idea — replace a complex curve with simple geometric shapes and sum their areas — and both are indispensable tools in applied mathematics, science, and engineering.

Varsity Tutors • IB Mathematics: Analysis and Approaches • Numerical Integration — AHL 5.13