Integral calculator
A definite integral with its error estimate, or an antiderivative checked by differentiating it.
Use ^ for powers and write products as 2x or x*sin(x). Functions: sin, cos, tan, sec, csc, cot, arcsin, arctan, sinh, cosh, ln, log (base 10), sqrt, exp, abs; constants pi and e. Angles are in radians.
How do I calculate a definite integral?
The definite integral of f from a to b is the signed area between the graph and the x-axis. If F is an antiderivative of f, the fundamental theorem of calculus gives ∫ₐᵇ f(x) dx = F(b) − F(a). For ∫ from −2 to 2 of (x² − 4) dx, F(x) = x³/3 − 4x and the answer is −32/3 (OpenStax Calculus Volume 1, Example 5.20). This calculator does not depend on finding F: it integrates numerically with an adaptive Gauss–Kronrod rule, shows the estimated error, and when it also finds an antiderivative it shows the exact value and confirms that the two agree.
Which antiderivatives can it find?
Sums and constant multiples, powers (xⁿ with any real n, with 1/x giving ln|x|), eˣ and aˣ, sin, cos, tan, cot, sec, csc, sec², csc², sec·tan, csc·cot, 1/(1 + x²), 1/√(1 − x²), ln x and the inverse trigonometric functions, with a linear argument f(ax + b) and with a general substitution u = g(x) when g′(x) is in the integrand (∫6x(3x² + 4)⁴ dx = (3x² + 4)⁵ ÷ 5, OpenStax Example 5.30). Quotients such as (x² + 4∛x) ÷ x are split into powers first, quadratics under a root or in a denominator are handled by completing the square, and polynomial × eˣ, sin x, cos x or ln x is integrated by parts. Anything else gets the honest answer “no antiderivative found by these rules” — for example eˣ², sin(x²) or sin(x)/x, which have no elementary antiderivative at all, and integrals that need partial fractions or trigonometric substitution. A definite integral of such a function is still computed numerically.
How accurate is the number, and what is the error estimate?
The integral is computed with the 15-point Kronrod rule and the embedded 7-point Gauss rule from QUADPACK; the difference between the two is the error estimate, and the interval with the largest error is halved until the estimated error is below about 10⁻¹⁰ of the value. For smooth functions the result is correct to 12 or more digits. The estimate is not a guarantee, and sharp spikes between the sample points can fool any numerical method. Integrable singularities at an end point are fine: ∫₀¹ 1/√x dx = 2 and ∫₀¹ ln x dx = −1 are computed correctly. If the error will not come down, the integral may diverge (∫₀¹ 1/x dx) and the page says the integration did not settle instead of printing a number.
Can it do improper integrals with infinite limits?
Yes: type inf or -inf as a limit. An infinite interval is mapped onto a finite one by a change of variable (x = a + 1/s − 1 with s between 0 and 1 for [a, ∞); the whole line is split at 0 into two such pieces) and integrated in the same way, so a singular end point that results from it is handled by the same interval halving. Checks: the Gaussian ∫ from −∞ to ∞ of e^(−x²) dx gives √π ≈ 1.7724538509, ∫₀^∞ e^(−x) dx = 1, ∫₁^∞ 1/x² dx = 1 and ∫ from −∞ to ∞ of 1/(1 + x²) dx = π. Convergence is not proved: for ∫₁^∞ 1/x dx, which diverges, the method breaks down and the page tells you so.
What does the constant C mean?
An antiderivative is only defined up to a constant, because the derivative of a constant is 0. ∫x² dx = x³/3 + C, where C is any number. The calculator verifies every antiderivative it reports by differentiating it with its own derivative code and comparing with your integrand at a few dozen test points, and it shows the derivative so you can see that it returns the integrand (OpenStax §4.10, “Verifying an Indefinite Integral”). Definite integrals do not need C: it cancels in F(b) − F(a).
How do I type the integrand and the limits?
Use x as the variable, ^ for powers and write products as 2x or x*sin(x); functions are sin, cos, tan, sec, csc, cot, arcsin, arctan, sinh, cosh, ln, log (base 10), log_2(x), sqrt, exp and abs, with the constants pi and e. The limits can be numbers or expressions such as pi/2, sqrt(3)/3, ln(2) or 2*pi, and inf for infinity. Angles are in radians. The page shows how it read your input, because 1/2x means (1/2)·x; write 1/(2x) for the other reading.
Is the answer the area? What about negative values?
The integral is the signed area: parts below the x-axis count as negative. ∫ from −3 to 3 of 2x dx is 0 because two triangles of area 9 cancel (OpenStax Example 5.9). For the total area between the graph and the axis integrate the absolute value: ∫₀³ |3x − 5| dx = 41/6 ≈ 6.8333, while ∫₀³ (3x − 5) dx = −3/2 (Examples 5.24 and 5.25). Type abs(3x-5) to get it.
What are the most common mistakes when integrating?
Forgetting + C in an indefinite integral; integrating a product factor by factor (the product of antiderivatives is not an antiderivative of the product: x·eˣ has antiderivative xeˣ − eˣ, not x²eˣ/2, as OpenStax shows in Example 4.51); using the power rule on 1/x (the answer is ln|x|, not x⁰/0); mixing up the order of the limits, which changes the sign of a definite integral; and typing angles in degrees, because the calculator and calculus use radians. When you can’t tell whether your own antiderivative is right, differentiate it: you must get the integrand back, which is exactly the check the calculator performs.
Sources: OpenStax, Calculus Volume 1, section 4.10 “Antiderivatives” and chapter 5 “Integration” (5.2 The Definite Integral, 5.3 The Fundamental Theorem of Calculus, 5.4 Integration Formulas and the Net Change Theorem, 5.5 Substitution, 5.6 and 5.7 integrals with exponential, logarithmic and inverse trigonometric results), and the table of integrals in Calculus Volume 2, Appendix A; Gauss–Kronrod nodes and weights from QUADPACK (R. Piessens et al., 1983; netlib.org/quadpack, routine dqk15). Related: derivative calculator, equation solver, polynomial calculator, log calculator, exponent calculator, scientific calculator, circle calculator and quadratic formula calculator.