ES EN FR PT DE IT

Trapezoidal Rule Integral Approximation

Approximate a definite integral using the trapezoidal rule with n subdivisions.

The Trapezoidal Rule Integral Approximation is a free online math calculator. Approximate a definite integral using the trapezoidal rule with n subdivisions. Get instant results with the detailed formula and step-by-step examples.
Inputs
Values
Result
Enter values and press Calculate

What Is Trapezoidal Rule Integral Approximation Calculator?

Trapezoidal Rule Integral Approximation Calculator estimates the area under a curve by dividing it into trapezoids and summing their areas. When exact integration is impossible or impractical, numerical methods like the trapezoidal rule provide accurate approximations. This technique appears throughout engineering (calculating work from force curves), physics (finding displacement from velocity), economics (computing consumer surplus), and statistics (finding probabilities from density functions).

Consider finding the area under f(x) = x² from x = 0 to x = 4. The exact integral is 64/3 ≈ 21.333. Using the trapezoidal rule with 4 subintervals: divide [0,4] into intervals of width h = 1. Evaluate: f(0) = 0, f(1) = 1, f(2) = 4, f(3) = 9, f(4) = 16. Apply the formula: Area ≈ (h/2)[f(0) + 2f(1) + 2f(2) + 2f(3) + f(4)] = (1/2)[0 + 2(1) + 2(4) + 2(9) + 16] = (1/2)[0 + 2 + 8 + 18 + 16] = (1/2)(44) = 22. The approximation 22 is within 3% of the exact value 21.333.

The trapezoidal rule works by approximating the curve as a series of connected straight lines, forming trapezoids. Each trapezoid's area is (h/2)(y₁ + y₂), where h is the width and y₁, y₂ are the function values at the endpoints. Summing all trapezoids gives the total area. More subintervals (smaller trapezoids) produce better approximations — the trapezoids follow the curve more closely.

How Trapezoidal Rule Calculator Works: Formulas Explained

Trapezoidal rule formula: ∫[a,b] f(x)dx ≈ (h/2)[f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xₙ₋₁) + f(xₙ)], where h = (b-a)/n is the subinterval width, n is the number of subintervals, and x₀, x₁, ..., xₙ are the equally-spaced points from a to b. The first and last terms have coefficient 1; all interior terms have coefficient 2.

Single trapezoid area: For one interval from x₁ to x₂ with width h = x₂ - x₁, the trapezoid area is (h/2)[f(x₁) + f(x₂)]. This is the average height times the width. Example: f(x) = x² from x = 2 to x = 3. h = 1, f(2) = 4, f(3) = 9. Area ≈ (1/2)(4 + 9) = 6.5. Exact integral: ∫[2,3] x²dx = [x³/3][2,3] = 27/3 - 8/3 = 19/3 ≈ 6.333. Error: about 2.6%.

Error estimation: The error in the trapezoidal rule is approximately E ≈ -(b-a)³/(12n²) × f''(ξ) for some ξ in [a,b]. For well-behaved functions, error decreases as 1/n² — doubling the number of subintervals reduces error by a factor of 4. Example: If n = 4 gives error 0.1, then n = 8 gives error about 0.025. This predictable convergence makes the trapezoidal rule reliable.

Comparison to exact integration: For polynomials of degree 1 (linear functions), the trapezoidal rule is exact — trapezoids perfectly match straight lines. For higher-degree polynomials and other functions, there's always some error, but it becomes negligible with sufficient subintervals. The rule is particularly accurate for smooth, slowly-varying functions.

Working through complete examples: Approximate ∫[0,2] (x² + 1)dx with n = 4 subintervals. h = (2-0)/4 = 0.5. Points: x₀ = 0, x₁ = 0.5, x₂ = 1, x₃ = 1.5, x₄ = 2. Function values: f(0) = 1, f(0.5) = 1.25, f(1) = 2, f(1.5) = 3.25, f(2) = 5. Apply formula: Area ≈ (0.5/2)[1 + 2(1.25) + 2(2) + 2(3.25) + 5] = 0.25[1 + 2.5 + 4 + 6.5 + 5] = 0.25[19] = 4.75. Exact value: [x³/3 + x][0,2] = (8/3 + 2) - 0 = 14/3 ≈ 4.667. Error: about 1.8%.

Step-by-Step Guide to Trapezoidal Rule Approximation

  1. Identify the integration bounds and function. Determine a (lower bound), b (upper bound), and f(x) (the function to integrate). Example: Integrate f(x) = √x from a = 1 to b = 4. Write down the function clearly — you'll need to evaluate it at multiple points.
  2. Choose the number of subintervals n. More subintervals give better accuracy but require more calculations. Start with n = 4 or n = 10 for reasonable accuracy. For high precision, use n = 100 or more. Example: Choose n = 6 subintervals for integrating √x from 1 to 4.
  3. Calculate the subinterval width h. h = (b - a) / n. Example: h = (4 - 1) / 6 = 3 / 6 = 0.5. Each subinterval is 0.5 units wide. This width determines how finely you're sampling the function.
  4. Generate the x-values. Starting from x₀ = a, add h repeatedly: x₁ = a + h, x₂ = a + 2h, ..., xₙ = a + nh = b. Example: x₀ = 1, x₁ = 1.5, x₂ = 2, x₃ = 2.5, x₄ = 3, x₅ = 3.5, x₆ = 4. You should have n + 1 points (including both endpoints).
  5. Evaluate the function at each x-value. Calculate f(x₀), f(x₁), ..., f(xₙ). Example: f(1) = 1, f(1.5) ≈ 1.225, f(2) ≈ 1.414, f(2.5) ≈ 1.581, f(3) ≈ 1.732, f(3.5) ≈ 1.871, f(4) = 2. Keep several decimal places for accuracy.
  6. Apply the trapezoidal formula. Area ≈ (h/2)[f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xₙ₋₁) + f(xₙ)]. Example: Area ≈ (0.5/2)[1 + 2(1.225) + 2(1.414) + 2(1.581) + 2(1.732) + 2(1.871) + 2] = 0.25[1 + 2.45 + 2.828 + 3.162 + 3.464 + 3.742 + 2] = 0.25[18.646] ≈ 4.662. Exact value: ∫[1,4] √x dx = [2x^(3/2)/3][1,4] = (2×8/3) - (2×1/3) = 14/3 ≈ 4.667. Error: about 0.1%.

Real-World Trapezoidal Rule Examples

Example 1: Distance from Velocity Data. A car's velocity is measured every 5 seconds: v(0) = 0, v(5) = 12, v(10) = 18, v(15) = 22, v(20) = 25 m/s. Find total distance traveled. Distance = ∫[0,20] v(t)dt ≈ (5/2)[0 + 2(12) + 2(18) + 2(22) + 25] = 2.5[0 + 24 + 36 + 44 + 25] = 2.5[129] = 322.5 meters. The trapezoidal rule integrates the velocity data to find displacement, even without a formula for v(t).

Example 2: Work Done by Variable Force. A spring requires force F(x) = 10x + 2x² newtons to compress x meters. Find work done compressing from x = 0 to x = 0.5 m. Use trapezoidal rule with n = 5. h = 0.1. F(0) = 0, F(0.1) = 1.02, F(0.2) = 2.08, F(0.3) = 3.18, F(0.4) = 4.32, F(0.5) = 5.5. Work ≈ (0.1/2)[0 + 2(1.02) + 2(2.08) + 2(3.18) + 2(4.32) + 5.5] = 0.05[0 + 2.04 + 4.16 + 6.36 + 8.64 + 5.5] = 0.05[26.7] = 1.335 joules. Exact: ∫[0,0.5] (10x + 2x²)dx = [5x² + 2x³/3][0,0.5] = 1.25 + 0.083 = 1.333 J. Error: 0.15%.

Example 3: Consumer Surplus in Economics. Demand function is P(q) = 100 - 2q - 0.1q². At market price P = 60, quantity is q = 20 (solving 60 = 100 - 2q - 0.1q²). Consumer surplus = ∫[0,20] (100 - 2q - 0.1q²)dq - (60 × 20). Using trapezoidal rule with n = 10: h = 2. Evaluate P at q = 0, 2, 4, ..., 20. Sum the trapezoids, then subtract total expenditure (€1,200). This gives the net benefit consumers receive from purchasing at market price.

Example 4: Probability from Normal Distribution. Find P(0 < Z < 1.5) for standard normal distribution. The PDF is f(z) = (1/√2π)e^(-z²/2). This has no elementary antiderivative, so numerical integration is required. Using trapezoidal rule with n = 30 from z = 0 to z = 1.5: h = 0.05. Evaluate the PDF at 31 points, apply the formula. Result ≈ 0.4332, matching standard normal tables. This is how statistical software computes probabilities.

Example 5: Area of Irregular Land Plot. Surveyors measure the width of a plot at 10-meter intervals: 0, 15, 22, 28, 25, 18, 0 meters (starting and ending at boundary). Total area ≈ (10/2)[0 + 2(15) + 2(22) + 2(28) + 2(25) + 2(18) + 0] = 5[0 + 30 + 44 + 56 + 50 + 36 + 0] = 5[216] = 1,080 m². This is exactly how land surveyors compute areas from field measurements — the trapezoidal rule applied to real data.

Common Mistakes in Trapezoidal Rule Calculations

Forgetting the coefficient 2 for interior points. Wrong: (h/2)[f(x₀) + f(x₁) + f(x₂) + ... + f(xₙ)]. Correct: (h/2)[f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xₙ₋₁) + f(xₙ)]. Only the first and last terms have coefficient 1; all interior terms are multiplied by 2. Missing this factor underestimates the area significantly.

Using wrong subinterval width. h must equal (b - a) / n, not (b - a) / (n - 1). For integrating from 0 to 4 with n = 4 subintervals: h = 4/4 = 1, giving points 0, 1, 2, 3, 4 (5 points, 4 intervals). Using h = 4/3 ≈ 1.33 would give wrong spacing and incorrect area.

Counting intervals vs. points incorrectly. n subintervals require n + 1 points (including both endpoints). For n = 4, you need 5 function evaluations: f(x₀), f(x₁), f(x₂), f(x₃), f(x₄). Confusing intervals with points leads to missing the final point or adding an extra one.

Not using enough subintervals for curved functions. For highly curved functions (rapidly changing second derivative), small n produces large errors. Example: integrating sin(x) from 0 to π with n = 2 gives area ≈ (π/4)[0 + 2(1) + 0] = π/2 ≈ 1.57, but exact value is 2. Error is 21%! Use n = 10 or more for such functions: n = 10 gives area ≈ 1.98, error only 1%.

Pro Tips for Trapezoidal Rule Integration

Use even number of subintervals for Simpson's rule upgrade. If you need better accuracy, Simpson's rule (which uses parabolas instead of lines) requires even n and gives much better results for smooth functions. Compute trapezoidal first, then apply Simpson's if needed. Simpson's rule error decreases as 1/n⁴ vs. trapezoidal's 1/n².

Exploit symmetry when possible. If f(x) is symmetric about the midpoint of [a,b], you can integrate half the interval and double the result. For even functions integrated from -a to a: ∫[-a,a] f(x)dx = 2∫[0,a] f(x)dx. This cuts computation in half while maintaining accuracy.

Check convergence by doubling n. Compute the integral with n subintervals, then with 2n subintervals. If results agree to your desired precision, you have enough subintervals. If not, double again. Example: n = 10 gives 4.65, n = 20 gives 4.666, n = 40 gives 4.6667 — convergence achieved at 4.667.

Use for tabulated data without formulas. The trapezoidal rule shines when you have data points but no function formula — experimental measurements, financial data, sensor readings. Just plug the y-values into the formula. This makes it invaluable for real-world applications where functions aren't known analytically.

Frequently Asked Questions

For smooth functions, n = 10 to 20 often gives 1-2% accuracy. For high precision (0.1% or better), use n = 100 or more. For rough estimates, n = 4 to 6 suffices. The best approach: compute with n, then 2n, then 4n until successive results agree to your desired precision. Modern computers can handle n = 1000+ instantly.

The trapezoidal rule is exact for linear functions (degree 1 polynomials) because trapezoids perfectly match straight lines. For constants (degree 0), it's also exact. For quadratics and higher, there's always some error, though it becomes negligible with sufficient subintervals. Simpson's rule is exact for cubics (degree 3).

Yes, if f(x) is negative over the integration interval. The trapezoidal rule computes the signed area — positive where f(x) > 0, negative where f(x) < 0. For ∫[0,2π] sin(x)dx, the trapezoidal rule correctly gives approximately 0 (positive area from 0 to π cancels negative area from π to 2π).

Trapezoidal rule averages the left and right Riemann sums, giving better accuracy than either alone. Left Riemann: uses left endpoint of each interval. Right Riemann: uses right endpoint. Trapezoidal: uses both endpoints averaged. For monotonic functions, the true integral lies between left and right Riemann sums, and trapezoidal is typically closer to the true value.

You may also find these calculators useful: Simpson's Rule Calculator, Riemann Sum Calculator, Integral Calculator, Area Under Curve Calculator.

Written and reviewed by the CalcToWork editorial team. Last updated: 2026-04-29.

Frequently Asked Questions

For smooth functions, n = 10 to 20 often gives 1-2% accuracy. For high precision (0.1% or better), use n = 100 or more. For rough estimates, n = 4 to 6 suffices. The best approach: compute with n, then 2n, then 4n until successive results agree to your desired precision. Modern computers can handle n = 1000+ instantly.
The trapezoidal rule is exact for linear functions (degree 1 polynomials) because trapezoids perfectly match straight lines. For constants (degree 0), it's also exact. For quadratics and higher, there's always some error, though it becomes negligible with sufficient subintervals. Simpson's rule is exact for cubics (degree 3).
Yes, if f(x) is negative over the integration interval. The trapezoidal rule computes the signed area — positive where f(x) > 0, negative where f(x) < 0. For ∫[0,2π] sin(x)dx, the trapezoidal rule correctly gives approximately 0 (positive area from 0 to π cancels negative area from π to 2π).
Trapezoidal rule averages the left and right Riemann sums, giving better accuracy than either alone. Left Riemann: uses left endpoint of each interval. Right Riemann: uses right endpoint. Trapezoidal: uses both endpoints averaged. For monotonic functions, the true integral lies between left and right Riemann sums, and trapezoidal is typically closer to the true value.