# Integral Approximation - Trapezium Rule

The **trapezoidal rule** is a method for approximating definite integrals of functions. It is usually more accurate than left or right approximation using Riemann sums, and is exact for linear functions. The error in approximating the integral of a twice-differentiable function by the trapezoidal rule is proportional to the second derivative of the function at some point in the interval.

#### Contents

## Definition

Suppose \( f(x) \) is defined on the interval \( [a,b].\) The trapezoidal rule works by dividing the interval into \( N \) equal-sized parts, \( [a,x_1],[x_1,x_2],\ldots,[x_{N-1},b].\) (Let \( a=x_0,b=x_N.)\) (The sizes of the intervals need not be equal, but it is more convenient if they are.)

On each interval, estimate \( \int\limits_{x_k}^{x_{k+1}} f(x) \, dx \) by the area of a trapezoid whose four vertices are \( (x_k,0),(x_k,f(x_k)),(x_{k+1},f(x_{k+1}),(x_{k+1},0).\) This area is \[ (x_{k+1}-x_k)\left( \frac{f(x_k)+f(x_{k+1})}2 \right). \] Since \( x_{k+1}-x_k = \frac{b-a}{N},\) the sum of these areas is \[ \begin{align} \sum_{k=0}^{N-1}(x_{k+1}-x_k)\left( \frac{f(x_k)+f(x_{k+1})}2 \right) &= \frac{b-a}{2N} \sum_{k=0}^{N-1} (f(x_k)+f(x_{k+1})) \\ &= \frac{b-a}{N} \left( \frac{f(a)+f(b)}2 + f(x_1)+f(x_2)+\cdots+f(x_{N-1}) \right), \end{align} \] where \( x_k = a+k \frac{b-a}{N}. \) This is the estimate for \( \int\limits_a^b f(x) \, dx.\)

Let \( f(x) = x^2,\) \( a = 0, b = 4.\) Approximating the integral using four intervals gives \[ \int_0^4 x^2 \, dx \approx \frac{f(0)+f(4)}2+f(1)+f(2)+f(3) = 8 + 1+4+9 = 22, \] which is close to the actual value of \( 4^3/3 = 64/3.\)

Approximating the integral using \( N \) intervals gives \[ \begin{align} \int_0^4 x^2 \, dx &\approx \frac4{N}\left( \frac{f(0)+f(4)}2 + f(4/N)+f(8/N)+\cdots+f(4-4/N)\right) \\ &\approx \frac4{N} \left( 8 + \frac{16}{N^2}(1^2+2^2+\cdots+(N-1)^2) \right) \\ &\approx \frac4{N} \left( 8 + \frac{16}{N^2}\frac{(N-1)N(2N-1)}6 \right) \\ &\approx \frac{16}{3N^2} \left( 6N + 2(N-1)(2N-1) \right) \\ &\approx \frac{64}3 + \frac{32}{3N^2}. \end{align} \] So the error in the approximation is precisely \( \frac{32}{3N^2}, \) which naturally approaches \( 0 \) as \( N \to \infty; \) that is, the more intervals used, the better the approximation becomes.

## Error estimate

The picture in the definitions makes it clear that the error in the trapezoidal rule estimate will depend on how concave or convex \( f(x) \) is on each interval: if \( f\) is convex ("concave up") the trapezoidal rule will give an overestimate on that interval, and if \( f\) is concave ("concave down") the trapezoidal rule will give an underestimate. Since the second derivative measures the concavity of a function, it is intuitively reasonable that the error should be proportional to the second derivative.

Let \( f(x) \) be a twice-differentiable function on \( [a,b], \) and let \( E = \int\limits_a^b f(x) \, dx - T_N,\) where \( T_N \) is the trapezoidal rule estimate for the integral using \( N \) equal-sized intervals. Then there is a number \( c \in (a,b) \) such that \[ E = -\frac{(b-a)^3}{12N^2} f''(c). \]

The number \( c \) is known to exist via an argument like the one in the Mean Value Theorem, so there is no formula for it. The way that this estimate is generally used is: if \( K \) is a constant such that \( |f''(c)|<K\) for all \( c \) in the interval, then \( |E| < \frac{K(b-a)^3}{12N^2}. \)

Note that this recovers the error from the example above: \( f(x) = x^2, a = 0, b = 4, f''(c) = 2 \) for all \( c \), so \[ E = -\frac{(4-0)^3}{12N^2} \cdot 2 = -\frac{32}{3N^2}. \]

Consider the integral \[ I = \int_0^\pi \sin^2(x) \, dx. \] Let \( E_N = I - T_N \) be the error in estimating \( I \) using the trapezoidal rule with \( N \) equal-sized intervals. (\( T_N \) is the estimate.)

What is \( 100E_{100},\) to three decimal places?

**Cite as:**Integral Approximation - Trapezium Rule.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/integral-approximation-trapezium-rule/