What is the area between two curves?
Type two curves. Give an interval [a, b], or leave it empty to use the points where the curves cross. The page gives the area between the two curves, exactly and as a decimal.
- Area
- 21.33333333
The area between 9 - (x/2)^2 and 6 - x is 21.33333333.
- Exact area
- 64/3
- From x =
- -2
- To x =
- 6
Area: 21.33333333. The area between 9 - (x/2)^2 and 6 - x is 21.33333333.
How to calculate
Finds the area between y = f(x) and y = g(x), from a to b or between their crossings.
Worked examples
Each example is checked against the calculator on every build.
- Curve y = f(x) 9 - (x/2)^2, Curve y = g(x) 6 - x gives Area 21.333333, Exact area 64/3, From x = -2, To x = 6.Source: OpenStax (Strang and Herman, 2016), Calculus Volume 1, section 6.1 Areas between Curves, Example 6.2
- Curve y = f(x) x + 4, Curve y = g(x) 3 - x/2, From x = a (optional) 1, To x = b (optional) 4 gives Area 14.25, Exact area 57/4.Source: OpenStax (Strang and Herman, 2016), Calculus Volume 1, section 6.1 Areas between Curves, Example 6.1
How it works
The area between y = f(x) and y = g(x) from x = a to x = b is
Area = ∫ from a to b of |f(x) − g(x)| dx
With h(x) = f(x) − g(x):
- The ends. If you type a and b, they are the ends (a must be less than b; typing only one gives a message on the other). If both are empty, the ends are the first and the last crossing: the zeros of h between −∞ and ∞, found as described below (a break of h is not a crossing). With fewer than two crossings the page asks for a and b.
- The pieces. The interval is split at every crossing strictly between the ends (zeros of h between a and b, found as below).
- Each piece is a definite integral of h, worked out by a computer algebra system (nerdamer, open source) as on the integral calculator: F(end) − F(start) with a checked antiderivative F, compared with a numeric integral of h (Gauss-Kronrod quadrature) to 1 part in 10⁷ of the integral of |h|. A pole of h inside a piece, or a part where h is not a real number, gives no value. The ends and crossings go to the algebra exactly when they are exact, and as decimals when they are not.
- The area is the sum of the absolute values of the pieces, shown to 10 significant figures (rounded half up).
- The exact area is shown when every end and crossing is exact and every piece has an exact value: the pieces' exact values are added with their signs (a piece whose value is negative is subtracted) and simplified by the algebra; it is left out when the simplified form fails its check or holds a rounded number.
The page also shows the ends used, From x = and To x =, as decimals to 10 significant figures.
How the points are found
The zeros and breaks of a function g (a zero: g passes through or touches 0; a break: g jumps, goes to ±∞, or stops being a real number) are found between two ends the ends given in steps 1 and 2 (each end clipped to ±10⁶) in two ways at once.
By the algebra. The computer algebra system solves g(x) = 0. A solution is an exact candidate when it is a number strictly between the ends, is not a rounded number (a whole number past 2⁵³; a fraction p/q, p and q being the numbers that multiply its top and its bottom, such as 288557167/(342919925e), when q after removing its factors 2 and 5 is over 1,000,000, or is over 1 while |p| times it is over 10¹²; or a decimal with more than 12 significant digits), and g is 0 there up to rounding: |g(c)| is at most 10⁻¹² times the sum of the sizes of the terms of g at c (the parts of g joined by + and −). So x² + 10⁻²⁰ has no zero at 0, though the algebra gives one.
On a grid. g is worked out at 8,001 points x₀ to x₈₀₀₀, evenly spaced in asinh x (so they reach ±10⁶ when an end is infinite and bunch up near 0): xᵢ = sinh(u₀ + (u₁ − u₀)(i + 0.3183)/8001), with u₀ and u₁ the asinh of the two ends. For each step from xᵢ to xᵢ₊₁:
- If g is a number at one end of the step and not a number at the other (as ln or √ of a negative number is not), the point where it stops being one is found by halving the step 80 times: a break. A value past the largest computer number, about 1.8 × 10³⁰⁸, still counts as a number with its sign (x e^(−x) and its derivatives for x below about −703), so an overflow is not a break. But when |g| is over 10³⁰⁰ at the end where g is a number (e^x − e^(2x) near x = 355, where e^(2x) overflows and the difference is not a number), the page cannot tell an overflow from the end of the domain and gives no answer (a value is too large).
- If g has opposite signs at the two ends, the sign change is found by halving 80 times. It is a zero if |g| there is at most 10⁻⁶ of the larger of |g(xᵢ)| and |g(xᵢ₊₁)|, and a break otherwise (g jumps or goes through ±∞). If g is past the largest computer number at either end, the page gives no answer (a value is too large).
- If g has one sign at xᵢ, xᵢ₊₁ and xᵢ₊₂ and turns at xᵢ₊₁ (a peak or a dip), the turning point r is found by halving (on the sign of g(x + h) − g(x − h), h = 10⁻⁷ × max(1, |x|)). If g(r) has the other sign, g dips through 0 and back between xᵢ and xᵢ₊₂: two zeros too close together for the grid. Unless the algebra gives at least two exact candidates strictly between xᵢ and xᵢ₊₂ (then they are the zeros), the page gives no answer (two points are too close together). If |g(r)| is at most 10⁻⁹ of the larger of |g(xᵢ)| and |g(xᵢ₊₂)|, g touches 0 there: that is a zero when an exact candidate lies within 10⁻⁶ × max(1, |candidate|) of r, and otherwise the page says a zero could not be confirmed and gives no answer. If |g(r)| is over 10⁶ times that size (or not a number), g peaks through ±∞: a break. A reason to give no answer that turns up on the way (a dip, a touch the algebra does not confirm) is given only after the whole grid, so a function with more than 30 points (sin x) gets "too many points to check".
A zero found on the grid within 10⁻⁶ × max(1, |c|) of an exact candidate c takes its exact value and text; otherwise, when it is within 10⁻⁹ × max(1, |x|) of a fraction p/q with q = 1, 2, 3, 4, 6, 8 or 12 (the first that fits) where g is 0 up to rounding (the rule above), it is shown as p/q; otherwise as ≈ and a decimal to 10 significant figures (rounded half up). A break is shown exactly as p/q when x is within 10⁻⁹ × max(1, |x|) of p/q for q = 1, 2, 3, 4, 6, 8 or 12 (the first that fits) and g is not a real number at p/q or at p/q ± 10⁻⁹ × max(1, |x|) (a pole, a jump, or an end of the domain); otherwise as ≈ and a decimal. An exact candidate that the grid did not find (two zeros inside one step) is added. A zero right next to a pole, inside the same grid step, is found only when the algebra gives it. The same point found twice counts once (a zero before a break). Two different points within 10⁻⁶ × max(1, |x|) of each other give no answer (two points are too close together), and so do two exact candidates that close: x²(x − 10⁻⁷)² has critical numbers at 0, 5 × 10⁻⁸ and 10⁻⁷, which the page does not merge into one. More than 30 points gives no answer (too many points to check).
What you can type
- A number has at most 15 digits in a row. A computer number keeps only about 16 digits, so a longer one (9007199254740993) would stand for a nearby number (9007199254740992), and the page asks for fewer digits instead. Write very large or very small numbers with a power of ten (1e-20).
- The curves f and g use the variable x. Numbers can have decimals (2.5) and powers of ten (1e-3).
- Operations: + − * / and ^ for powers. Brackets group. A number or bracket next to a letter multiplies: 2x, 3(x + 1), x sin(x).
- Constants: pi (or π) and e.
- Functions: sqrt, cbrt, ln (and log, the same natural logarithm), log10, exp, abs (or |x|), sin, cos, tan, sec, csc, cot, asin, acos, atan (arcsin, arccos, arctan also work), sinh, cosh, tanh and their inverses. Angles are in radians. sin x without brackets means sin(x); sin x^2 means sin(x²).
- a and b are numbers or constant expressions (0, 2.5, pi, e), or both empty.
What gets no answer
- Fewer than two crossings with a and b empty (eˣ and x never meet).
- A pole of f − g between the ends, more than 30 crossings (sin x and cos x), or a turn of h that touches 0 without the algebra confirming it.
- A step that fails its check, finds no formula, or takes over 3 seconds.
Worked examples by hand
9 − (x/2)² and 6 − x, between their crossings (OpenStax Calculus Volume 1, section 6.1, Example 6.2). 9 − x²/4 = 6 − x gives x² − 4x − 12 = (x − 6)(x + 2) = 0: the crossings are x = −2 and x = 6, with none between. The area is ∫ from −2 to 6 of (3 + x − x²/4) dx = [3x + x²/2 − x³/12] from −2 to 6 = 18 − (−10/3) = 64/3 = 21.33333333.
x + 4 and 3 − x/2 on [1, 4] (OpenStax Calculus Volume 1, section 6.1, Example 6.1). h(x) = (x + 4) − (3 − x/2) = 3x/2 + 1, positive on [1, 4], so there are no crossings. The area is [3x²/4 + x] from 1 to 4 = 16 − 7/4 = 57/4 = 14.25.
Other questions people ask
How do I find the area between two curves?
Integrate the top curve minus the bottom curve: area = ∫ from a to b of (f(x) − g(x)) dx when f ≥ g on [a, b]. When the curves cross inside [a, b], split the interval at each crossing and integrate |f(x) − g(x)| on each piece, so no part counts as negative area.
How do I find the limits of integration?
When the region is enclosed by the two curves, the limits are the x values where they meet: solve f(x) = g(x). For 9 − (x/2)² and 6 − x, 9 − x²/4 = 6 − x gives x² − 4x − 12 = 0, so x = −2 and x = 6. Leave a and b empty and the page does this.
What if the curves cross more than twice?
With a and b empty, the page uses the first and the last crossing as the limits and splits the interval at the crossings in between. For x³ and x it integrates from −1 to 0 and from 0 to 1 and adds the two areas: 1/4 + 1/4 = 1/2.
Why is the answer not the same as the integral of f − g?
The integral of f − g counts area where g is above f as negative, so the pieces can cancel: from −1 to 1, the integral of x³ − x is 0, while the area between the curves is 1/2. The page adds the size of each piece.
Can I find the area between curves given as x = f(y)?
Swap the letters: the area between x = √y and x = 2 − y is the same as the area between y = √x and y = 2 − x. Type them in x.
How is the answer checked?
Each piece is a definite integral from a computer algebra system, whose value is compared with a numeric integral of f − g. The crossings are found both by the algebra and by a sign scan on a fine grid, so none is missed.