Skip to content

Integral Calculator (Numeric Definite Integrals)

Evaluate definite integrals numerically, including improper ones, find the area between two curves and compare left, right, midpoint and trapezoid Riemann sums.

Calculator Details

Integral:…See results ↓

A definite integral, the area between two curves, or a Riemann sum

Use x, + − * / ^ and brackets; sin, cos, tan (radians), sqrt, exp, ln (natural log), log (base 10), abs, pi, e. 2x means 2·x

A number or constant: 0, -1.5, pi/2, e, or -inf for −∞

A number or constant: 2, pi, 2pi, or inf for ∞

Adaptive Gauss–Kronrod (QUADPACK's method, with an error estimate) or adaptive Simpson's rule; infinite limits always use Gauss–Kronrod

Your Results

Integral: …

Integral

…

Loading the integration engine…

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

How This Calculator Works

How it's calculated

The definite integral ∫ₐᵇ f(x) dx is the net signed area between the graph of f and the x-axis from a to b: area above the axis counts as positive, area below as negative. This calculator finds it numerically, without an antiderivative. Adaptive Gauss–Kronrod quadrature (the method of the QUADPACK library) evaluates f at 15 carefully chosen points on an interval and compares the result with a 7-point Gauss rule; the difference estimates the error, and the interval with the largest error is halved until the total is below about 10⁻¹². Adaptive Simpson's rule fits parabolas through three points and halves intervals the same way.

An infinite limit is turned into a finite one by substitution, for example x = a + (1 − t)/t maps t in (0, 1] onto [a, ∞). The area between two curves is ∫|f − g| dx, split at each crossing. A Riemann sum adds the areas of n rectangles of width Δx = (b − a)/n whose heights are f at the left ends, right ends or midpoints; the trapezoid rule averages the two end heights.

Frequently Asked Questions

Does this calculator find antiderivatives?

No. It evaluates definite integrals numerically: you give the limits and it returns the number, with an error estimate. It does not give the indefinite integral (the antiderivative formula with + C). Numeric integration works for functions that have no antiderivative in elementary terms, such as e^(−x²) or sin(x)/x.

How accurate is the answer?

Usually to 10 significant figures or better. The calculator compares a 15-point Gauss–Kronrod rule with a 7-point Gauss rule on each piece and keeps halving the worst piece until the estimated error is about 10⁻¹² of the answer. ∫₀² x² dx comes out as 2.666666667, which is 8/3 to the digits shown, with an error estimate of 0.0e+0.

What is the difference between the integral and the area?

The definite integral is the net signed area: parts below the x-axis count as negative. ∫₋₁¹ x³ dx = 0 because the two halves cancel, but the total area between the curve and the axis is ∫|x³| dx = 0.5. The calculator shows both.

Can it do improper integrals with infinite limits?

Yes: type inf or -inf as a limit. The infinite range is mapped onto a finite one by a change of variable before integrating. ∫₀^∞ e^(−x²) dx gives 0.8862269255, which is √π/2. If an improper integral diverges, as ∫₁^∞ 1/x dx does, the calculator says it did not converge instead of showing a number.

How do I find the area between two curves?

Choose "Area between two curves", enter both functions and the limits. The calculator integrates |f(x) − g(x)|, splitting the interval wherever the curves cross so that no part cancels another. The area between y = x and y = x² from 0 to 1 is 0.1666666667, or 1/6.

What is a Riemann sum?

An estimate of the integral by rectangles: split [a, b] into n equal pieces of width Δx and add Δx × f(x) using the left end, right end or midpoint of each piece. For x² on [0, 2] with n = 4, the left sum is 1.75 and the midpoint sum 2.625, against 2.666666667 for the integral. As n grows, every sum approaches the integral.

Which is more accurate, the midpoint or the trapezoid rule?

For smooth functions the midpoint rule is usually about twice as accurate as the trapezoid rule, and their errors have opposite signs, which is why Simpson’s rule (a weighted average of the two) is much better than either. Both errors shrink with the square of Δx: doubling n cuts the error by about four.

How do I enter limits like π/2?

Limits accept constant expressions: pi/2, 2pi, e, sqrt(2), -1.5, or inf and -inf. Functions use x as the variable, with trig in radians, log for base 10 and ln for the natural logarithm.

Numeric definite integrals only: values come from adaptive Gauss–Kronrod (7, 15) quadrature as in QUADPACK, or adaptive Simpson's rule, in double precision with an error estimate, shown to 10 significant figures. Infinite limits use a change of variable; an integral that diverges, or has a singularity inside the interval that the method can't resolve, is reported as not converged. Trig is in radians; log means base 10 and ln the natural log. Not included: symbolic antiderivatives (indefinite integrals) and step-by-step integration techniques, double and triple integrals, line integrals, and complex-valued functions.

Integral Calculator: Numeric Definite Integrals, Area Between Curves and Riemann Sums

By FindMySum · Last reviewed

An integral calculator finds the value of a definite integral: the net area between a curve and the x-axis over an interval. This one does it numerically, which means it works for almost any function you can type, including ones with no antiderivative in closed form and integrals with infinite limits. It also finds the area between two curves and shows how left, right, midpoint and trapezoid Riemann sums approach the true value.

It does not give antiderivatives (indefinite integrals). For those you need a computer algebra system or integration by hand; this page is the place to check the number your antiderivative should produce.

What a definite integral measures

For a function f on [a, b], the definite integral ∫ₐᵇ f(x) dx adds up f(x) × dx across the interval. Geometrically it is the net signed area: area above the x-axis counts as positive and area below as negative. The fundamental theorem of calculus says that if F is an antiderivative of f, the integral equals F(b) − F(a). That is how integrals are evaluated by hand, and it is the standard against which a numeric answer can be checked.

The net signed area and the total area are different numbers whenever f changes sign. ∫₋₁¹ x³ dx = 0, because the negative half cancels the positive half, but the total area between the curve and the axis is ∫₋₁¹ |x³| dx = 1/2. The calculator reports both.

How numeric integration works

Gauss–Kronrod quadrature. A Gauss rule picks the points where f is evaluated, and the weights it gets, so that it is exact for polynomials of as high a degree as possible: the 7-point Gauss rule is exact up to degree 13. The Kronrod extension adds 8 more points to make a 15-point rule exact up to degree 22, reusing the 7 Gauss points. The difference between the two answers estimates the error. QUADPACK, the Fortran library behind integration routines in many scientific packages, uses this pair adaptively: it keeps splitting the piece with the largest error until the total is small enough. This calculator follows the same strategy, aiming for an error near 10⁻¹² of the answer.

Adaptive Simpson's rule. Simpson's rule fits a parabola through the two ends and the midpoint of an interval. The adaptive version compares one Simpson step with two half-size steps and splits the interval wherever they disagree. It is exact for cubics and very good for smooth functions, but it needs the end-point values, so it can't handle an integrand that is infinite at a limit.

Infinite limits. An integral to infinity is turned into an integral over a finite interval by a change of variable. For [a, ∞) the substitution x = a + (1 − t)/t maps t from 1 down to 0 onto x from a up to ∞; the integrand picks up a factor 1/t². For the whole real line, x = t/(1 − t²) maps (−1, 1). If the transformed integral doesn't settle down, the original integral diverges and the calculator says so.

Worked example: ∫₀² x² dx

The calculator opens with f(x) = x² from 0 to 2.

  1. By hand: an antiderivative of x² is x³/3, so the integral is 2³/3 − 0 = 8/3 = 2.666666667.
  2. Numerically: the Gauss–Kronrod rule is exact for polynomials, so a single 15-point evaluation gives 2.666666667 with an error estimate near zero.
  3. Total area: x² is never negative on [0, 2], so the total area equals the integral.

Switch to Riemann sums with n = 4. The interval splits into four pieces of width Δx = 0.5:

  • Left sum: 0.5 × (f(0) + f(0.5) + f(1) + f(1.5)) = 0.5 × (0 + 0.25 + 1 + 2.25) = 1.75.
  • Right sum: 0.5 × (0.25 + 1 + 2.25 + 4) = 3.75.
  • Midpoint sum: 0.5 × (0.0625 + 0.5625 + 1.5625 + 3.0625) = 2.625.
  • Trapezoid rule: the average of the left and right sums, 2.75.

The left sum falls short by 0.917 and the right sum overshoots by 1.083 because x² is increasing. The midpoint sum is off by only 0.042 and the trapezoid by 0.083, in the opposite direction; that pattern of half the error with the opposite sign is why Simpson's rule, which combines them, is so accurate.

Area between two curves

To find the area enclosed between f and g from a to b, integrate the distance between them, |f(x) − g(x)|. If you integrate f − g without the absolute value, regions where g is on top subtract from regions where f is on top. The calculator finds every crossing inside the interval, integrates each piece separately and adds the absolute values.

For f(x) = x and g(x) = x² on [0, 1], the line is above the parabola throughout, so the area is ∫₀¹ (x − x²) dx = 1/2 − 1/3 = 1/6. For sin x and cos x on [0, π], the curves cross at π/4; the area is (√2 − 1) + (1 + √2) = 2√2 ≈ 2.828, while the signed integral of sin x − cos x is only 2.

Improper integrals

An integral is improper when a limit is infinite or the integrand blows up somewhere in the interval. It converges when the limit of ordinary integrals exists. Two classic results:

  • ∫₁^∞ 1/x² dx = 1 converges, but ∫₁^∞ 1/x dx diverges: 1/x shrinks too slowly. In general ∫₁^∞ 1/xᵖ dx converges only for p > 1.
  • ∫₀¹ 1/√x dx = 2 converges although 1/√x is infinite at 0, because the spike is narrow enough.

The Gaussian integral ∫₀^∞ e^(−x²) dx = √π/2 ≈ 0.8862 is a good test: it has no elementary antiderivative, but the calculator returns it to full precision.

When numeric integration struggles

Functions that oscillate very fast, such as sin(1/x) near 0, functions with jumps, and integrands that are nearly infinite inside the interval can all slow the adaptive method down or defeat it. Watch the error estimate: if it is large compared with the answer, split the interval at the difficult point, or check the graph of the function first with the graphing calculator.

More questions

Why is a numeric answer useful if I can integrate by hand?

It is a fast check on hand work, and many integrals have no closed form at all. The bell-curve integral of e^(−x²), sin(x)/x and √(1 + x³) have no antiderivatives in elementary functions, yet their definite integrals are ordinary numbers that numeric methods find to ten or more digits.

What does the error estimate mean?

It is the method's own estimate of how far the answer could be from the true integral, from comparing two rules of different accuracy on each piece. A value like 3e-15 means the answer is reliable to about the last digit shown. A large error estimate is a warning: the function may have a singularity, oscillate wildly or diverge.

What happens if the function has a vertical asymptote inside the interval?

If the integral still exists, as for 1/√x near 0, the adaptive method keeps halving the pieces near the trouble spot and usually converges. If it doesn't exist, as for 1/x across 0, or the function is undefined at a point the method uses, the calculator reports an error or no convergence. Split the integral at the asymptote and treat each side as an improper integral.

Can I integrate with respect to a variable other than x?

Type the function in x: the name of the variable doesn't change a definite integral's value. ∫₀¹ t² dt and ∫₀¹ x² dx are both 1/3. Other letters, such as constants a or k, are not accepted; put their numeric values in instead.

Why does the left Riemann sum underestimate for an increasing function?

On each piece an increasing function is lowest at its left end, so every left-endpoint rectangle sits under the curve and the sum falls short. The right-endpoint sum overestimates for the same reason. For a decreasing function the roles swap, and the midpoint rule sits in between.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy