The Trapezoidal Rule
The trapezoidal rule is a numerical method used to approximate the definite integral of a function or the area under a curve.
NoteIt's particularly useful when dealing with complex functions or data sets where analytical integration is difficult or impossible.
Basic Concept
- The trapezoidal rule works by dividing the area under a curve into a series of trapezoids.
- The sum of the areas of these trapezoids provides an approximation of the total area under the curve.
The more trapezoids used (i.e., the smaller the width of each trapezoid), the more accurate the approximation becomes.
Formula
For a function $f(x)$ on the interval $[a,b]$, divided into $n$ equal subintervals, the trapezoidal rule is given by:
$$ \int_{a}^{b} f(x) dx \approx \frac{h}{2} [f(x_0) + 2f(x_1) + 2f(x_2) + ... + 2f(x_{n-1}) + f(x_n)] $$
Where:
- $h = \frac{b-a}{n}$ is the width of each subinterval
- $x_0 = a$ and $x_n = b$ are the endpoints of the interval
- $x_1, x_2, ..., x_{n-1}$ are the intermediate points
To apply the trapezoidal rule, consider a simple example: approximating the integral of $f(x)=x^2$ from $a=0$ to $b=4$ using $n=4$ subintervals.
- Calculate the step size:
$$h=\frac{b-a}{n}=\frac{4-0}{4}=1$$ - Determine function values at the points $x_0=0, x_1=1, x_2=2, x_3=3,x_4=4$:
$$f(0)=0^2=0, \quad f(1)=1, \quad f(2)=4, \quad f(3)=9, \quad f(4)=16$$ - Apply the formula:
$$
\begin{aligned}
& \int_0^4 x^2 d x \approx \frac{1}{2}[0+2(1)+2(4)+2(9)+16] \\
& =\frac{1}{2} \times(0+2+8+18+16)=\frac{1}{2} \times 44=22
\end{aligned}
$$ - Thus, the estimated area under $y=x^2$ from 0 to 4 is approximately 22.
Application to Tabular Data
The trapezoidal rule is particularly useful when dealing with discrete data points rather than continuous functions. Given a table of $(x,y)$ values, we can apply the rule as follows:
$$ Area \approx \frac{1}{2} \sum_{i=1}^{n} (x_i - x_{i-1})(y_i + y_{i-1}) $$
ExampleSuppose we have the following dataset representing velocity $v(m/s)$ recorded at different times $t(s)$:
| $t(s)$ | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| $v(m/s)$ | 0 | 2 | 5 | 7 | 10 |
Using the trapezoidal rule:
$$
\begin{gathered}
\text { Area } \approx \frac{1}{2} \sum_{i=1}^n\left(t_i-t_{i-1}\right)\left(v_i+v_{i-1}\right) \\
=\frac{1}{2}[(1-0)(2+0)+(2-1)(5+2)+(3-2)(7+5)+(4-3)(10+7)] \\
=\frac{1}{2}[2+7+12+17]=\frac{1}{2} \times 38=19 \mathrm{~m}
\end{gathered}
$$
Thus, the estimated displacement over 4 seconds is 19 meters.
Link to Upper and Lower Bounds
The trapezoidal rule can be related to upper and lower bounds (SL1.6) in the following way:
- If the function is concave up, the trapezoidal approximation provides an upper bound for the true area.
- If the function is concave down, it provides a lower bound.