Connect via MCP →

Enter Calculation

Use x as variable. Supports + - * / ^ , sin, cos, tan, exp, ln, sqrt, abs, pi.

Formula

Advertisement

Results

Approximate Integral
0.335
Trapezoidal estimate of ∫f(x) dx
Step size Δx 0.1
Subintervals n 10
f(a) 0
f(b) 1

What is the Trapezoidal Rule?

The trapezoidal rule is a numerical integration method that approximates the area under a curve by dividing the interval into n equal subintervals and treating each slice as a trapezoid. By summing the areas of all these trapezoids, you get an estimate of the definite integral \(\int_{a}^{b} f(x)\,dx\) — useful when an antiderivative is hard or impossible to find in closed form.

Area under a curve approximated by trapezoids over equal-width subintervals
The trapezoidal rule approximates the area under f(x) using a series of trapezoids.

How to use this calculator

Enter your function using x as the variable (for example x^2, sin(x), or exp(x)), then set the lower limit a, the upper limit b, and the number of subintervals n. A larger n generally produces a more accurate result. The calculator returns the approximate integral along with the step size Δx and the endpoint values.

The formula explained

The composite trapezoidal rule is:

$$\int_{a}^{b} f(x)\,dx \approx \frac{\Delta x}{2}\left[ f_0 + 2(f_1 + \cdots + f_{n-1}) + f_n \right], \quad \text{where } \Delta x = \frac{b - a}{n}.$$

The endpoints \(f_0\) and \(f_n\) are counted once, while every interior point is counted twice because it is shared between two adjacent trapezoids.

Advertisement
Single trapezoid strip showing two function heights and width delta x
Each strip has width Δx and parallel heights f(xi) and f(xi+1).

Worked example

Approximate \(\int_{0}^{1} x^2\,dx\) with \(n = 10\). Here \(\Delta x = 0.1\). Summing f at the nodes gives the trapezoidal estimate \(0.335\), compared with the exact value \(\tfrac{1}{3} \approx 0.3333\). Increasing n shrinks the error, which scales roughly with \(\Delta x^2\).

FAQ

Why is my answer slightly off from the exact integral? The trapezoidal rule is an approximation; its error decreases as you increase the number of subintervals n.

What functions are supported? Polynomials and operators + - * / ^, plus sin, cos, tan, exp, ln, log, sqrt, abs, and the constants pi and e.

Can a and b be in any order? If a > b the result will simply have the opposite sign, consistent with the orientation of the integral.

Last updated: