In calculus, the trapezoidal rule (informally trapezoid rule; or in British English trapezium rule) is a technique for numerical integration, i.e. approximating the definite integral:
The trapezoidal rule works by approximating the region under the graph of the function
as a trapezoid and calculating its area. This is easily calculated by noting that the area of the region is made up of a rectangle with width
and height
, and a triangle of width
and height
.
Therefore,
The rule can also be derived by replacing the integrand with the equation of the line joining points
and
, which using the two point form of the equation of a line, is
Therefore,
as before.
The integral can be even better approximated by partitioning the integration interval, applying the trapezoidal rule to each subinterval and summing the results. In practice, this "chained" (or "composite") trapezoidal rule is usually what is meant by "integrating with the trapezoidal rule". Let
be a partition of
such that
and
be the length of the
-th subinterval (that is,
), then
The trapezoidal rule may be viewed as the result obtained by averaging the left and right Riemann sums and is sometimes defined this way.
The approximation becomes more accurate as the resolution of the partition increases (that is, for larger
, all
decrease).
When the partition has a regular spacing, as is often the case, that is, when all the
have the same value
the formula can be simplified for calculation efficiency by factoring
out:
As discussed below, it is also possible to place error bounds on the accuracy of the value of a definite integral estimated using a trapezoidal rule.