Skip to content

Trapezoidal Rule

The Trapezoidal Rule is the simplest closed Newton-Cotes formula. It uses two nodes: the left endpoint x0=ax_0 = a and the right endpoint x1=bx_1 = b. The integrand is approximated by the straight line connecting f(a)f(a) and f(b)f(b), and the integral of that line is the area of a trapezoid.

An e^x-shaped curve f(x) with a straight chord joining f(a) to f(b); the exact area under f(x) is shaded blue and the trapezoidal approximation area is shaded orange.

The chord either overestimates or underestimates depending on the curvature of f(x)f(x); the derivation below computes the weights σ0\sigma_0 and σ1\sigma_1 that make this approximation exact.


Setup

For n=1n = 1 the Newton-Cotes formula has two terms:

I1=σ0 f(x0)+σ1 f(x1)=σ0 f(a)+σ1 f(b)I_1 = \sigma_0\, f(x_0) + \sigma_1\, f(x_1) = \sigma_0\, f(a) + \sigma_1\, f(b)

The nodes and Lagrange basis polynomials are:

x0=a,x1=bx_0 = a, \qquad x_1 = b

l0(x)=x−x1x0−x1=x−ba−b,l1(x)=x−x0x1−x0=x−ab−al_0(x) = \frac{x - x_1}{x_0 - x_1} = \frac{x - b}{a - b}, \qquad l_1(x) = \frac{x - x_0}{x_1 - x_0} = \frac{x - a}{b - a}

We compute each weight by integrating its basis polynomial over [a,b][a, b].


Derivation of σ0\sigma_0

σ0=∫abl0(x) dx=∫abx−ba−b dx=1a−b∫ab(x−b) dx\sigma_0 = \int_a^b l_0(x)\,dx = \int_a^b \frac{x - b}{a - b}\,dx = \frac{1}{a - b}\int_a^b (x - b)\,dx

Evaluating the integral:

=1a−b[x22−bx]ab= \frac{1}{a-b}\left[\frac{x^2}{2} - bx\right]_a^b

=1a−b(b22−b2−a22+ab)= \frac{1}{a-b}\left(\frac{b^2}{2} - b^2 - \frac{a^2}{2} + ab\right)

=1a−b⋅b2−2b2−a2+2ab2= \frac{1}{a-b} \cdot \frac{b^2 - 2b^2 - a^2 + 2ab}{2}

=1a−b⋅−(b2−2ab+a2)2= \frac{1}{a-b} \cdot \frac{-(b^2 - 2ab + a^2)}{2}

=1a−b⋅−(b−a)22= \frac{1}{a-b} \cdot \frac{-(b-a)^2}{2}

Since a−b=−(b−a)a - b = -(b-a):

σ0=1−(b−a)⋅−(b−a)22=b−a2\sigma_0 = \frac{1}{-(b-a)} \cdot \frac{-(b-a)^2}{2} = \frac{b-a}{2}


Derivation of σ1\sigma_1

σ1=∫abl1(x) dx=∫abx−ab−a dx=1b−a∫ab(x−a) dx\sigma_1 = \int_a^b l_1(x)\,dx = \int_a^b \frac{x - a}{b - a}\,dx = \frac{1}{b-a}\int_a^b (x - a)\,dx

Evaluating the integral:

=1b−a[x22−ax]ab= \frac{1}{b-a}\left[\frac{x^2}{2} - ax\right]_a^b

=1b−a(b22−ab−a22+a2)= \frac{1}{b-a}\left(\frac{b^2}{2} - ab - \frac{a^2}{2} + a^2\right)

=1b−a⋅b2−2ab+a22= \frac{1}{b-a} \cdot \frac{b^2 - 2ab + a^2}{2}

=1b−a⋅(b−a)22=b−a2= \frac{1}{b-a} \cdot \frac{(b-a)^2}{2} = \frac{b-a}{2}


The Trapezoidal Rule

Both weights are equal:

σ0=σ1=b−a2\sigma_0 = \sigma_1 = \frac{b-a}{2}

Substituting back:

I1=b−a2[f(a)+f(b)]\boxed{I_1 = \frac{b-a}{2}\left[f(a) + f(b)\right]}


Geometric Interpretation

The Trapezoidal Rule replaces the curved region under f(x)f(x) with a trapezoid. The two parallel sides of the trapezoid have heights f(a)f(a) and f(b)f(b), and the perpendicular distance between them is b−ab - a:

Area of trapezoid=12 (b−a) [f(a)+f(b)]\text{Area of trapezoid} = \frac{1}{2}\,(b-a)\,\bigl[f(a) + f(b)\bigr]

For smooth functions that are nearly linear over [a,b][a, b], the trapezoidal approximation is quite good. When the function curves significantly, the approximation can be far off. The Composite Trapezoidal Rule (next section) addresses this by breaking the interval into many small sub-intervals, each of which is nearly linear.

A labeled trapezoid with parallel sides f(a) and f(b), base b minus a, and the area formula (b-a)/2 times [f(a)+f(b)] displayed inside.

The factor of 12\frac{1}{2} in the formula comes directly from the geometry: the area of any trapezoid is half the sum of its parallel sides multiplied by the perpendicular distance between them.