The trapezoid rule approximates the definite integral of a function by dividing the area under the curve into trapezoids and summing their areas.
Formula:
The formula for the trapezoid rule is:
*∫<sub>a</sub><sup>b</sup> f(x) dx ≈ (b - a)/2n [f(a) + 2f(x<sub>1</sub>) + 2f(x<sub>2</sub>) + ... + 2f(x<sub>n-1</sub>) + f(b)]**
Where:
- ∫<sub>a</sub><sup>b</sup> f(x) dx represents the definite integral of the function f(x) from a to b.
- n is the number of trapezoids used.
- (b - a)/n is the width of each trapezoid.
- f(a) and f(b) are the function values at the endpoints of the interval.
- f(x<sub>i</sub>) are the function values at the midpoints of each trapezoid.
Example:
Let's say we want to approximate the integral of f(x) = x<sup>2</sup> from 0 to 2 using 4 trapezoids.
- n = 4
- (b - a)/n = (2 - 0)/4 = 0.5
- f(0) = 0<sup>2</sup> = 0
- f(2) = 2<sup>2</sup> = 4
- f(0.5) = 0.5<sup>2</sup> = 0.25
- f(1) = 1<sup>2</sup> = 1
- f(1.5) = 1.5<sup>2</sup> = 2.25
Plugging these values into the formula:
*∫<sub>0</sub><sup>2</sup> x<sup>2</sup> dx ≈ (2 - 0)/8 [0 + 2(0.25) + 2(1) + 2(2.25) + 4] ≈ 2.75**
Therefore, the trapezoid rule approximation of the integral of x<sup>2</sup> from 0 to 2 using 4 trapezoids is 2.75.
Practical Insights:
- The trapezoid rule is a simple and widely used method for approximating integrals.
- The accuracy of the approximation increases as the number of trapezoids (n) increases.
- The trapezoid rule is generally more accurate than the midpoint rule but less accurate than Simpson's rule.