Ad Space — Top Banner

Area Between Curves Calculator

Compute the area between two curves f(x) and g(x) over an interval using numerical integration.
Supports polynomials, sin, cos, exp, and ln.

Area Between Curves

The area between two curves f(x) and g(x) on the interval [a, b] is the integral of the absolute difference:

A = ∫[a, b] |f(x) − g(x)| dx

The absolute value is what distinguishes “area” from “signed integral.” If you drop the absolute value, regions where g is above f contribute negatively and can cancel regions where f is above g. The signed integral is sometimes what you want (net displacement, net work, net flux); the area is usually what teachers ask for and what economists actually want when they’re computing consumer surplus or producer surplus.

The tricky part is the crossings. If the two curves cross somewhere inside [a, b], the “top” curve switches. By hand, you’d find the crossing points by solving f(x) = g(x), split the interval at each crossing, and integrate the appropriate (top − bottom) over each piece. This calculator does it numerically instead: it evaluates |f − g| at 1000 points across the interval and applies Simpson’s rule. That handles any number of crossings automatically without needing to solve f = g symbolically.

Worked example — the classic. Find the area between y = x² and y = x on [0, 1]. The line y = x sits above the parabola in this interval (at x = 0.5, the line is 0.5 and the parabola is 0.25). The exact area is ∫(x − x²) dx from 0 to 1 = [x²/2 − x³/3] from 0 to 1 = 1/2 − 1/3 = 1/6 ≈ 0.1667. The calculator should agree to four or five decimal places.

Worked example with a crossing. Between y = sin(x) and y = cos(x) on [0, π], the two curves cross at x = π/4 where both equal √2/2. Before the crossing, cos is above sin; after, sin is above cos. The total area is 2√2 ≈ 2.828. If you forgot the absolute value, the signed integral would give a smaller wrong answer because the two halves partially cancel.

Vertical slices vs horizontal slices. This calculator integrates with respect to x — vertical strips of width dx. Some problems are easier as horizontal strips (dy), particularly when one curve is a vertical line or a function is more easily written as x = h(y). For those cases, swap your axes mentally and put the y-function into f or g; the math is the same.

Practical uses. Economics relies on this for consumer and producer surplus (the area between a demand curve and a price line). Physics uses it for work done by a varying force (area between a force-distance graph and the x-axis). Probability uses it for the difference between two distributions. In numerical analysis, the area between a discretised approximation and the true continuous function is the error.

Quick sanity check. If you pick f = g (or both the same function with identical coefficients), the area should be exactly 0. If you make g a flat line and f a parabola opening up, you should see the parabola dive below the line near its vertex, then climb above as you go outward; the result depends on whether your interval captures the crossings.


Ad Space — Bottom Banner

Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.