01 / 20

Numerical
Integration

Learn how to approximate definite integrals using the trapezoidal rule when an exact antiderivative is difficult or impossible to find.

IB Math: Applications & Interpretation

What Is a Definite Integral?

A definite integral \(\displaystyle\int_a^b f(x)\,dx\) gives the exact area between the curve \(y = f(x)\), the \(x\)-axis, and the vertical lines \(x = a\) and \(x = b\).

a b x y Area

Why Do We Need Numerical Methods?

Many real-world functions cannot be integrated analytically. The antiderivative either doesn't exist in closed form or is extremely complex.

\(e^{-x^2}\)
The Gaussian function: no elementary antiderivative exists, yet it's vital in statistics.
Real Data
Measured data (speed, temperature) comes as points, not formulas: we need approximation.
Technology
Your GDC uses numerical integration behind the scenes every time you evaluate an integral.

The Big Idea: Rectangles and Trapezoids

We can approximate the area under a curve by slicing it into simple shapes whose areas we can compute exactly.

h h h h Trapezoids

The Trapezoidal Rule

Notice the pattern: the first and last function values appear once, while all interior values are doubled. This comes from each interior point being shared by two adjacent trapezoids.

Anatomy of a Single Trapezoid

\(f(x_i)\)
\(f(x_{i+1})\)
\(h\)
\(x_i\)
\(x_{i+1}\)

Trapezoids vs Rectangles

Trapezoidal Rule Rectangle (Riemann) Sums
Shape Trapezoid (slanted top) Rectangle (flat top)
Top edge Straight line connecting endpoints Horizontal line at one endpoint
Accuracy Generally better Depends on left/right/midpoint choice
IB Focus SL 5.6 tested Conceptual understanding

How to Apply the Trapezoidal Rule

1
Identify \(a\), \(b\), and \(n\). These are the lower limit, upper limit, and number of strips.
2
Calculate \(h = \dfrac{b - a}{n}\). This is the width of each strip.
3
List the \(x\)-values: \(x_0 = a,\; x_1 = a + h,\; x_2 = a + 2h, \ldots, x_n = b\).
4
Evaluate \(f(x_i)\) at each \(x\)-value (use your GDC if needed).
5
Substitute into the formula: \(\dfrac{h}{2}[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)]\).

Example 1: \(\displaystyle\int_0^1 x^2\,dx\) with \(n = 4\)

0 0.25 0.5 0.75 1 0 0.5 1 x y
1
\(a = 0,\; b = 1,\; n = 4 \implies h = \frac{1-0}{4} = 0.25\)
2
\(x\)-values: \(0,\; 0.25,\; 0.5,\; 0.75,\; 1\)
3
\(f(x) = x^2\): \(0,\; 0.0625,\; 0.25,\; 0.5625,\; 1\)

Example 1: Completing the Calculation

Example 2: \(\displaystyle\int_1^3 \frac{1}{x}\,dx\) with \(n = 4\)

1
\(a = 1,\; b = 3,\; n = 4 \implies h = \frac{3-1}{4} = 0.5\)
2
\(x\)-values: \(1,\; 1.5,\; 2,\; 2.5,\; 3\)
3
\(f(x) = \frac{1}{x}\): \(1,\; 0.6\overline{6},\; 0.5,\; 0.4,\; 0.3\overline{3}\)

Example 3: From a Data Table

A car's velocity \(v(t)\) is recorded every 2 seconds. Estimate the distance travelled from \(t = 0\) to \(t = 8\).

\(t\) (s) 02468
\(v(t)\) (m/s) 05121618

More Strips = Better Approximation

Revisiting \(\displaystyle\int_0^1 x^2\,dx = 0.3\overline{3}\): watch how the error shrinks as \(n\) grows.

\(n\) Approximation Error % Error
20.3750.041712.5%
40.3440.01043.1%
80.3360.00260.8%
1000.333350.000020.005%

Over- or Under-Estimate?

Concave Up \(\left(f'' > 0\right)\)
Trapezoids sit above the curve: the rule overestimates the true area.
Concave Down \(\left(f'' < 0\right)\)
Trapezoids sit below the curve: the rule underestimates the true area.
Concave Up: Overestimate Concave Down: Underestimate

Common Mistakes to Avoid

✕ Wrong \(h\)
Using \(h = \frac{b - a}{n+1}\) or \(h = \frac{b - a}{n-1}\) instead of the correct \(h = \frac{b-a}{n}\).
✕ Missing the 2's
Forgetting to double the interior function values. Remember: "1, 2, 2, ..., 2, 1".
✕ Confusing \(n\) and points
\(n\) is the number of strips (intervals). You have \(n + 1\) data points.

Summary: Numerical Integration

Concept Key Detail
Formula \(\frac{h}{2}[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)]\)
Strip width \(h = \frac{b - a}{n}\)
Coefficients 1, 2, 2, ..., 2, 1
Error behaviour Error \(\propto \frac{1}{n^2}\): doubling \(n\) cuts error by ~4
Overestimate when \(f\) is concave up \((f'' > 0)\)
Underestimate when \(f\) is concave down \((f'' < 0)\)
Data tables Works directly: no formula needed, just evenly spaced points

Question 1 of 5

Using the trapezoidal rule with \(n = 3\), which values of \(h\) and number of function evaluations are correct for \(\displaystyle\int_2^5 f(x)\,dx\)?

Question 2 of 5

Use the trapezoidal rule with \(n = 2\) to estimate \(\displaystyle\int_0^4 \sqrt{x}\,dx\).
Which is closest to the correct approximation?

Question 3 of 5

In the trapezoidal rule formula, the coefficients of the function values follow the pattern:

Question 4 of 5

The trapezoidal rule is used to approximate \(\displaystyle\int_a^b f(x)\,dx\) where \(f\) is concave up on \([a, b]\). The approximation will be:

Question 5 of 5

A function is sampled at equal intervals with the following values:

\(x\)0123
\(f(x)\)3546

Using the trapezoidal rule, what is \(\displaystyle\int_0^3 f(x)\,dx\) approximately?