About the Definite Integral Calculator
This definite integral calculator evaluates ∫ₐᵇ f(x) dx — the signed area between a curve and the x-axis — for almost any function you can type: polynomials, roots, trigonometric, exponential and logarithmic functions, and combinations of them. Limits can be numbers or expressions such as pi or e.
It is meant for calculus students checking homework, engineers and scientists who need a quick numerical answer, and anyone who wants to see what an integral looks like. Alongside the integral it reports the total (absolute) area, which counts regions below the axis as positive, and the average value of the function over the interval.
The answer is computed numerically with high-order Gauss–Legendre quadrature (cross-checked with Simpson’s rule), which is accurate to many decimal places for smooth functions. It does not produce a symbolic antiderivative, and integrals that diverge — such as 1/x across 0 — are reported as not converging rather than given a misleading number. Integrable blow-ups at an end point, or at one point inside the interval, are handled automatically; with several interior blow-ups, split the interval at them yourself.
With the default inputs, the ∫ f(x) dx from a to b is 9. Change any value above to recalculate instantly.
How to use the definite integral calculator
- 1Type the function using x, e.g. 3x^2 + sin(x).
- 2Enter the lower and upper limits — numbers or expressions like pi.
- 3Read the value of the definite integral.
- 4Compare it with the total area if the curve dips below the x-axis.
- 5Use the shaded graph to sanity-check the sign and size of the answer.
Formula and method
By the Fundamental Theorem of Calculus, a definite integral equals F(b) − F(a) for any antiderivative F. Instead of finding F symbolically, this calculator splits [a, b] into hundreds of small panels and applies 5-point Gauss–Legendre quadrature in each one, which is exact for polynomials up to degree 9 on every panel.
It repeats the calculation with twice as many panels; if the two answers agree the result is reported. If they do not — typically because the function blows up at an end point, like 1/√x at 0 — it switches to tanh–sinh (double-exponential) quadrature; for a corner or cusp inside the interval (such as |x − c| or cbrt(x) across 0) it bisects panels adaptively until they agree; and if the function blows up at a single point inside the interval, like 1/√|x − 0.3|, it locates that point, splits the integral there and applies tanh–sinh to each side. Only if all of these fail to settle is the integral flagged as not converging. The average value is the integral divided by (b − a), and the total area integrates |f(x)| so regions below the axis add instead of cancel.
- f(x)
- The function (integrand)
- a, b
- Lower and upper limits of integration
- F
- An antiderivative of f, so F′ = f
- h
- Panel width (b − a) ÷ N
Worked examples
∫₀³ x² dx
An antiderivative of x² is x³/3, so the integral is 27/3 − 0 = 9. Over a width of 3 the average height of the curve is 9 ÷ 3 = 3.
∫₀^π sin(x) dx
An antiderivative of sin x is −cos x, so the integral is −cos π + cos 0 = 1 + 1 = 2 — the area of one arch of the sine wave.
∫₀¹ eˣ dx
eˣ is its own antiderivative, so the answer is e¹ − e⁰ = e − 1 ≈ 1.71828.
∫₁¹⁰ 1/x dx
The antiderivative of 1/x is ln x, so the integral is ln 10 − ln 1 ≈ 2.302585.
Signed vs total area: x³ − 3x on [−2, 2]
x³ − 3x is an odd function, so the areas above and below the axis cancel and the integral is 0. Adding them as positive areas gives a total of 5.
Blow-up inside the interval: 1/√|x − 0.3| on [0, 1]
The function is infinite at x = 0.3, but the area is finite. Splitting there, ∫₀^0.3 = 2√0.3 ≈ 1.095445 and ∫_0.3^1 = 2√0.7 ≈ 1.673320, so the integral is 2√0.3 + 2√0.7 ≈ 2.768765. The calculator finds the blow-up point and splits automatically.
Frequently asked questions
What is a definite integral?+
A definite integral ∫ₐᵇ f(x) dx is the signed area between the graph of f and the x-axis from x = a to x = b. Area above the axis counts as positive and area below counts as negative.
How do you calculate a definite integral by hand?+
Find an antiderivative F(x) — a function whose derivative is f(x) — then compute F(b) − F(a). For ∫₁² 2x dx, F(x) = x², so the answer is 4 − 1 = 3.
Why is my integral negative?+
The integral is negative when more of the curve lies below the x-axis than above it, or when the lower limit is greater than the upper limit. The total area output adds all regions as positive.
How accurate is a numerical integral?+
For smooth functions the Gauss–Legendre method used here is typically accurate to 10 or more significant digits. Near a blow-up point, a jump or very rapid oscillation accuracy is lower (often about 7–8 significant digits when the blow-up point is not an exact decimal such as 1/3), and the tool reports non-convergence when refinements disagree.
How do I enter pi, e or a square root?+
Type pi and e directly, sqrt(x) for a square root, cbrt(x) for a cube root (x^(1/3) only works for x ≥ 0), ln(x) for the natural log and log10(x) for base-10. Multiplication can be written as 3x or 3*x.