Ekuation

method

Trapezoidal Rule Calculator

Use the trapezoidal rule to approximate integrals with trapezoid visualization and error analysis.

Back to Integral Calculator

Enter a mathematical expression using x as the variable.

Number of subdivisions for the numerical calculation.

Number of rectangles shown in the visualization.

Integral Calculator Tips

Click to show tips

Try an Example

Pick a scenario to see how the calculator works, then adjust the values

Basic Polynomial

Integrate x^2 from 0 to 1 using Simpson's rule. Exact answer: 1/3.

Key values: x^2 · [0, 1] · Simpson's rule

Trigonometric Integral

Integrate sin(x) from 0 to pi. Exact answer: 2.

Key values: sin(x) · [0, pi] · Exact: 2

Area Under a Bell Curve

Approximate the Gaussian integral e^(-x^2) from -3 to 3.

Key values: e^(-x^2) · [-3, 3] · Gaussian

Documentation

The Trapezoidal Rule

The trapezoidal rule approximates the area under a curve by dividing the interval into trapezoids rather than rectangles. Each trapezoid connects consecutive function values with a straight line, capturing the slope of the function.

abf(x)dxh2[f(x0)+2i=1n1f(xi)+f(xn)]\int_a^b f(x)\,dx \approx \frac{h}{2}\left[f(x_0) + 2\sum_{i=1}^{n-1}f(x_i) + f(x_n)\right]

where h=(ba)/nh = (b-a)/n. Unlike Simpson's rule, there is no restriction on nn being even.


Error Analysis

ET(ba)312n2maxx[a,b]f(x)|E_T| \leq \frac{(b-a)^3}{12n^2} \max_{x \in [a,b]} |f''(x)|

The error depends on the second derivative. This means the trapezoidal rule is exact for linear functions (whose second derivative is zero). Doubling nn reduces the error by a factor of 4.


When the Trapezoidal Rule Shines

  • Periodic functions on a full period: For smooth periodic functions integrated over a complete period, the trapezoidal rule converges exponentially fast — often matching machine precision with surprisingly few points.
  • Simplicity: No parity constraint on nn, making it the most flexible basic method.
  • Experimental data: When you have measured data at fixed points (no formula), the trapezoidal rule is the natural choice.

Frequently Asked Questions

What is the trapezoidal rule?

The trapezoidal rule approximates the area under a curve by dividing the interval into trapezoids. Each trapezoid connects consecutive function values with a straight line, providing O(h2)O(h^2) convergence.

How does the trapezoidal rule compare to Simpson's rule?

The trapezoidal rule has O(h2)O(h^2) convergence while Simpson's rule has O(h4)O(h^4). However, the trapezoidal rule has no parity constraint on the number of subintervals and excels for periodic functions integrated over a full period.

Is the trapezoidal rule exact for any functions?

Yes, the trapezoidal rule is exact for linear functions because its error bound depends on the second derivative, which is zero for first-degree polynomials.

When does the trapezoidal rule outperform other methods?

The trapezoidal rule converges exponentially fast for smooth periodic functions integrated over a complete period. It is also the natural choice when you have experimental data at fixed measurement points rather than a formula.

How does doubling the number of subintervals affect the error?

Doubling nn (halving hh) reduces the trapezoidal rule error by a factor of 4, since the error is proportional to h2h^2. For example, going from 100 to 200 subintervals cuts the error to one-quarter.

Related method Variants

Explore more method options

More Math Calculators

Explore the category

Calculator Search

Search and find calculators