Skip to main content

Trapezoidal Rule Calculator – Numeric Integrals

Quick answer

Trapezoid rule (h/2)[f₀+2f₁+…+fₙ]: ∫₀¹x²dx with n=2 gives 0.375 vs exact 1/3 — error 12.5%, cut to 3% at n=4.

  • Table of ordinates.

Figures are estimates from this calculator’s standard formula — adjust the inputs in the tool below for your exact number.

How the Trapezoidal Rule Calculator Works

∫ ≈ (h/2)[f₀ + 2f₁ + 2f₂ + … + 2fₙ₋₁ + fₙ]

The trapezoidal rule joins sample points with straight lines and sums the resulting trapezoids. For ∫₀¹ x² dx with n = 2 (h = 0.5, nodes 0, 0.5, 1): (0.5/2)[0 + 2(0.25) + 1] = 0.25 × 1.5 = 0.375, versus the exact 1/3 ≈ 0.33333 — a 12.5% overestimate because chords arch above a convex curve. Refining to n = 4 gives (0.25/2)[0 + 2(0.0625) + 2(0.25) + 2(0.5625) + 1] = 0.34375, error 3.1%: error scales as h², so doubling n quarters it. The calculator prints the node table (x, f(x), weight), the weighted sum, and the estimate, alongside the midpoint/Simpson values for comparison — Simpson takes the same nodes and fixes most of the curvature error. Concave functions flip the bias and underestimate instead.

  1. 1

    Enter f(x) and bounds

    Any integrand over [a, b]

  2. 2

    Choose n

    More intervals mean smaller h and less error

  3. 3

    Build the node table

    Each xₖ, f(xₖ) and weight 2 (interior) or 1 (ends)

  4. 4

    Sum and scale

    Multiply by h/2 for the estimate

Use Cases

Tabulated Data

Integrate sensor logs known only at sampled times

Quick Estimates

Sanity-check definite integrals before exact work

Calculus Teaching

Show convex functions overestimate: 0.375 vs 1/3

Tips

  • 1

    Error scales with h² — double the nodes, quarter the error

  • 2

    Convex curves overestimate; concave curves underestimate

  • 3

    Interior nodes weight 2; endpoints weight 1

Common Mistakes

  • Weighting endpoints by 2 instead of 1

  • Multiplying by h instead of h/2

  • Expecting exactness on curves — only linear functions integrate exactly

  • Comparing against Simpson without noting n must differ (Simpson needs even n)

FAQs

What is ∫₀¹ x² dx by trapezoids with n=2?

(0.5/2)[0 + 2(0.25) + 1] = 0.375 — 12.5% above the exact 1/3.

What happens at n=4?

0.34375, only 3.1% high — error quarters when intervals double.

When does the rule overestimate?

On convex (cup-up) functions like x²; concave functions come in low.

Why weight interior nodes by 2?

Each interior point (like x = 0.5 in our n = 2 run) borders two trapezoids, contributing to both heights.

Should I just use Simpson instead?

Usually yes for smooth functions; the trapezoid rule shines on raw tabulated data.