Definite Integral
Enter a function of x and the interval limits a and b. The calculator approximates the definite integral — the signed area under the curve — using composite Simpson's rule, which is accurate even for curved functions.
A numeric answer for any integrable expression
A definite integral measures the signed area between a curve and the x-axis over an interval. Where an antiderivative exists it can be found exactly, but many perfectly ordinary functions have none that can be written down — the bell curve e^(−x²) is the standard example.
This calculator sidesteps that problem by integrating numerically. It evaluates the function at many points across the interval and combines those samples into an estimate, so it returns a figure whether or not a closed form exists.
The tool is deliberately numeric. It does not attempt to find an antiderivative and it does not report one — the output is a single number, which is what you want when the integral is a quantity rather than a step in an algebraic derivation.
That makes it well suited to checking a hand-computed result. If you have applied the fundamental theorem and want reassurance, comparing your exact answer against this approximation catches sign errors and misapplied limits immediately.
How to use this calculator
- Type the integrand as a function of x Use x as the variable and standard notation: ^ for powers, * for multiplication, and named functions such as sin, cos, exp, ln and sqrt. Multiplication is not implied, so write 2*x rather than 2x.
- Enter the lower limit a The left end of the interval. It may be negative, and it may be larger than b — the integral is then negative, following the usual convention.
- Enter the upper limit b The right end. Both limits must be finite numbers: infinite limits are not accepted, so improper integrals cannot be entered directly.
- Read the result as an approximation The answer is prefixed with ≈ rather than =, and deliberately so. It is a numeric estimate, accurate to several significant figures for smooth functions but never an exact symbolic value.
How the integral is computed
The implementation uses composite Simpson's rule with a fixed 1000 subintervals. The interval from a to b is divided into 1000 equal strips of width h = (b − a)/1000, and the function is evaluated at every division point.
Simpson's rule fits a parabola through each consecutive triple of points rather than a straight line, which is why it is far more accurate than the trapezoidal rule for the same number of samples. That parabolic fitting shows up in the weighting: the two endpoints count once, interior points at odd positions count four times, interior points at even positions count twice, and the weighted total is multiplied by h/3.
Because the subinterval count is fixed rather than adaptive, the accuracy depends on how much the function varies across the interval. A smooth curve over a modest range is captured to several significant figures; a function that oscillates rapidly, or a very wide interval, gives the 1000 strips less to work with.
What each input means
- f(x) Integrand — form field “Function f(x)”
- The expression to integrate, written in terms of x. It is parsed and compiled once, then evaluated a thousand times, so it must be defined at every point across the interval.
- a Lower limit — form field “Lower limit a”
- The left end of the interval; any finite real number.
- b Upper limit — form field “Upper limit b”
- The right end, also finite. Swapping a and b negates the result, which is a property of the integral rather than a quirk of the implementation.
Worked examples
Every number below is produced by the same calculation engine the tool above runs. Nothing here is typed by hand, so the walkthrough cannot drift from what you get when you enter the same values yourself.
Area under one arch of the sine curve
Integrate sin(x) from 0 to π. The exact answer is known to be 2, which makes this a clean test of how close the numeric method gets.
Inputs Function f(x) = sin(x), Lower limit a = 0, Upper limit b = 3.14159265
- Integrand f(x) = sin(x)
- Interval from a = 0 to b = 3.14159
- Method Composite Simpson's rule with 1000 subintervals
- Result ∫ ≈ 2
Result ∫ from 0 to 3.14159 ≈ 2
The estimate agrees with the exact value to the displayed precision. Simpson's rule handles a single smooth arch extremely well, because a parabola is a good local approximation to a sine curve over a short strip.
Note that the upper limit is entered as a decimal approximation to π, not as a symbol. The tool takes numeric limits only, so the last digits of the answer inherit the precision of the number you typed.
A function with no elementary antiderivative
Integrate exp(-x^2) from −2 to 2. No antiderivative of this function can be written in terms of elementary functions, so numeric integration is the only practical route.
Inputs Function f(x) = exp(-x^2), Lower limit a = -2, Upper limit b = 2
- Integrand f(x) = exp(-x^2)
- Interval from a = -2 to b = 2
- Method Composite Simpson's rule with 1000 subintervals
- Result ∫ ≈ 1.76416
Result ∫ from -2 to 2 ≈ 1.76416
This is exactly the case the tool exists for. The Gaussian integral is central to probability and statistics, and it can only be evaluated numerically or in terms of the error function, which is itself defined by an integral.
The curve is symmetric about zero, so integrating from 0 to 2 and doubling should give the same figure. That kind of self-check is worth running whenever the exact value is unknown, since it tests the calculation without needing an independent answer.
Reading the result
The result is signed, not an area
Regions below the x-axis contribute negatively. Integrating sin(x) from 0 to 2π gives approximately zero, because the second arch cancels the first. If you want geometric area rather than net signed area, integrate the absolute value or split the interval at each root.
How much of the answer to trust
For a smooth function over a moderate interval, expect several significant figures to be reliable. The ≈ symbol is not decoration: this is a sampled estimate, and the last displayed digit should never be treated as exact.
Where the estimate degrades
A fixed 1000 subintervals cannot adapt. A function with a sharp spike, a near-singularity inside the interval, or rapid oscillation may be sampled too coarsely to capture, and the returned number can then be badly wrong rather than slightly imprecise.
When you would use this
Checking a hand-computed integral
After applying the fundamental theorem, comparing your exact value with this estimate catches the usual errors — a dropped sign, limits substituted the wrong way round, a missing constant factor — in one step.
Quantities defined by an integral
Work done by a varying force, total displacement from a velocity curve, and probability under a density function are all definite integrals. When the integrand comes from measurement rather than algebra, a numeric answer is the only one available.
Assumptions and limitations
What this calculator assumes
- The integrand is defined and finite at every sample point across the closed interval.
- Both limits are finite; infinity is not accepted.
- The function is smooth enough for parabolic segments to approximate it over strips of width (b − a)/1000.
Where it stops being the right tool
- Numeric only: no antiderivative is found or reported, so this cannot be used to show working for an indefinite integral.
- Improper integrals are out of scope, whether the limit is infinite or the integrand is unbounded at an endpoint.
- The subinterval count is fixed, so there is no way to request more accuracy for a difficult integrand.
Common mistakes
Writing implied multiplication
Why it happens. Mathematical notation lets 2x and x sin(x) stand for products, but the parser needs an explicit operator and will reject or misread them.
How to avoid it. Insert the asterisk: 2*x and x*sin(x). The integrand line echoes what was parsed, so comparing it with what you meant catches this straight away.
Expecting geometric area from a curve that crosses the axis
Why it happens. “Area under the curve” is the usual phrase, so a result near zero for an oscillating function reads as an error rather than as cancellation.
How to avoid it. Split the interval at the roots and integrate each piece, or integrate the absolute value of the function, then add the magnitudes.
Integrating across a point where the function is undefined
Why it happens. Something like 1/x from −1 to 1 looks like an ordinary integral, but the integrand blows up at zero. The method still returns a number, because the sample points may step over the singularity.
How to avoid it. Check that the integrand is finite throughout before trusting the figure. Where it is not, the integral is improper and needs a limit argument rather than a numeric estimate.
Key terms
Frequently asked questions
What method does the calculator use?
Composite Simpson's rule with 1000 subintervals. Consecutive triples of sample points are fitted with parabolas rather than straight lines, which gives much better accuracy than the trapezoidal rule for the same number of evaluations.
Can the result be negative?
Yes. The definite integral is a signed area: any part of the curve below the x-axis contributes negatively. Integrating a full period of a sine wave gives approximately zero for exactly this reason.
Which functions can I enter?
Any expression in x built from the arithmetic operators, ^ for powers, and named functions including sqrt, sin, cos, tan, ln, log and exp. Multiplication must be written explicitly with *.
Why is the answer marked with ≈ rather than =?
Because it is a numeric estimate from a finite number of samples, not a symbolic evaluation. For smooth functions it is accurate to several significant figures, but it is never exact and the notation says so honestly.