Skip to content
Brainlag

Theme

Colour

← All simulations

Integration as the area under a curve

A definite integral is the signed area between a curve and the x-axis. Fill it with strips, add them up, and watch the total close in on the exact value as the strips get thinner.

Just need the number? Graphing Calculator

Error against n (log scales)

Readouts

What's happening

Split the interval from a to b into n strips of width h = (b − a)/n. A rectangle on each strip, with its height taken at the left edge, the right edge or the middle, gives a Riemann sum. Joining the tops with straight lines gives the trapezium rule, and fitting a parabola through each pair of strips gives Simpson's rule. As n grows, every one of these sums tends to the same limit: the definite integral ∫ f(x) dx from a to b, which you can also get exactly from an antiderivative F, as F(b) − F(a). Area below the axis counts as negative, which is why it is shaded in pink. How fast the error shrinks depends on the rule: doubling n halves the error of the left and right sums, quarters it for the midpoint and trapezium rules, and divides it by 16 for Simpson's rule. On log scales those become straight lines with slopes −1, −2 and −4.

∫ f(x) dx from a to b = F(b) − F(a)trapezium: ½h [y₀ + 2(y₁ + … + yₙ₋₁) + yₙ]Simpson: ⅓h [y₀ + 4y₁ + 2y₂ + … + 4yₙ₋₁ + yₙ]

A-Level Maths (AQA, Edexcel, OCR): definite integrals as areas, areas below the x-axis, the trapezium rule and whether it over or under estimates. Further Maths and first-year numerical analysis: Simpson's rule and error orders.

Work through the numbers with Scientific Calculator.

Challenge

Predict first: with the trapezium rule on ∫ x² dx from 0 to 2, how many times smaller does the error get when you double n from 4 to 8? And with Simpson's rule? Type your factor into the box, then press Double n.

FAQ

How do I use the trapezium rule?
Pick n strips of width h = (b − a)/n, work out the heights y₀ to yₙ at the strip edges, then area ≈ ½h [y₀ + yₙ + 2(y₁ + y₂ + … + yₙ₋₁)]. For ∫ x² dx from 0 to 1 with n = 4: h = 0.25, the heights are 0, 0.0625, 0.25, 0.5625, 1, and the estimate is 0.34375 against the exact 1/3.
Does the trapezium rule overestimate or underestimate?
If the curve bends upwards (convex, f'' > 0) each straight top sits above the curve, so it overestimates. If it bends downwards (concave, f'' < 0) it underestimates. The midpoint rule does the opposite, with about half the error.
Why is area below the x-axis negative?
The integral adds up f(x) times the strip width, and f(x) is negative there. To find the actual area between the curve and the axis, integrate each part separately and add their sizes. The Advanced readouts show both parts.
Why is Simpson's rule so much more accurate?
It fits a parabola through each set of three points, so it is exact for every polynomial up to degree 3, and its error is about h⁴(b − a)f''''/180. Halving h divides the error by 16. It needs an even number of strips because each parabola covers two.
What upper limit b makes the area under y = x² from 0 to b equal to 9?
The integral of x² from 0 to b is b³/3, so b³/3 = 9, b³ = 27 and b = 3. In Solve for, pick b for an area, set a = 0 and the target to 9. For curves like x³ or sin x it lists every b that works.