Trapezoidal Sum Calculator

Trapezoidal rule for f(x) on [a, b] with the f″ error bound and the n you need.

  1. Enter valuesUse your own inputs or an example
  2. CalculateApply your selected settings
  3. View resultExplore the answer and explanation

Enter the function, limits and n

Enter your values below to get started.

Examples:
f(x) =
Use x as the variable: x^2, sin(x), e^x, 1/x, sqrt(x), ln(x).
1 to 10,000 equal subintervals.
Returns the smallest n that guarantees |error| ≤ this value.
Reset restores the default values.

Tips for this calculator

Write powers with ^: x^3, e^(-x^2).

Limits accept pi, e and fractions like 1/2.

Fill in Target error to get the n that the error bound guarantees.

Double n and the trapezoidal error drops about 4×.

A trapezoidal sum calculator estimates a definite integral ∫ab f(x) dx by joining the points of f(x) with straight lines and adding the areas of the n trapezoids underneath. Enter the function, the limits and n to get Tn, the weighted node table, the error against the exact integral, the error bound (b − a)³K / 12n² and the smallest n that meets a target error.

What is a Trapezoidal Sum?

A trapezoidal sum is an estimate of the area under a curve made by adding the areas of n trapezoids whose top edges are straight lines between neighboring points of f(x). The method is called the trapezoidal rule, and the result is written Tn.

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

A trapezoid follows a sloping curve more closely than a flat rectangle. For f(x) = x² on [0, 2], 4 trapezoids give T4 = 2.75 against the exact area 8/3 ≈ 2.6667, an error of 0.0833. The left Riemann sum with the same 4 strips is 1.75, an error 11 times larger.

InteractiveAdd trapezoids and watch Tₙ approach the area

How Does the Trapezoidal Sum Calculator Work?

The trapezoidal sum calculator splits [a, b] into n equal strips, evaluates f(x) at the n + 1 nodes, weights the 2 end values by 1 and the n − 1 interior values by 2, and multiplies the weighted sum by Δx / 2. The calculator then measures the error against a reference integral (Simpson's rule with 2,000 subintervals) and estimates K = max |f″(x)| from 1,000 sample points to produce the error bound.

InteractiveThe 1, 2, 2, …, 2, 1 weight pattern on f(x) = x²
  1. Find Δx

    Δx = (b − a) / n. For [0, 2] and n = 4, Δx = 0.5.

  2. Evaluate n + 1 nodes

    xi = a + iΔx for i = 0 … n. With n = 4 there are 5 nodes: 0, 0.5, 1, 1.5, 2.

  3. Weight the values

    End nodes count once, interior nodes count twice: 1, 2, 2, 2, 1.

  4. Multiply by Δx / 2

    T4 = 0.25 × (0 + 0.5 + 2 + 4.5 + 4) = 0.25 × 11 = 2.75.

Trapezoidal Sum Formula

The trapezoidal sum formula is Tn = (Δx / 2)[f(x0) + 2f(x1) + ⋯ + 2f(xn−1) + f(xn)], with Δx = (b − a) / n. The same value comes from 3 equivalent forms.

Area of One Trapezoid

A strip of width Δx with parallel sides f(xi−1) and f(xi) has area equal to the width times the average height.

Ai=f(xi−1)+f(xi)2 ΔxA_i = \frac{f(x_{i-1}) + f(x_i)}{2}\,\Delta x

Composite Trapezoidal Rule

Adding the n strip areas makes every interior value appear twice, which gives the weights 1, 2, …, 2, 1.

Tn=Δx[f(x0)+f(xn)2+∑i=1n−1f(xi)]T_n = \Delta x\left[\frac{f(x_0) + f(x_n)}{2} + \sum_{i=1}^{n-1} f(x_i)\right]

Average of the Left and Right Sums

For equal strips, Tn is exactly the mean of the left sum Ln and the right sum Rn. For x² on [0, 2] with n = 4: (1.75 + 3.75) / 2 = 2.75.

Tn=Ln+Rn2T_n = \frac{L_n + R_n}{2}
InteractiveTₙ sits halfway between Lₙ and Rₙ

Types of Trapezoidal Rules

There are 4 common types of trapezoidal rules: the single trapezoid, the composite rule with equal spacing, the rule with uneven spacing, and the end-corrected rule. On ∫02 eˣ dx = e² − 1 ≈ 6.3891, the 4 types give errors from 2.0 down to 0.0006.

InteractiveSwitch between trapezoidal rule types on eˣ

Single Trapezoid (n = 1)

(b − a)(f(a) + f(b)) / 2. For eˣ on [0, 2]: 8.3891, an error of 2.0.

Composite, Equal Spacing

The standard Tn with weights 1, 2, …, 2, 1. For n = 4: 6.5216, an error of 0.1325.

Uneven Spacing

Each strip has its own width Δxi. Used for measured data; see the trapezoidal sum table calculator.

End-Corrected Trapezoidal Rule

Subtracts (Δx² / 12)(f′(b) − f′(a)). For n = 4: 6.3885, an error of only −0.0006.

Romberg Integration

Werner Romberg (1955) combined Tn and T2n as (4T2n − Tn) / 3, which equals Simpson's rule.

How to Calculate a Trapezoidal Sum by Hand

To calculate a trapezoidal sum by hand, find Δx, list the n + 1 nodes, evaluate f at each node, apply the weights 1, 2, …, 2, 1, add, and multiply by Δx / 2. Here is T4 for f(x) = 1/x on [1, 3].

  1. Δx = (3 − 1) / 4 = 0.5.
  2. Nodes: 1, 1.5, 2, 2.5, 3.
  3. Values: 1, 0.6667, 0.5, 0.4, 0.3333.
  4. Weighted sum: 1 + 2(0.6667 + 0.5 + 0.4) + 0.3333 = 4.4667.
  5. T4 = 0.25 × 4.4667 = 1.1167 (exact ln 3 ≈ 1.0986).
InteractiveStep through a trapezoidal sum by hand

    Trapezoidal Sum Error Bound

    The error of a trapezoidal sum is at most (b − a)³K / (12n²), where K is the largest value of |f″(x)| on [a, b]. The bound shrinks with 1/n², so doubling n cuts the guaranteed error by 4.

    ∣ET∣=∣∫abf(x) dx−Tn∣≤(b−a)312n2 max⁡a≤x≤b∣f′′(x)∣|E_T| = \left|\int_a^b f(x)\,dx - T_n\right| \le \frac{(b-a)^3}{12n^2}\,\max_{a\le x\le b}|f''(x)|

    Solving the bound for n gives the number of trapezoids that guarantees a target error ε: n ≥ √((b − a)³K / 12ε). For x² on [0, 2], K = 2 and ε = 0.001 give n ≥ 36.5, so n = 37. For f(x) = x², the bound and the actual error are equal (0.0833 at n = 4), since f″ is constant.

    InteractiveError bound vs. actual error

    Does a Trapezoidal Sum Overestimate or Underestimate?

    A trapezoidal sum overestimates when f is concave up (f″ > 0) and underestimates when f is concave down (f″ < 0). On a concave-up curve, every chord lies above the graph; on a concave-down curve, every chord lies below it.

    • Concave up: x² on [0, 2] gives T4 = 2.75 > 2.6667.
    • Concave down: sin x on [0, π] gives T4 = 1.8961 < 2.
    • Linear f: f″ = 0, so the trapezoidal sum is exact for any n.
    • Inflection point: x³ on [−1, 2] changes concavity at x = 0, so the chord errors partly cancel: T3 = 4.5 vs. 3.75.
    InteractiveConcavity decides over or under

    Common Mistakes with Trapezoidal Sums

    • Doubling the end values: only interior nodes x1 … xn−1 get the weight 2.
    • Multiplying by Δx instead of Δx / 2: the weighted sum counts each strip's 2 heights, so the factor is Δx / 2.
    • Counting n nodes instead of n + 1: n trapezoids need n + 1 points.
    • Using |f′| in the error bound: the trapezoidal bound uses the second derivative f″.
    • Using degrees in sin and cos: calculus formulas use radians, so π ≈ 3.1416.
    InteractiveTrue or false: trapezoidal sums
    1. The trapezoidal rule gives the end values f(x₀) and f(xₙ) a weight of 2.

    2. Tₙ = (Lₙ + Rₙ) / 2 when all strips have the same width.

    3. For a concave-up function, the trapezoidal sum underestimates the integral.

    4. Doubling n cuts the trapezoidal error by about 4×.

    5. The trapezoidal rule is exact for f(x) = 3x + 2.

    Score: 0 / 5

    How to Use the Trapezoidal Sum Calculator

    Type f(x), enter a, b and n, optionally add a target error, and press Calculate. The result card shows Tn, the actual error, the error bound and the n that meets your target; the tabs hold the steps, the trapezoid graph and the weighted node table.

    InteractiveLoad a ready-made trapezoidal sum

    Each button fills the calculator and runs it.

    1. Enter f(x)

      Use x as the variable, for example x^3 + 1 or ln(x).

    2. Set a, b and n

      a and b are the limits; n is the number of trapezoids (1 to 10,000).

    3. Add a target error

      Optional. Type 0.001 to get the smallest n with |error| ≤ 0.001.

    4. Read the table

      The Table tab lists every node, its weight and its weighted value.

    Real-Life Applications of Trapezoidal Sums

    Trapezoidal sums turn readings taken at intervals into a total area or amount. 5 common uses:

    • Land surveying: widths of an irregular plot measured every few meters (or feet) give its area in m² (or ft²).
    • Pharmacokinetics: the linear trapezoidal method gives the area under the concentration curve (AUC) used by the U.S. Food and Drug Administration (FDA) in bioequivalence studies.
    • Ship design: naval architects add cross-section areas to find hull volume and displacement.
    • Energy meters: power in kilowatts (kW) sampled every 15 minutes adds up to kilowatt-hours (kWh).
    • Hydrology: flow rates in cubic meters per second (m³/s) over a day give the total runoff volume.
    InteractiveArea of an irregular garden plot from width readings

    Trapezoidal Sum Examples

    Common trapezoidal rule problems with their exact integrals and error bounds.

    Trapezoidal Sum Examples
    IntegralnTₙExactError boundCalculator
    ∫02x2 dx\int_0^2 x^2\,dx42.752.66670.0833
    ∫02x3 dx\int_0^2 x^3\,dx44.2540.5
    ∫0πsin⁡x dx\int_0^\pi \sin x\,dx41.896120.1615
    ∫131x dx\int_1^3 \frac{1}{x}\,dx41.11671.09860.0833
    ∫01ex dx\int_0^1 e^x\,dx101.71971.71830.00227
    ∫01e−x2 dx\int_0^1 e^{-x^2}\,dx100.746210.746820.00167

    Popular Trapezoidal Sum Problems

    Work each one by hand, then reveal the answer or solve it in the calculator.

    1. Trapezoidal sum of f(x) = x³ on [0, 2] with n = 4.

      T_4,\ f(x)=x^3,\ [0,2]
      Show answerT_4 = 4.25
    2. Trapezoidal sum of f(x) = 1/x on [1, 2] with n = 2.

      T_2,\ f(x)=\tfrac{1}{x},\ [1,2]
      Show answerT_2 \approx 0.7083
    3. Estimate π as 4·T₄ of f(x) = 1/(1 + x²) on [0, 1].

      4T_4,\ f(x)=\tfrac{1}{1+x^2}
      Show answerT_4 \approx 0.7828,\ 4T_4 \approx 3.1312
    4. Trapezoidal sum of f(x) = x³ on [−1, 2] with n = 3. Is it an over- or underestimate?

      T_3,\ f(x)=x^3,\ [-1,2]
      Show answerT_3 = 4.5 > 3.75,\ \text{overestimate}
    5. Smallest n that guarantees an error of at most 0.0001 for ∫₀¹ eˣ dx.

      |E_T| \le 10^{-4},\ f(x)=e^x,\ [0,1]
      Show answern = 48
    6. Trapezoidal sum of f(x) = sin x on [0, π] with n = 6.

      T_6,\ f(x)=\sin x,\ [0,\pi]
      Show answerT_6 \approx 1.9541

    Explore More Sum Calculators

    Discover 67 free sum calculators across different categories. Find the right calculator for your needs.

    Browse All 67 Calculators
    Questions and answers

    Frequently Asked Questions

    What is a trapezoidal sum calculator?

    A trapezoidal sum calculator is an online tool that estimates ∫ f(x) dx on [a, b] with the trapezoidal rule. It returns Tₙ, the steps, a table of weighted nodes, the error bound and a graph of the trapezoids.

    What is the formula for a trapezoidal sum?

    Tₙ = (Δx / 2)[f(x₀) + 2f(x₁) + ⋯ + 2f(xₙ₋₁) + f(xₙ)], where Δx = (b − a) / n and xᵢ = a + iΔx.

    Is the trapezoidal sum the average of the left and right Riemann sums?

    Yes, when all subintervals have the same width, Tₙ = (Lₙ + Rₙ) / 2. For x² on [0, 2] with n = 4, (1.75 + 3.75) / 2 = 2.75.

    When does the trapezoidal rule overestimate?

    The trapezoidal rule overestimates when f is concave up on [a, b], since every chord lies above the curve. The rule underestimates when f is concave down.

    What is the error bound for the trapezoidal rule?

    The error is at most (b − a)³K / (12n²), where K = max |f″(x)| on [a, b]. For x² on [0, 2] with n = 4, the bound is 8 × 2 / 192 ≈ 0.0833.

    How many trapezoids do I need for a given accuracy?

    Use n ≥ √((b − a)³K / 12ε), where ε is the target error. For eˣ on [0, 1] with ε = 0.0001, K = e and n ≥ 47.6, so n = 48.

    Is the trapezoidal rule more accurate than the midpoint rule?

    No, for most smooth functions the midpoint rule error is about half the trapezoidal error, and the 2 errors have opposite signs.

    Can the trapezoidal rule give an exact answer?

    Yes, the trapezoidal rule is exact for every linear function f(x) = mx + c, since f″ = 0 and each chord lies on the line.

    Who invented the trapezoidal rule?

    Babylonian astronomers used a trapezoid area rule to track the motion of Jupiter between 350 and 50 BCE, as shown by Mathieu Ossendrijver in 2016. The modern composite form was developed alongside calculus in the 17th century.

    Conclusion

    A trapezoidal sum replaces the curve with straight chords and adds n trapezoids, and the trapezoidal sum calculator returns Tn, its error and its error bound for any f(x), [a, b] and n. Use the weights 1, 2, …, 2, 1, check concavity to know the sign of the error, and use the (b − a)³K / 12n² bound to pick n before you start.

    Not sure the trapezoidal rule is the right method? Answer 3 questions below.

    InteractiveShould you use the trapezoidal rule?