How to use the Trapezoidal Rule Calculator
- 1. Type f(x)Enter the function, for example 1/(1+x^2) or exp(-x^2).
- 2. Set a, b and nEnter the limits and the number of strips.
- 3. Read the integralSee h, the ordinates, the weighted sum and the final value.
The trapezoidal rule
Split [a, b] into n strips of width h = (b − a)/n and join neighbouring points with straight lines. The area under those trapeziums is
∫ ≈ (h/2)[y₀ + 2(y₁ + y₂ + … + yₙ₋₁) + yₙ]
The first and last ordinates have weight 1, every inside ordinate has weight 2. The rule works for any n, odd or even, and is exact for straight lines.
Worked example
Evaluate ∫₀¹ 1/(1 + x²) dx with n = 6, so h = 1/6. The ordinates are y₀ = 1, y₁ = 0.972973, y₂ = 0.9, y₃ = 0.8, y₄ = 0.692308, y₅ = 0.590164 and y₆ = 0.5.
Sum = 1 + 2(0.972973 + 0.9 + 0.8 + 0.692308 + 0.590164) + 0.5 = 9.410889. Multiply by h/2 = 1/12 to get 0.784241. The exact answer is π/4 = 0.785398, so the error is about 0.00116, much bigger than Simpson's rule with the same n.
How the error behaves
The trapezoidal rule's error falls like h², so doubling n cuts the error about four times. For curves that bend a lot, use more strips or switch to the Simpson's rule calculator, whose error falls like h⁴. The trapezoidal rule is still very good for periodic functions over a full period and for tabulated data with uneven curvature.
Frequently asked questions
Does n have to be even?
No. The trapezoidal rule works with any whole number of strips.
Why is my answer slightly too big or too small?
For a curve that bends downwards, trapeziums sit under the curve and underestimate; for one that bends upwards, they overestimate.
Can I use pi in the limits?
Yes. Type pi, pi/2 or 2*pi in the limit boxes.
Is this calculator free?
Yes. You enter your name and WhatsApp number once when you see your result, and other Uncodemy tools then open without the form.