Professional Documents
Culture Documents
The trapezoidal rule is a numerical method that approximates the value of a definite integral. We
consider the definite integral
Z b
f (x) dx.
a
We assume that f (x) is continuous on [a, b] and we divide [a, b] into n subintervals of equal length
b−a
∆x =
n
using the n + 1 points
x0 = a, x1 = a + ∆x, x2 = a + 2∆x, ..., xn = a + n∆x = b.
We can compute the value of f (x) at these points.
y0 = f (x0 ), y1 = f (x1 ), y2 = f (x2 ), ..., yn = f (xn )
We approximate the integral by using n trapezoids formed by using straight line segments between
the points (xi−1 , yi−1 ) and (xi , yi ) for 1 ≤ i ≤ n as shown in the figure below.
y0 yn
y1 y3
y2 yn−2
yn−1
x
a = x0 x1 x2 x3 ··· ··· xn−2 xn−1 xn = b
∆x
1 (y0 + y1 )∆x
A = y0 ∆x + (y1 − y0 )∆x = .
2 2
y1 − y0
y1
y0 y0
∆x ∆x