Numerical Integration & Area Under Curve Calculator
Calculate the area under a curve numerically using the trapezium rule or Simpson's rule. Enter y-values at equally spaced x-intervals.
As an Amazon Associate and CJ Affiliate publisher we earn from qualifying purchases. Prices and availability may vary.
Numerical Integration Guide
What do I need to know about The Trapezium Rule?
Area ≈ h/2 × (y₀ + 2y₁ + 2y₂ + ... + 2y_{n-1} + y_n). Where h = (b-a)/n is the strip width. The first and last ordinates appear once; all others appear twice. This estimates the area by approximating each strip as a trapezoid. Accuracy: the trapezium rule overestimates for convex curves and underestimates for concave curves. The error is proportional to h² — halving h quarters the error. More strips = more accurate. Example: y = x² from 0 to 4 with 4 strips (h=1). y values: 0, 1, 4, 9, 16. Area = h/2 × [y₀ + 2(y₁+y₂+y₃) + y₄] = 0.5 × [0 + 2(1+4+9) + 16] = 22, a reasonable approximation to the true integral value of 21.33.
What should I know about Simpson's Rule?
Area ≈ h/3 × (y₀ + 4y₁ + 2y₂ + 4y₃ + ... + 4y_{n-1} + y_n). Requires an even number of strips (odd number of ordinates). Weights alternate 4, 2, 4, 2... between the inner points. Simpson's rule fits parabolas through each triplet of consecutive points — much more accurate than the trapezium rule for smooth functions. The error is proportional to h⁴ — halving h gives 16× reduction in error. For the same example (x² from 0 to 4 with 4 strips): Area ≈ 1/3 × (0 + 4×1 + 2×4 + 4×9 + 16) = 1/3 × 64 = 21.33 — matching the exact integral value exactly, since Simpson's rule is exact for any quadratic function.
When to Use Each Method?
Trapezium rule: when you have measured data at equally spaced intervals and cannot choose the method. When you have an odd number of strips. When a quick estimate is sufficient. Simpson's rule: when you need higher accuracy. When the function is smooth. Must have an even number of strips (n must be even). A-level maths: both methods are in the A-level syllabus. Simpson's rule gives much better accuracy for most smooth functions — typically 10-100 times more accurate than the trapezium rule for the same number of strips, which is why it's the preferred numerical method wherever the function is reasonably smooth.
What's the key thing to understand about Improving Accuracy?
Strategies to improve numerical integration accuracy: increase the number of strips (most straightforward). Use Simpson's rule instead of trapezium where possible. Use composite rules: apply Simpson's rule to smaller sub-intervals. Check convergence: if doubling the strips gives a noticeably different answer, the current accuracy is insufficient. Upper and lower bounds: for monotone functions, trapezium rule gives either an overestimate or underestimate — the average of upper and lower rectangle (trapezoidal) estimates usually cancels out much of this error.
What's the key thing to understand about Area Between Two Curves?
To find the area trapped between two curves f(x) and g(x) over an interval [a, b], integrate the difference between whichever function is on top and whichever is on the bottom: Area = ∫ₐᵇ [f(x) - g(x)] dx, where f(x) ≥ g(x) on that interval. If the curves cross within the interval, you must split the integral at each crossing point and take the absolute value of each piece, because treating the whole span as one integral would let positive and negative contributions cancel out incorrectly. This technique extends the single-curve "area under a curve" idea to real comparative questions — for example, the area between a supply curve and a demand curve represents economic surplus, and the area between two velocity-time graphs represents the difference in distance traveled by two objects.
What's the key thing to understand about Negative Area and Signed Regions?
A definite integral ∫ₐᵇ f(x) dx gives the signed area between the curve and the x-axis — regions below the x-axis contribute negatively. This means that if f(x) dips below zero somewhere in [a, b], the integral's value is the area above the axis minus the area below it, not the total physical area. If you want the actual geometric area regardless of sign, you must split the integral at each x-intercept, take the absolute value of each piece, and sum them. Numerical methods like the trapezium rule and Simpson's rule computed directly on f(x) will also return this signed value, so when a calculator reports a small or negative "area," it usually means the curve crosses the axis within the chosen interval.
What should I know about Error Bounds for the Trapezium and Simpson's Rules?
Both the trapezium rule and Simpson's rule approximate the true area under a curve, and understanding how their errors shrink as the number of strips increases helps explain why Simpson's rule is usually far more accurate for the same amount of computation. The trapezium rule's error is proportional to h², where h is the width of each strip, and also depends on the size of the function's second derivative (how sharply curved the function is) across the interval — a highly curved function produces a larger error than a nearly straight one for the same strip width. Halving the strip width (doubling the number of strips) therefore roughly quarters the trapezium rule's error. Simpson's rule, which fits parabolas rather than straight lines through each pair of strips, has an error proportional to h⁴ and depends on the function's fourth derivative instead; halving the strip width shrinks Simpson's rule's error by a factor of roughly sixteen. This is why Simpson's rule converges to the true area so much faster than the trapezium rule as the number of strips increases, and why it is generally preferred whenever the integrand is smooth enough for its fourth derivative to behave reasonably — though the trapezium rule remains simpler and can be more robust for functions with sharp kinks.
Worked Example: Trapezium Rule vs. Simpson's Rule
Estimate the area under f(x) = x² + 1 between x = 0 and x = 4, using 4 strips (n = 4, so strip width h = 1). The function values at each x are: x = 0, 1, 2, 3, 4 → f(x) = 1, 2, 5, 10, 17 Trapezium rule: Area ≈ (h/2)[f(x₀) + f(xₙ) + 2(sum of interior values)] = (1/2)[1 + 17 + 2(2 + 5 + 10)] = (1/2)[18 + 34] = (1/2)(52) = 26.0 Simpson's rule (needs an even number of strips, which 4 satisfies): Area ≈ (h/3)[f(x₀) + f(xₙ) + 4(odd-indexed) + 2(even-indexed interior)] = (1/3)[1 + 17 + 4(2 + 10) + 2(5)] = (1/3)[18 + 48 + 10] = (1/3)(76) = 25.333... The exact value by direct integration is ∫₀⁴(x²+1)dx = [x³/3 + x]₀⁴ = (64/3 + 4) - 0 = 25.333... — Simpson's rule gives the exact answer here (because it fits a parabola exactly, and our function is itself quadratic), while the trapezium rule overestimates by 0.667, about 2.6% high, because straight-line segments sit slightly above a curve that bends upward (is convex).
Choosing Strip Count: Accuracy vs. Effort
| Method | Strips (n) | Error order | Best for |
|---|---|---|---|
| Trapezium rule | Any n | O(h²) | Quick estimates, linear-ish curves |
| Simpson's rule | Even n only | O(h⁴) | Smooth curves, much higher accuracy per point |
| Trapezium, doubled n | 2n | Error ÷ 4 | Refining a trapezium estimate |
| Simpson's, doubled n | 2n (even) | Error ÷ 16 | Refining a Simpson estimate |
Doubling the number of strips quarters the error for the trapezium rule but divides Simpson's error by 16 — which is why Simpson's rule converges so much faster and is almost always preferred when the function is smooth. The trade-off is that Simpson's rule needs function values at an even number of strips (an odd number of points) to pair the required 1-4-2-4-1 weighting pattern correctly; if a problem forces an odd strip count, the trapezium rule remains the simpler fallback.
Worked Example: Area Between Two Curves
Find the area enclosed between f(x) = x + 2 and g(x) = x² between their points of intersection. Setting them equal: x + 2 = x² → x² - x - 2 = 0 → (x-2)(x+1) = 0, giving intersection points at x = -1 and x = 2. Between these points, the line sits above the parabola, so the area is ∫₋₁² [(x+2) - x²] dx. The antiderivative is F(x) = x²/2 + 2x - x³/3. F(2) = 4/2 + 4 - 8/3 = 2 + 4 - 2.667 = 3.333 F(-1) = 0.5 - 2 - (-0.333) = 0.5 - 2 + 0.333 = -1.167 Area = F(2) - F(-1) = 3.333 - (-1.167) = 4.5 square units The key step that trips people up is identifying which function is 'on top' across the whole interval — here, checking any point between -1 and 2 (say x=0: line gives 2, parabola gives 0) confirms the line is above the parabola throughout, so (top - bottom) = (x+2) - x² is the correct integrand with no sign changes to worry about across this particular interval.