Definite Integral Calculator
Enter a function and two limits and get the value of the definite integral to about ten digits, with an error estimate, the net and total area, and a graph with the area shaded. Limits can be infinite (type inf), and where the integral has a singularity or diverges the calculator says so instead of printing a wrong number. It runs entirely in your browser. Free, no sign-up.
Use + − * / ^ and brackets. Functions: sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, exp, ln, log (base 10), sqrt, abs. Constants: pi and e.
A number or constant such as 0, −2 or pi/2. Type inf or −inf for an infinite limit.
Results
2
Integral value
2.2E-14
Estimated absolute error
120
Function evaluations
Method
Adaptive Gauss–Kronrod: a 7-point Gauss and a 15-point Kronrod rule on 8 subintervals; their difference estimates the error.
Graph
- y = f(x)
- Area above the axis
- Area below the axis
How to Use the Definite Integral Calculator
- 1. Type the function. Use x as the variable:
sin(x),e^(-x^2),1/sqrt(x),x^2 ln(x). Multiplication can be left out, so2xandx sin xwork. - 2. Enter the limits. Use numbers or constants such as
0,-2orpi/2. For an improper integral, typeinfor-inffor an infinite limit. - 3. Read the value and its error. The estimated absolute error says how many of the printed digits to trust. If f changes sign, the total unsigned area ∫|f| is shown beside the net signed area.
- 4. Check the notes and the graph. Any singularity, infinite limit or convergence problem is reported in plain words, and the graph shades the area above the axis (blue) and below it (orange).
How the Integral Is Computed
The default method is adaptive Gauss–Kronrod, the scheme behind QUADPACK. On each subinterval a 7-point Gauss rule and a 15-point Kronrod rule are evaluated at nested points; the Kronrod value is the estimate and the gap between the two is the error estimate. The subinterval with the largest error is split in two, and the process repeats until the total error is below 10⁻¹⁰ of the result (or 10⁻¹² absolute). For smooth functions this typically gives 12 to 14 correct digits with a few hundred evaluations or fewer.
An infinite limit is mapped onto [0, 1) with x = a + t/(1 − t). When f is not finite at an endpoint, as with ln x or 1/√x at 0, the calculator switches to tanh–sinh (double-exponential) quadrature, which copes with integrable endpoint singularities; those results are reported to about eight digits. See the NIST Digital Library of Mathematical Functions, §3.5 for the quadrature background.
Worked Examples
| Integral | Result | Note |
|---|---|---|
| ∫₀^π sin x dx | 2 | Error about 2×10⁻¹⁴ |
| ∫₀¹ e^(−x²) dx | 0.7468241328 | No elementary antiderivative; equals (√π/2)·erf(1) |
| ∫₀¹ ln x dx | −1 | Improper at 0, converges |
| ∫₁^∞ x⁻² dx | 1 | Infinite limit, converges |
| ∫−∞∞ e^(−x²) dx | 1.772453851 | Equals √π |
| ∫₀2π sin x dx | 0 | Net area; total area is 4 |
| ∫₀¹ 1/x dx | diverges | No finite value is shown |
Singularities, Divergence and Their Warnings
- Integrable singularity. ∫₀¹ 1/√x dx = 2 and ∫₀¹ ln x dx = −1 are finite although the integrand blows up at 0. The calculator notes the improper endpoint and uses the tanh–sinh rule.
- Divergence. For ∫₀¹ 1/x dx the area keeps growing as you stop closer to 0. The tool tests this by integrating up to points closer and closer to the trouble spot; if the increments do not shrink it reports divergence rather than a value. The same test refuses ∫₋₁¹ 1/x dx: its two halves cancel (a principal value of 0), but each diverges on its own, so the integral does not exist.
- Not real on part of the interval. ∫₋₁¹ √x dx has no value, since √x is not real for negative x. The calculator names the point where f stops being defined.
- Narrow spikes. Any numerical rule can miss a feature much narrower than its sample spacing. The interval is first split into eight panels to help, but if you suspect a spike, split the integral there yourself.
Frequently Asked Questions
- What does a definite integral represent?
- It is the net signed area between the curve y = f(x) and the x-axis from a to b: area above the axis counts positive, area below counts negative. It also equals the accumulated change of any quantity whose rate of change is f(x), by the Fundamental Theorem of Calculus.
- Why is the integral 0 but the area not 0?
- For sin x over [0, 2π] the part above the axis and the part below cancel, so the net integral is 0, but the geometric area is 4. The calculator shows both whenever the function changes sign: the integral of |f| gives the total area.
- How accurate is the result?
- For smooth functions the error estimate is typically around 10⁻¹³ or smaller, and the value is reported to ten significant digits. For improper integrals and infinite limits the stated accuracy is about eight digits. The error shown is an estimate of the numerical error, not a bound that is mathematically guaranteed.
- What is an improper integral?
- An integral with an infinite limit, or one where the integrand is unbounded at a point of the interval. It is defined as a limit, and it converges only if that limit is finite: ∫₁^∞ x⁻² dx = 1 converges, but ∫₁^∞ 1/x dx does not.
- Can it give the antiderivative?
- No. It evaluates the integral numerically, which also works for functions with no elementary antiderivative, such as e^(−x²) or sin(x)/x. The Derivative Calculator is the tool for symbolic work with steps.
- How do I integrate sin(x)/x across 0?
- Just enter it with limits that span 0, such as −1 to 1. The function is undefined at exactly 0 but has a limit of 1 there, and the interval is split so the point itself is never sampled; the result is 1.892166141, which is 2·Si(1).
- What if my function has a parameter, like a·x²?
- Replace the parameter with a number first. A definite integral is a single number, so every letter except the variable of integration must have a value. Any one letter can be the variable, but only one.