# How does the trapezoidal rule work?

Oct 17, 2014

Let us approximate the definite integral

${\int}_{a}^{b} f \left(x\right) \mathrm{dx}$

by Trapezoid Rule ${T}_{n}$.

First, split the interval $\left[a , b\right]$ into $n$ equal subintervals:

$\left[{x}_{0} , {x}_{1}\right] , \left[{x}_{1} , {x}_{2}\right] , \left[{x}_{2} , {x}_{3}\right] , \ldots , \left[{x}_{n - 1} , {x}_{n}\right]$,

where $a = {x}_{0} < {x}_{1} < {x}_{2} < \cdots < {x}_{n} = b$.

Trapezoid Rule ${T}_{n}$ can be found by

${T}_{n} = \left[f \left({x}_{0}\right) + 2 f \left({x}_{1}\right) + 2 f \left({x}_{2}\right) + \cdots + 2 f \left({x}_{n - 1}\right) + f \left({x}_{n}\right)\right] \frac{b - a}{2 n}$.

I hope that this was helpful.