Calculus, Linear Algebra & Discrete Math Integrals & Applications of Integration Standard integration rules: power, substitution, by parts

Indefinite Integral (Antiderivative) Calculator

Enter a function and this calculator finds its antiderivative, splitting the integrand into terms and reporting which rule handled each one — power rule, linear substitution, exponential rule, by parts or a standard form. It then differentiates its own answer and compares that against your integrand at nine sample points, so the verification figure beside the result is a genuine check rather than a promise. Where no rule in the built-in list applies, the calculator says so plainly instead of guessing.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Integrand f(x)Use ^ for powers, * for multiplication (2*x, 2x and a plain space all work, so x sin(x) is read as a product), and the function names sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, exp, ln, log (base 10), sqrt, cbrt and abs. The constants pi and e are recognised.3x^2 + 2*sin(2*x)
Integrate with respect toPick the letter you used; every other letter is treated as a constant.x
Evaluate the antiderivative atA point at which to show F, taking the constant of integration as zero.1

It returns

  • Antiderivative F(x) + C — Every antiderivative of your integrand differs from this one only by a constant.
  • Rules used
  • F at your point, with C = 0
  • Verification residual — Worst relative gap between the derivative of the answer and your integrand across nine sample points.

The formula

xndx=xn+1n+1+C
f(g(x))g(x)dx=f(u)du
udv=uvvdu

In plain text: ∫ x^n dx = x^(n+1)/(n+1) + C for n ≠ −1

  • nThe exponent; the rule fails only at n = −1, where the answer is a logarithm (—)
  • CConstant of integration — any constant differentiates to zero, so every antiderivative carries one (units of f times units of x)
  • F(x)An antiderivative: a function whose derivative is the integrand (units of f times units of x)

Antidifferentiation is the reverse of differentiation, so every answer can be checked by differentiating it. This calculator performs that check for you.

Updated Category Integrals & Applications of Integration Verified against published test cases Reading time 10 min

What an antiderivative is, and why it comes with a constant

An antiderivative of f is any function F whose derivative is f. Differentiation destroys constants — the derivative of 7 is zero, exactly like the derivative of −13 — so reversing the operation cannot recover which constant was there. Every antiderivative of 2x has the form x² + C, and the + C is not decoration; it is the honest statement that the problem has infinitely many answers differing only by a vertical shift.

That single fact drives the difference between this calculator and the definite integral calculator. A definite integral subtracts F(b) − F(a), and the constant cancels, so you get one number. An indefinite integral is a whole family of functions, and it is what you need when the integral is an intermediate step — solving a differential equation, recovering a position from a velocity, or building a potential from a force.

Antidifferentiation is genuinely harder than differentiation, and the asymmetry is structural rather than a matter of practice. Differentiation rules compose: knowing how to differentiate f and g tells you how to differentiate their product, quotient and composition. Integration rules do not. There is no product rule for integrals, no quotient rule, no chain rule — only substitution and by parts, which are the product and chain rules read backwards and which only work when the integrand happens to have the right shape.

Worse, some perfectly ordinary functions have no elementary antiderivative at all. e^(−x²), sin(x)/x and 1/ln x are the standard examples. Liouville proved in the 1830s that this is a theorem, not a gap in anyone's technique.

How this calculator finds the antiderivative

It splits the integrand into terms. The sum rule says the integral of a sum is the sum of the integrals, and constant multiples pull straight out. So the first step is to flatten your expression into a list of terms, each with its numeric coefficient peeled off, which is exactly what appears in the term-by-term table.

Each term is matched against a pattern. The list is the standard one you would use by hand: the power rule for x^n, the logarithm rule for 1/x, the exponential rule, the standard trigonometric integrals, the arctangent and arcsine forms, and integration by parts for the three cases x·e^(kx), x·sin(kx) and x·cos(kx). Every one of these also accepts a linear inner function, so sin(3x + 1) is handled by dividing through by the 3 that the chain rule would have produced.

It then verifies its own answer. The antiderivative is differentiated symbolically and compared against your integrand at nine sample points. The largest relative gap is reported as the verification residual, and on a correct answer it comes out at the level of floating-point noise. This is the check every calculus student is told to do and almost nobody does.

Where no pattern matches, it says so. That covers two very different situations: an integrand that needs a technique outside the list, such as partial fractions or a trigonometric substitution, and an integrand with no elementary antiderivative at all. The calculator cannot distinguish between them, and it does not pretend to.

Worked example: ∫ (3x² + 2 sin 2x) dx

This is the default integrand. Take it one term at a time.

  1. Split the sum. ∫(3x² + 2 sin 2x) dx = ∫3x² dx + ∫2 sin 2x dx.
  2. Pull out the constants. = 3∫x² dx + 2∫sin 2x dx.
  3. First integral, power rule. ∫x² dx = x³/3, so the term contributes 3 · x³/3 = x³.
  4. Second integral, substitution. Let u = 2x, so du = 2 dx and dx = du/2. Then ∫sin 2x dx = (1/2)∫sin u du = −cos(u)/2 = −cos(2x)/2. The term contributes 2 · (−cos(2x)/2) = −cos(2x).
  5. Add and attach the constant. F(x) = x³ − cos(2x) + C.

Now check it by differentiating. d/dx [x³] = 3x². d/dx [−cos(2x)] = +sin(2x)·2 = 2 sin 2x by the chain rule. Adding those gives 3x² + 2 sin 2x, the original integrand. The answer is right.

Evaluate at x = 1. With C = 0, F(1) = 1 − cos 2 = 1 − (−0.4161468) = 1.4161468. That is the number this page reports on first load, and it is one of its test vectors.

A by-parts case. For ∫x e^x dx, choose u = x and dv = e^x dx, so du = dx and v = e^x. Then ∫x e^x dx = x e^x − ∫e^x dx = x e^x − e^x + C = e^x(x − 1) + C. At x = 1 that is e·0 = 0. Differentiating back: e^x(x − 1) + e^x·1 = e^x·x, which is the integrand.

How to read the result and the verification figure

The verification residual is the number to look at first. It reports the worst relative disagreement between the derivative of the printed answer and your integrand, measured at nine points spread across the positive axis. On a correct answer it sits below 1e−12. Anything materially larger means the answer disagrees with the integrand somewhere and should not be trusted.

The residual can be blank without anything being wrong. If the sample points fall outside the domain of your function — an integrand defined only for negative x, say — there is nothing to compare and the check reports nothing. In that case verify by hand.

Your answer may look different from a textbook's and still be correct. Antiderivatives are unique only up to a constant, and algebraically equivalent forms abound. ∫2 sin x cos x dx can be written as sin²x, as −cos²x or as −cos(2x)/2, and all three differ from one another by constants. Differentiate both forms, or subtract them and check the difference is constant.

The absolute value in a logarithm matters. ∫dx/x = ln|x| + C, not ln x + C. Dropping the bars restricts the answer to positive x and silently loses half the domain. The calculator keeps them.

The term table shows where a mistake would be. If the total answer looks wrong, compare each row against your own work: it names the term, its antiderivative and the rule applied, so an error localises to a single line.

Integration rules this calculator applies

Every form below also accepts a linear inner function u = mx + c, in which case the answer is divided by m. C is omitted from each row for brevity.
IntegrandAntiderivativeRule
x^n, n ≠ −1x^(n+1)/(n+1)Power rule
1/xln|x|Logarithm rule
e^(kx)e^(kx)/kExponential rule
a^xa^x/ln aExponential rule
sin(kx)−cos(kx)/kSubstitution
cos(kx)sin(kx)/kSubstitution
tan(kx)−ln|cos(kx)|/kSubstitution
sec²(kx)tan(kx)/kStandard form
1/(1 + x²)arctan xArctangent form
1/sqrt(1 − x²)arcsin xArcsine form
ln xx·ln x − xBy parts
x·e^(kx)e^(kx)(kx − 1)/k²By parts
x·sin(kx)(sin(kx) − kx·cos(kx))/k²By parts
x·cos(kx)(cos(kx) + kx·sin(kx))/k²By parts
sqrt(kx + b)2(kx + b)^1.5/(3k)Power rule after substitution

Anything outside this list is reported as not found rather than guessed. Partial fractions, trigonometric substitution and repeated integration by parts are not implemented.

Mistakes that make an antiderivative wrong

  • Forgetting the constant of integration. An indefinite integral without + C names one member of a family and calls it the whole family. It matters the moment you use the result in a differential equation.
  • Applying the power rule at n = −1. x^0/0 is undefined; the answer is ln|x|. This is the one exception to the power rule and it is the one every course tests.
  • Losing the factor from the chain rule. ∫sin(3x) dx = −cos(3x)/3. Substitution puts the reciprocal of the inner slope out front, and dropping it is the most common substitution error.
  • Inventing a product rule. ∫fg dx is not (∫f)(∫g). Test it on ∫x·x dx: the true answer is x³/3, while the invented rule gives x⁴/4.
  • Dropping the absolute value in a logarithm. ln|x|, not ln x. Without the bars the antiderivative is undefined on the negative half of the domain where the integrand is perfectly well behaved.
  • Assuming an antiderivative exists in elementary form. It often does not. If the calculator finds nothing, it may be telling you that no formula exists rather than that it failed.

When to use a different tool

If you only need a number between two limits, go straight to the definite integral calculator. It works for every integrand, including the ones with no elementary antiderivative, because it evaluates the accumulation numerically rather than searching for a formula.

If you are being asked to demonstrate a specific numerical rule, Simpson's rule and the trapezoidal rule show the node table and the coefficient pattern that a homework answer needs.

If the integral is the area between two curves, use the area between curves calculator, which finds the intersections and splits the integral for you.

To check any answer you obtained by hand, differentiate it with the derivative calculator and compare against your integrand. That is a complete proof of correctness up to the constant, and it works even for antiderivatives this calculator could not find.

For techniques not implemented here, the usual next steps are partial fractions for a rational function whose denominator factors, trigonometric substitution for expressions containing sqrt(a² − x²) or sqrt(x² + a²), and repeated integration by parts for x^n against an exponential or trigonometric factor. Each is a mechanical procedure once you recognise the shape.

Frequently asked questions

Why does my answer include + C?

Because differentiation sends every constant to zero, so reversing it cannot tell you which constant was present. x² + 1 and x² − 40 have the same derivative, and both are antiderivatives of 2x. The + C stands for the whole family. It cancels in a definite integral, which is why F(b) − F(a) gives one clean number.

What does the verification residual tell me?

It is the largest relative gap between the derivative of the printed antiderivative and the integrand you typed, measured at nine sample points. On a correct result it is around 1e−13, which is floating-point noise. Anything visibly larger means the two functions genuinely disagree somewhere, and you should check the answer by hand before using it.

Why did the calculator find nothing for my function?

Either your integrand needs a technique not implemented here — partial fractions, trigonometric substitution, repeated by parts — or it has no elementary antiderivative at all. e^(−x²), sin(x)/x and 1/ln x fall into the second group, and that is a theorem rather than a limitation of software. A definite value can still be computed numerically.

My textbook's answer looks different from this one. Which is right?

Probably both. Antiderivatives are unique only up to an additive constant, and trigonometric identities generate many equivalent forms. Subtract the two answers: if the difference is a constant, they describe the same family. Differentiating each one and comparing against the integrand is the definitive test.

Why is the answer ln|x| rather than ln x?

Because 1/x is defined for negative x too, and ln x is not. The absolute value extends the antiderivative to the whole domain of the integrand. On the negative side, d/dx ln|x| = d/dx ln(−x) = −1/(−x) = 1/x, so the bars are doing real work rather than decorating the answer.

Can it integrate with respect to a variable other than x?

Yes — choose t or u from the dropdown, and the power, substitution and by-parts rules all apply to that letter instead of x. What the calculator will not do is carry a symbolic parameter: the pattern matcher needs numeric coefficients, so 5*t^2 integrates cleanly (the answer prints as 1.66667·t^3, which is 5t³/3) while a*t^2 is reported as not found. Divide the parameter out by hand, integrate, and multiply it back — it is a constant, so it rides through untouched.

Does it handle definite integrals?

Not directly, but the antiderivative it returns is what you need. Evaluate F(b) − F(a) yourself using the value output, or use the definite integral calculator, which computes the number numerically and works even when no antiderivative exists.

What is the difference between substitution and by parts?

Substitution reverses the chain rule and works when the integrand contains a function of something together with the derivative of that something. By parts reverses the product rule and works when the integrand is a product of two unrelated pieces, converting ∫u dv into uv − ∫v du in the hope that the new integral is easier. The rules column of the term table names which one was used for each piece.

References