AI Math Solver

Integral Calculator with Step-by-Step Solutions

Find indefinite and definite integrals with exact answers and a clear explanation of each rule, from the power rule to integration by parts.

How to use the integral calculator

  1. Type the function to integrate. Enter only the integrand, such as x^3 + 2x or x e^x. Adding dx is optional. For a definite integral, add the limits: x^2 from 0 to 3.
  2. Press Solve Now. The engine chooses a method, such as the power rule, substitution or integration by parts, and works through it symbolically.
  3. Read the steps and the result. Each rule is shown in order, the constant of integration is added for indefinite integrals, and definite integrals are evaluated between the limits with an exact value and a decimal.

Free Integral Calculator for Definite and Indefinite Integrals

Integration is the reverse of differentiation and one of the two central ideas of calculus. It answers questions such as how much area lies under a curve, how far an object travels when you know its speed, or how much of a quantity builds up over time. It is also the topic where students most often get stuck, because there is no single recipe that works for every function. You have to recognise the pattern and pick the right technique.

This integral calculator does that recognition for you and then shows the reasoning. It breaks the integral into parts, names the rule applied to each part and builds the final answer from the pieces. The calculation is done symbolically by a computer algebra engine in your browser, so results are exact. You get eˣ, ln|x| and π in the answer instead of long decimals.

Indefinite and definite integrals

An indefinite integral, written ∫ f(x) dx, asks for a family of functions whose derivative is f(x). Because the derivative of any constant is zero, every antiderivative can be shifted up or down by a constant, which is why the answer always ends with + C. For example, ∫ 2x dx = x² + C.

A definite integral, written with limits as ∫ₐᵇ f(x) dx, produces a number. By the Fundamental Theorem of Calculus, you find an antiderivative F(x) and calculate F(b) − F(a). Geometrically, this is the signed area between the curve and the x-axis from x = a to x = b. Area above the axis counts as positive and area below counts as negative.

Integral calculator showing the area under a curve between two limits
A definite integral measures the signed area under a curve between the lower limit a and the upper limit b.

To calculate a definite integral here, type the function followed by the limits, for example x^2 from 0 to 3. The steps show the antiderivative, the substitution of each limit and the subtraction. For this example, F(x) = x³/3, so the result is 27/3 − 0 = 9.

The basic integration rules

Most integrals you meet in a first calculus course are built from a small set of standard results. The calculator labels each of these when it uses them, so you can match the step to your formula sheet.

  • Power rule: ∫ xⁿ dx = xⁿ⁺¹ / (n + 1) + C, for any n except −1.
  • Reciprocal: ∫ 1/x dx = ln|x| + C. This covers the missing case of the power rule.
  • Exponential: ∫ eˣ dx = eˣ + C, and more generally ∫ aˣ dx = aˣ / ln a + C.
  • Trigonometric: ∫ sin x dx = −cos x + C, ∫ cos x dx = sin x + C and ∫ sec² x dx = tan x + C.
  • Constant multiple: a constant factor can be moved outside the integral, so ∫ 5f(x) dx = 5 ∫ f(x) dx.
  • Sum rule: the integral of a sum is the sum of the integrals, so you can integrate a polynomial term by term.
Table of common integration rules used by the integral calculator
A handful of standard rules covers most integrals in an introductory calculus course.

For a polynomial such as x^3 + 2x, the calculator applies the sum rule first, then the power rule to each term, and finally adds the constant: x⁴/4 + x² + C.

Integration by substitution

Substitution, also called u-substitution, is the reverse of the chain rule. It works when the integrand contains a function and, up to a constant factor, the derivative of that function. You replace the inner function with a new variable u, rewrite dx in terms of du, integrate the simpler expression and substitute back.

Consider ∫ 2x·cos(x²) dx. The inner function is x², and its derivative 2x appears as a factor. Setting u = x² gives du = 2x dx, so the integral becomes ∫ cos u du = sin u + C. Replacing u with x² gives sin(x²) + C. The calculator shows the choice of u, the expression for du, the simplified integral and the final substitution back to x.

Good candidates for u are expressions inside brackets, under a square root, in an exponent or inside a trigonometric function, especially when their derivative appears elsewhere in the integrand.

Integration by parts

Integration by parts is the reverse of the product rule. It is used when the integrand is a product of two different kinds of function, such as a polynomial times an exponential or a polynomial times a trigonometric function. The formula is ∫ u dv = uv − ∫ v du.

The key decision is which factor to call u. A popular guide is the LIATE order: Logarithms, Inverse trigonometric functions, Algebraic terms, Trigonometric functions, Exponentials. Choose u from the type that appears earliest in the list, because differentiating it should make the problem simpler. For ∫ x·eˣ dx, the algebraic term x comes before the exponential, so u = x and dv = eˣ dx. Then du = dx and v = eˣ, and the formula gives x·eˣ − ∫ eˣ dx = x·eˣ − eˣ + C.

Some integrals need parts more than once, such as ∫ x²·eˣ dx, and others return to the original integral after two applications, such as ∫ eˣ·sin x dx. The calculator handles both cases and shows each round of the formula.

Rewriting before you integrate

Sometimes the integrand has to be rewritten before any rule applies. Roots become fractional powers, so √x becomes x^(1/2). A fraction with a single term in the denominator can be split, so (x² + 1)/x becomes x + 1/x. Trigonometric identities turn sin² x into (1 − cos 2x)/2. When the calculator rewrites an integrand, it shows the new form as a separate step labelled "Rewrite the integrand", so you can see exactly what changed.

How to enter integrals

  • Type the integrand only: x^2 sin x, 1/(1 + x^2) or sqrt(x). You do not need the integral sign.
  • Add dx at the end if you like. If the variable is not x, write it explicitly, for example t^2 dt.
  • For definite integrals, use from a to b, such as x^2 from 0 to 3 or sin x from 0 to pi.
  • Use e^x or exp(x) for the exponential and ln(x) or log(x) for the natural logarithm. On this page, log means the natural logarithm, as is usual in calculus.
  • Put brackets around compound expressions: 1/(x+1) rather than 1/x+1.
  • You can also use the math keys or scan a printed integral, then review the recognised text before solving.

Worked examples

Polynomial. ∫ (3x² − 4x + 5) dx. Apply the sum rule, then the power rule to each term: x³ − 2x² + 5x + C.

Square root. ∫ √x dx. Rewrite as x^(1/2), apply the power rule with n = 1/2 and simplify: (2/3)x^(3/2) + C.

Reciprocal with a constant. ∫ 3/x dx. Move the constant outside and use the reciprocal rule: 3 ln|x| + C.

Substitution. ∫ e^(3x) dx. Let u = 3x so du = 3 dx, which gives (1/3)e^(3x) + C.

Definite integral of a trigonometric function. ∫₀^π sin x dx. An antiderivative is −cos x, so the value is (−cos π) − (−cos 0) = 1 + 1 = 2. This is the area of one arch of the sine curve.

Rational functions and partial fractions

When the integrand is a fraction of two polynomials, the strategy depends on the degrees. If the top has a degree equal to or higher than the bottom, polynomial division comes first, leaving a polynomial plus a proper fraction. A proper fraction is then split into partial fractions, simpler pieces whose denominators are the factors of the original denominator.

For example, 1/(x² − 1) factors as 1/((x − 1)(x + 1)) and splits into (1/2)/(x − 1) − (1/2)/(x + 1). Each piece integrates to a logarithm, so the result is (1/2) ln|x − 1| − (1/2) ln|x + 1| + C. Irreducible quadratic factors such as x² + 1 lead to arctangent terms instead, because ∫ 1/(1 + x²) dx = arctan x + C. The calculator rewrites the fraction before integrating so you can see the decomposition.

Area between two curves

A very common application is the area enclosed between two graphs. If f(x) lies above g(x) on the interval from a to b, the area is ∫ₐᵇ (f(x) − g(x)) dx. The usual workflow is:

  1. Find where the curves meet by solving f(x) = g(x). The Equation Solver does this step.
  2. Decide which curve is on top between the intersection points, for example by testing a value in the middle.
  3. Integrate the difference top minus bottom between the intersection points.

For y = x and y = x², the curves meet at x = 0 and x = 1, and the line is on top. The area is ∫₀¹ (x − x²) dx = 1/2 − 1/3 = 1/6. You can type x - x^2 from 0 to 1 here to see the steps.

Average value of a function

The average value of f on the interval from a to b is (1/(b − a)) ∫ₐᵇ f(x) dx. It is the height of the rectangle with the same base and the same area as the region under the curve. For f(x) = x² on the interval from 0 to 3, the integral is 9 and the interval length is 3, so the average value is 3. This idea is used for average temperature, average speed and average cost.

Common mistakes with integrals

  • Forgetting + C on indefinite integrals. Every antiderivative needs it.
  • Using the power rule for 1/x. With n = −1 the formula divides by zero. The correct result is ln|x|.
  • Missing the factor from substitution. If u = 3x, then dx = du/3, and that 1/3 must appear in the answer.
  • Choosing u badly in integration by parts. If the new integral is harder than the original, swap the roles of u and dv.
  • Sign errors with trigonometric integrals. The integral of sin x is −cos x, not cos x.
  • Subtracting the limits in the wrong order. A definite integral is F(upper) − F(lower).

Where integrals are used

Integrals appear wherever quantities accumulate. In physics, integrating velocity gives displacement and integrating force over distance gives work. In probability, the area under a density curve gives a probability. Engineers integrate to find centres of mass and volumes of solids, and economists integrate marginal cost to recover total cost. Practising with clear, labelled steps helps you recognise which technique each situation calls for. If you want to explore the theory further, the integral article on Wikipedia gives a thorough overview.

Limits of the integral calculator

Not every function has an antiderivative that can be written with elementary functions. Integrals such as ∫ e^(−x²) dx or ∫ sin(x)/x dx lead to special functions, and the calculator will either return them in that form or tell you it could not find a closed form. Improper integrals with infinite limits are supported for many common cases, and the result is shown as a limit value when it exists.

Practice problems with answers

Work through these yourself, then enter each integrand in the calculator to compare your method with the full solution.

  1. ∫ (4x³ − 6x + 2) dx. Answer: x⁴ − 3x² + 2x + C.
  2. ∫ 1/x² dx. Answer: −1/x + C, after rewriting as x^(−2).
  3. ∫ cos(2x) dx. Answer: (1/2)sin(2x) + C, by substitution with u = 2x.
  4. ∫ x·cos x dx. Answer: x·sin x + cos x + C, by parts with u = x.
  5. ∫ 2x·e^(x²) dx. Answer: e^(x²) + C, by substitution with u = x².
  6. ∫ ln x dx. Answer: x·ln x − x + C, by parts with u = ln x and dv = dx.
  7. ∫₁³ 2x dx. Answer: 9 − 1 = 8.
  8. ∫₀¹ eˣ dx. Answer: e − 1 ≈ 1.718.

Study tips for integration

Build a mental table of basic antiderivatives and practise them until they are automatic, because every technique eventually reduces a problem to one of them. When you meet a new integral, ask three questions in order. Can I simplify or rewrite it? Is there an inner function whose derivative is also present, which suggests substitution? Is it a product of two different kinds of function, which suggests integration by parts? Always finish by differentiating your answer. If you get the integrand back, you know the result is right, and if not, the difference shows you where to look.

Related tools

Differentiation is the inverse of integration, so the Derivative Calculator is the perfect companion for checking an answer: differentiate your result and you should get the original integrand back. For limits, algebra and mixed problems, use the main AI Math Solver. The Equation Solver helps when an applied integral problem ends in an equation, and the Statistics Calculator covers the descriptive side of data analysis.

Frequently asked questions

Does the integral calculator show integration by parts?

Yes. When the integrand is a product that needs integration by parts, the steps name u and dv, give v and apply the formula ∫ u dv = uv − ∫ v du before simplifying.

How do I enter a definite integral?

Type the function followed by the limits, for example x^2 from 0 to 3. The calculator finds the antiderivative, substitutes the upper and lower limits and subtracts.

Why does my answer include + C?

An indefinite integral describes a whole family of functions that differ by a constant. Adding + C represents every possible antiderivative, which is the complete answer.

Is log the natural logarithm on this page?

Yes. In calculus, log usually means the natural logarithm, so log(x) and ln(x) are treated the same here.

What happens if an integral has no elementary answer?

The calculator tells you that it could not find a closed form instead of guessing. Some integrals can only be written with special functions or approximated numerically.

How can I check an integral myself?

Differentiate the result. If the derivative equals the original integrand, the antiderivative is correct. The Derivative Calculator can do this check for you.

Scroll to Top