Trapezoidal Rule Calculator

Type a function, an interval and a number of strips to estimate the integral with trapezoids.

Use x. Type powers with ^, and functions with brackets: sin(x), e^(2x), ln(x), sqrt(x).

A number such as 0 or 1/2, pi, e, inf or -inf.

A number larger than the lower limit, pi, e, inf or -inf.

A whole number of equal intervals, 1 or more.

Try

Result

You entered∫02x2 dx≈T4\int_{0}^{2} x^{2}\,dx \approx T_{4}

T≈2.75\displaystyle T \approx 2.75

Error against the exact integral

0.083333\displaystyle 0.083333
Show the work
  1. Trapezoidal rule

    Cut the interval into 4 equal strips and replace the curve on each strip by a straight line, so each strip is a trapezoid; the two end heights count once and every height in between counts twice.

    Using Δx=b−an\Delta x = \frac{b - a}{n}

    Tn=Δx2[f(x0)+2f(x1)+⋯+2f(xn−1)+f(xn)]T_n = \frac{\Delta x}{2}\left[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)\right]
  2. Width of each strip

    Divide the length of the interval by the number of strips.

    Δx=2−04=0.5\begin{aligned} \Delta x &= \frac{2 - 0}{4} \\ &= 0.5 \end{aligned}
  3. Heights

    Evaluate ff at the 5 points x0,…,xnx_0, \ldots, x_n.

    f(xi): 0, 0.25, 1, 2.25, 4f(x_i):\ 0,\ 0.25,\ 1,\ 2.25,\ 4
  4. Add up

    Add the end heights once and the inner heights twice, then multiply by half the width.

    T=0.52[0+2(3.5)+4]=2.75\begin{aligned} T &= \frac{0.5}{2}\left[0 + 2\left(3.5\right) + 4\right] \\ &= 2.75 \end{aligned}
  5. Result

    The trapezoidal estimate with 4 intervals.

    T≈2.75T \approx 2.75
02
The trapezoids under y = x^2

Worked examples