Enter a polynomial, bounds, and the number of subintervals, and instantly get the trapezoidal rule estimate — compared against the exact integral.
Trapezoidal Rule Calculator
How It’s Calculated
The trapezoidal rule approximates the area under the curve by splitting [a,b] into n strips of width h = (b−a)/n and treating each strip as a trapezoid instead of a rectangle: ∫ f(x) dx ≈ (h/2)·[f(a) + 2f(x₁) + 2f(x₂) + … + 2f(xₙ₋₁) + f(b)]. Every interior point is counted twice because it’s shared between two adjacent trapezoids; only the two endpoints count once.
Worked Example
For f(x) = x² on [0,4] with n = 4: h = 1, points are 0,1,2,3,4 with f-values 0,1,4,9,16. Estimate = (1/2)·[0 + 2(1)+2(4)+2(9) + 16] = (1/2)·[0+2+8+18+16] = 22. The exact integral is 4³/3 ≈ 21.33 — close, with the small error typical of a linear approximation on a curved function.
Frequently Asked Questions
Q: Does increasing n always improve accuracy?
Yes, for well-behaved functions — more, narrower strips approximate the curve more closely, and the error shrinks roughly proportional to 1/n².
Q: Why compare against the exact integral here?
To make the approximation error visible and concrete — in a real numerical methods exam, you rarely have the exact value, but seeing the comparison on a solvable polynomial builds intuition for how the method behaves.
Trapezoidal and Simpson’s rules are core Numerical Methods topics in VTU Engineering Mathematics 2. Compare with Simpson’s Rule →