Numerical
Integration
Learn how to approximate definite integrals using the trapezoidal rule when an exact antiderivative is difficult or impossible to find.
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\).
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.
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.
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
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
Example 1: \(\displaystyle\int_0^1 x^2\,dx\) with \(n = 4\)
Example 1: Completing the Calculation
Example 2: \(\displaystyle\int_1^3 \frac{1}{x}\,dx\) with \(n = 4\)
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) | 0 | 2 | 4 | 6 | 8 |
|---|---|---|---|---|---|
| \(v(t)\) (m/s) | 0 | 5 | 12 | 16 | 18 |
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 |
|---|---|---|---|
| 2 | 0.375 | 0.0417 | 12.5% |
| 4 | 0.344 | 0.0104 | 3.1% |
| 8 | 0.336 | 0.0026 | 0.8% |
| 100 | 0.33335 | 0.00002 | 0.005% |
Over- or Under-Estimate?
Common Mistakes to Avoid
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\) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| \(f(x)\) | 3 | 5 | 4 | 6 |
Using the trapezoidal rule, what is \(\displaystyle\int_0^3 f(x)\,dx\) approximately?