🇺🇸 USC
Math & Conversion
∫

Integral Calculator

Antiderivatives with steps, definite integrals, Riemann sums and double integrals

An integral calculator finds the antiderivative F(x) of a function, the family of functions whose derivative is f(x), and evaluates a definite integral as F(b) − F(a), the net signed area under the curve from a to b. Enter x·sin(x) and this one returns sin(x) − x·cos(x) + C with every rule it used, checks the answer by differentiating it, and evaluates the integral from 0 to π as exactly π.

✅

Last updated October 2026

Method: Rule-based symbolic integration: power, logarithm, exponential and trig rules, substitution, integration by parts (including the tabular method), partial fractions, completing the square and reduction formulas. Each antiderivative is differentiated with the mathjs library and checked against f(x) before it is shown. Definite integrals use F(b) − F(a), cross-checked by adaptive Simpson (or tanh-sinh) quadrature; double integrals use iterated Simpson's rule.

Included: Antiderivatives with steps, definite and improper integrals, exact values such as π/4 or ln(2), left, right and midpoint Riemann sums, the trapezoidal rule and Simpson's rule with sample-point tables, and double integrals over rectangles or regions between two curves.

Not included: A complete decision procedure (some elementary antiderivatives, such as that of 1/(x^4 + 1), are not found), special functions like erf, complex-valued integrals, triple and line integrals, and symbolic parameters.

∫ Enter your integral

Try:

Use ^ for powers, * or a space for multiplication, and sqrt(), e^x, ln(x), sin, cos, tan, sec, arcsin, arctan, abs(). ln(x) is the natural log and log(x) is base 10, as on handheld calculators; log(x, b) uses base b. Any single letter except e can be the variable.

Type of integral

Limits accept numbers and expressions such as pi/2, e, sqrt(2) or 1/3, and inf or -inf for an improper integral over an infinite interval.

∫ from 0 to π of x·sin(x) dx

3.141592654
Exact value: π
Antiderivative F(x)
sin(x) - x·cos(x) + C
✓ Checked: d/dx of the result equals f(x) at 17 test points

📏 Definite integral details

Interval[0, π] = [0, 3.14159]
F(π)3.141592654
F(0)0
F(b) - F(a)3.141592654
Adaptive Simpson (numerical)3.141592654
Difference0

📋 Step-by-step

  1. Integration by parts: ∫ u dv = uv - ∫ v du
    Choose u = x (it gets simpler when differentiated) and dv = sin(x) dx. Then du = dx and v = -cos(x).
    ∫ x·sin(x) dx = -x·cos(x) - ∫ -cos(x) dx
  2. Constant multiple rule: ∫ k·f dx = k·∫ f dx
    ∫ -cos(x) dx = -∫ cos(x) dx
  3. ∫ cos(x) dx = sin(x)
    ∫ cos(x) dx = sin(x)
  4. Add the constant of integration
    ∫ x·sin(x) dx = sin(x) - x·cos(x) + C
  5. Evaluate F(b) - F(a)
    F(π) - F(0) = 3.141592654 - (0) = 3.141592654

✅ Check by differentiation

The antiderivative is differentiated symbolically and compared with f(x) at test points. Every point must agree to within one part in a million.

xf(x)F′(x)
0.4303980.1795760.179576
1.57081.57081.5708
2.711191.13121.1312
-2.711.133641.13364
-1.931.806821.80682
-1.171.077281.07728
Everything is computed in your browser. Antiderivatives come from a rule-based integrator (power, log, exponential and trig rules, substitution, integration by parts, partial fractions) and every result is checked by differentiating it with mathjs. Definite integrals are cross-checked with adaptive Simpson quadrature; double integrals use composite Simpson's rule on a 128 × 128 grid.

Integral calculator: antiderivatives, definite integrals and numerical rules explained

Integration answers two questions that turn out to be one: which function has a given derivative (the antiderivative), and how much a quantity accumulates over an interval (the definite integral, a net signed area). The fundamental theorem of calculus connects them, and this integral calculator uses both: it builds an antiderivative with steps, verifies it, and evaluates definite integrals exactly and numerically.

What an integral calculator computes

Any two antiderivatives of a function differ by a constant, so an indefinite integral carries a constant C, which cancels again in a definite integral. These are the rules the calculator relies on most:

∫ f(x) dx = F(x) + C, where F′(x) = f(x) ∫ from a to b of f(x) dx = F(b) − F(a) ∫ x^n dx = x^(n+1)/(n+1) + C for n ≠ −1, and ∫ 1/x dx = ln|x| + C ∫ u dv = uv − ∫ v du ∫ f(g(x))·g′(x) dx = ∫ f(u) du with u = g(x)

The second line, the fundamental theorem of calculus, requires f to be continuous on [a, b], so the calculator scans the interval for vertical asymptotes before it trusts F(b) − F(a). Integration by parts comes from the product rule and handles products such as x·e^x; substitution undoes the chain rule. The integrator tries its rules in a fixed order and keeps the first chain that works.

Worked example 1: integration by parts on x·sin(x)

The product x·sin(x) is not in any table, so the calculator integrates by parts with u = x, which gets simpler when differentiated, and dv = sin(x) dx. Then du = dx and v = −cos(x):

∫ x·sin(x) dx = −x·cos(x) − ∫ (−cos(x)) dx = sin(x) − x·cos(x) + C

Differentiating checks it: sin(x) gives cos(x), and the product rule turns −x·cos(x) into −cos(x) + x·sin(x), so only x·sin(x) remains. For the definite integral from 0 to π, F(π) = sin(π) − π·cos(π) = π and F(0) = 0, so the result is exactly π, about 3.141592654. Adaptive Simpson quadrature reaches the same value without the formula. This is the default example above.

Worked example 2: net signed area of a polynomial

For the integral of 3x^2 + 2x − 5 from 0 to 2, the power rule works term by term: 3·x^3/3 + 2·x^2/2 − 5x = x^3 + x^2 − 5x. That equals 8 + 4 − 10 = 2 at x = 2 and 0 at x = 0, so the integral is 2.

That 2 is a net value. The polynomial is zero at x = 1, negative before and positive after, so the piece from 0 to 1 contributes −3 and the piece from 1 to 2 contributes 5. They net to 2, while the total area between the curve and the axis is 3 + 5 = 8.

Substitution and partial fractions, step by step

When one factor is the derivative of an inner function, substitution collapses the integral. In ∫ x·e^(x^2) dx, u = x^2 and du = 2x dx, so the integral becomes ∫ e^u/2 du and the answer is e^(x^2)/2 + C. The calculator finds such substitutions by testing whether the remaining factors are a multiple of an inner expression's derivative.

Rational functions are split into partial fractions. For (2x + 3)/(x^2 + 3x + 2), the denominator factors as (x + 1)(x + 2) and the fraction equals 1/(x + 1) + 1/(x + 2), so the antiderivative is ln|x + 1| + ln|x + 2| + C and the integral from 0 to 1 is ln(3), about 1.098612289. Long division comes first when the numerator's degree is at least the denominator's, and an irreducible quadratic gives an arctangent, as in ∫ 1/(x^2 + 2x + 5) dx = arctan((x + 1)/2)/2 + C.

Exact values of common integrals on [0, 1]

Each antiderivative is the calculator's own output, and each value was computed as F(1) − F(0) and confirmed by quadrature.

f(x) Antiderivative ∫ from 0 to 1, exact Decimal
x^2x^3/3 + C1/30.3333333333
sqrt(x)2x^(3/2)/3 + C2/30.6666666667
e^xe^x + Ce − 11.718281828
x·e^xx·e^x − e^x + C11
x·sin(x)sin(x) − x·cos(x) + Csin(1) − cos(1)0.3011686789
sin(πx)−cos(πx)/π + C2/π0.6366197724
1/(1 + x^2)arctan(x) + Cπ/40.7853981634
1/(x + 1)ln|x + 1| + Cln(2)0.6931471806
x/(x^2 + 1)ln(x^2 + 1)/2 + Cln(2)/20.3465735903
ln(1 + x)x·ln(x + 1) − x + ln|x + 1| + C2ln(2) − 10.3862943611
sqrt(1 − x^2)x·sqrt(1 − x^2)/2 + arcsin(x)/2 + Cπ/40.7853981634
cos^2(x)x/2 + sin(2x)/4 + C1/2 + sin(2)/40.7273243567

Two rows share π/4: the arctangent integral, and a quarter of the unit circle, whose area is π/4 by geometry.

Riemann sums, the trapezoidal rule and Simpson's rule

Numerical rules approximate a definite integral from function values alone. With n subintervals of width Δx = (b − a)/n and points x0, x1, ..., xn:

L = Δx·[f(x0) + f(x1) + ... + f(x(n−1))] T = (Δx/2)·[f(x0) + 2f(x1) + ... + 2f(x(n−1)) + f(xn)] S = (Δx/3)·[f(x0) + 4f(x1) + 2f(x2) + ... + 4f(x(n−1)) + f(xn)], n even

For x^2 on [0, 2] with n = 4, the left sum is 1.75, the right sum 3.75, the midpoint rule 2.625, the trapezoidal rule 2.75 and Simpson's rule 2.666666667, against the exact 8/3. Simpson's rule is exact here because it is exact for every polynomial of degree three or less. The weights are the multipliers inside the brackets:

i x_i f(x_i) = x_i^2 Trapezoid weight Simpson weight
00011
10.50.2524
21122
31.52.2524
42411

The next table integrates 1/x from 1 to 2, exactly ln(2) or about 0.6931471806. Each time n doubles, the trapezoidal error falls by a factor near 4 (3.92, 3.98, 3.99, 4.00) and Simpson's by a factor approaching 16 (12.15, 14.53, 15.56, 15.89), as the error terms in the NIST Digital Library of Mathematical Functions predict: −((b − a)/12)·h^2·f″(ξ) for the trapezoidal rule and −((b − a)/180)·h^4·f⁽⁴⁾(ξ) for Simpson's rule.

n Δx Trapezoidal T Error of T Simpson S Error of S
20.50.70833333331.519 × 10−20.69444444441.297 × 10−3
40.250.69702380953.877 × 10−30.69325396831.068 × 10−4
80.1250.69412185049.747 × 10−40.69315453077.350 × 10−6
160.06250.69339120222.440 × 10−40.69314765284.723 × 10−7
320.031250.69320820836.103 × 10−50.69314721032.973 × 10−8

Errors are rule value minus ln(2). Both are positive: the trapezoidal rule overestimates because 1/x curves upward, Simpson's rule because the fourth derivative of 1/x is positive. Simpson's rule with n = 32 is correct to seven decimal places; the trapezoidal rule needs 1,450 subintervals for the same accuracy.

Double integrals and the order of integration

A double integral adds up f(x, y) over a region, one variable at a time. For x^2 + y^2 with x from 0 to 1 and y from 0 to 2, the inner integral in x is 1/3 + y^2, and the outer integral of that from 0 to 2 is 2/3 + 8/3 = 10/3, about 3.333333333, the default in the double integral mode. On a rectangle the order does not change the value of a continuous integrand, but for other regions it decides how the limits are written. To integrate x·y over the triangle under y = x for x from 0 to 1, use dy dx with inner limits 0 and x: the inner integral is x·x^2/2 and the outer integral is 1/8. With f = 1 and inner limits x^2 to x, the result is the area between the parabola and the line, 1/6. The calculator uses composite Simpson's rule on a 128 by 128 grid and estimates the error from coarser grids.

Improper integrals: infinite limits and vertical asymptotes

An integral is improper when a limit is infinite or the integrand blows up at an endpoint; it converges only if the defining limit is finite. Type inf or -inf for an infinite limit; endpoint singularities are detected automatically. The integral of 1/sqrt(x) from 0 to 1 is 2, of ln(x) from 0 to 1 is −1, of 1/x^2 from 1 to ∞ is 1, and of e^(−x) from 0 to ∞ is 1. The integral of 1/x from 1 to ∞ diverges because ln(x) grows without bound, and the calculator says so.

An asymptote inside the interval is a trap: applying F(b) − F(a) to the integral of 1/x^2 from −1 to 1 gives −2, impossible for a positive integrand. The calculator finds the asymptote at x = 0 and reports no value; split the integral there, and both pieces diverge.

How to use the calculator

Pick a mode. In the integral mode, type the function with ^ for powers, * or a space for multiplication, and names such as sqrt, e^x, ln, sin, cos, tan, sec, arcsin, arctan and abs, then choose indefinite or definite; the definite setting makes it a definite integral calculator with F(b), F(a) and a numerical cross-check. As on handheld calculators, ln(x) is the natural logarithm and log(x) is base 10. Use a single letter as the variable and put * between letters (x*y, not xy). Limits accept pi/2, sqrt(2) or inf. The result card shows how your input was read, then come the steps and a check table. The Riemann mode adds the number of subintervals n, compares five rules with the exact value and lists every sample point. The double integral mode is a double integral calculator for f(x, y): it takes the function, the order of integration and four limits.

Who it is for. Calculus I and II students, including AP Calculus students, use the steps to check homework; the step titles match textbook names. Engineering and physics students compute work, charge and centers of mass, and apply the numerical rules to measured data. Statistics students integrate probability densities, where an area is a probability.

Key terms

  • Integrand: the function being integrated.
  • Antiderivative: a function F with F′ = f, also called the indefinite integral.
  • Definite integral: F(b) − F(a), the net signed area from a to b.
  • Riemann sum: an approximation of the area by rectangles.
  • Improper integral: an integral with an infinite limit or an unbounded integrand, defined as a limit.
  • Iterated integral: a double integral evaluated one variable at a time.
  • Elementary function: a function built from polynomials, roots, exponentials, logarithms and trig functions.

What changes the result, and how to check it

Swapping the limits flips the sign. Correct antiderivatives can look different: sin^2(x)/2, −cos^2(x)/2 and −cos(2x)/4 all integrate sin(x)·cos(x), because they differ by constants. ln|x| covers both sides of zero, while ln(x) covers only x > 0, and trig functions use radians. To check a result by hand, differentiate it, and for a definite integral compare it with a rough sketch of the area; a wrong sign or size points to an algebra slip or a missed asymptote.

Limitations of a rule-based integral solver

"No closed form found" means the rules ran out, not that no antiderivative exists. Some integrals, like e^(x^2), sin(x)/x and 1/ln(x), provably have no elementary antiderivative; others, like 1/(x^4 + 1), need techniques beyond these rules. Definite integrals still get a numerical value. Oscillating integrals over infinite intervals such as sin(x)/x from 0 to ∞ are reported without a value, and the double integral mode is numerical only.

Related calculators

Sources

The rules and error formulas are standard results; every antiderivative, value and table entry on this page was produced by the calculator itself.

⚠️ Common mistakes & edge cases

Forgetting the constant of integration

x^3/3 alone is incomplete; the antiderivative of x^2 is x^3/3 + C. The constant matters as soon as a problem gives an initial condition such as F(0) = 5, which is how C gets its value.

Dropping the absolute value in ln|x|

The antiderivative of 1/x is ln|x|. Without the absolute value the answer fails for negative x, and an integral such as the one from −3 to −1 cannot be evaluated.

Integrating across a vertical asymptote

The fundamental theorem needs a continuous integrand. Plugging −1 and 1 into −1/x for the integral of 1/x^2 gives −2, a negative area for a positive function; the integral actually diverges.

Reading net area as total area

The integral of 3x^2 + 2x − 5 from 0 to 2 is 2, but the region between the curve and the axis has total area 8. For enclosed area, split at the zeros and add absolute values.

Using degrees instead of radians

Calculus rules for trig functions assume radians. The integral of sin(x) from 0 to π is 2; write π as pi in the limits rather than 180.

Typing e^2x when you mean e^(2x)

Powers bind tighter than implied multiplication, so e^2x is read as e^2·x. Put exponents in parentheses; the result card shows how the input was read.

Note: A closed form is only shown after it passes the differentiation check; without one, the numerical value of a definite integral is still reliable.

❓ Frequently asked questions

How do I use an integral calculator with steps?

Type the function, such as x*sin(x), and choose indefinite or definite. The calculator returns the antiderivative plus C, lists each rule in the order it was applied, and shows a check table comparing the derivative of the answer with your function. A definite integral also shows F(b), F(a) and an independent numerical value.

What is the difference between a definite and an indefinite integral?

An indefinite integral is a family of functions, an antiderivative F(x) plus a constant C. A definite integral is one number, F(b) − F(a), the net signed area between the curve and the x-axis. The antiderivative of 3x^2 + 2x − 5 is x^3 + x^2 − 5x + C, and its definite integral from 0 to 2 is 2.

How does the antiderivative calculator know its answer is right?

Every antiderivative is differentiated with the mathjs library and compared with the original function at up to 17 test points, each within one part in a million. If the check fails, the formula is not shown at all, so a wrong closed form never reaches the result card.

Why does the integral solver say no closed form was found?

Either the built-in rules ran out or no elementary antiderivative exists. Functions such as e^(x^2), sin(x)/x and 1/ln(x) provably have none. Definite integrals are still computed numerically: the integral of e^(x^2) from 0 to 1 is about 1.462651746.

How do I calculate a double integral?

Integrate one variable at a time. For x^2 + y^2 with x from 0 to 1 and y from 0 to 2, the inner integral is 1/3 + y^2 and the outer integral is 10/3. Inner limits may use the outer variable, such as y from 0 to x for a triangle.

How does the trapezoidal rule calculator work?

It splits [a, b] into n subintervals of width Δx and adds trapezoids: T = (Δx/2)·[f(x0) + 2f(x1) + ... + 2f(x(n−1)) + f(xn)]. For x^2 on [0, 2] with n = 4 the values are 0, 0.25, 1, 2.25 and 4, so T = 0.25·11 = 2.75, against the exact 8/3.

Is Simpson's rule more accurate than the trapezoidal rule?

For smooth functions, almost always: its error shrinks with the fourth power of the step size, the trapezoidal error with the square. For the integral of 1/x from 1 to 2 with n = 8, the errors are about 9.7 × 10^-4 and 7.4 × 10^-6. Simpson's rule needs an even n and is exact for cubics.

When should I use integration by parts?

For products where one factor simplifies when differentiated and the other is easy to integrate, such as x·e^x, x^2·sin(x) or x·ln(x), and for ln(x) alone with u = ln(x) and dv = dx. For polynomials of degree three or more, the calculator uses the tabular method, which does the repeated steps at once.

Can the calculator handle improper integrals?

Yes, for infinite limits (type inf or -inf) and for integrands that blow up at an endpoint. The integral of 1/sqrt(x) from 0 to 1 is 2, the integral of 1/x^2 from 1 to infinity is 1, and the integral of 1/x from 1 to infinity diverges. An asymptote inside the interval is flagged, not integrated across.

What does the + C mean in an antiderivative?

It is an arbitrary constant. Constants have derivative zero, so F(x) + 5 is an antiderivative whenever F(x) is. Correct answers can therefore look different, like sin^2(x)/2 and −cos^2(x)/2 for sin(x)·cos(x). In a definite integral the constant cancels.

💡 Good to know

Some integrals have no formula at all

The bell-curve integrand e^(−x^2) has no elementary antiderivative, which is why normal distribution tables exist. Its integral over the real line is still exactly sqrt(π), about 1.772453851, as the calculator shows.

Simpson's rule is exact for cubics

Simpson's rule fits parabolas, yet its errors cancel for any cubic, so it returns exactly 8/3 for x^2 on [0, 2] with only four subintervals.

Different answers can both be right

If a textbook shows −cos(2x)/4 and the calculator shows −cos^2(x)/2 for the integral of sin(x)·cos(x), both are correct: they differ by the constant 1/4, which disappears into C.

Related Calculators