Integral calculator with step-by-step working and a check
Indefinite and definite integrals, improper integrals and areas of regions. The solver picks a method (the table, substitution, integration by parts, partial fractions), explains every step and checks the answer by differentiating.
∫ x^2 sin x dx
∫ dx/(x^2 - 1)
∫ sin^3 x dx
∫ x/(x^4 + 1) dx
∫_0^1 x e^x dx
∫_1^∞ dx/x^2
∫ e^(x^2) dx
area between y = x^2 and y = x
Loading the solver…
What you can type
Write an indefinite integral with the sign and the differential, ∫ x^2 sin x dx, or just as a function, x^2 sin x. The word int stands in for the sign $\int$, and the differential names the variable: ∫ t e^t dt is integrated with respect to $t$. A fraction with the differential in the numerator works too: ∫ dx/(1 + x^2).
A definite integral takes its limits after an underscore and a caret, ∫_0^1 x^2 dx, ∫_{0}^{π/2} sin x dx, or in words: “x^2 from 0 to 1”, “∫ ln x dx on [1, e]”. The limits can be infinite: ∫_1^∞ dx/x^2, “from -∞ to +∞”. The area of a region is given by its boundary lines: “area between y = x^2 and y = x”, “area bounded by y = x^2, x = 1, x = 3, y = 0”, “area between y = 4 - x^2 and the x-axis”.
How to find an antiderivative
Differentiation can be done mechanically, by the rules. Integration can’t: there’s no single algorithm for “school” functions, only a set of techniques, and you have to recognise which one fits. It’s sensible to try them in this order.
1. Standard integrals and linearity. A sum is integrated term by term, and a constant factor comes out. Polynomials, roots, $\frac1x$, exponentials, sines and cosines come from the table:
| Function | Antiderivative |
|---|---|
| $x^n,\ n \ne -1$ | $\dfrac{x^{n+1}}{n + 1}$ |
| $\dfrac1x$ | $\ln\lvert x\rvert$ |
| $e^x$ | $e^x$ |
| $a^x$ | $\dfrac{a^x}{\ln a}$ |
| $\dfrac{1}{x^2 - a^2}$ | $\dfrac{1}{2a}\ln\left\lvert\dfrac{x - a}{x + a}\right\rvert$ |
| $\sin x$ | $-\cos x$ |
| $\cos x$ | $\sin x$ |
| $\dfrac{1}{\cos^2 x}$ | $\tan x$ |
| $\dfrac{1}{1 + x^2}$ | $\arctan x$ |
| $\dfrac{1}{\sqrt{1 - x^2}}$ | $\arcsin x$ |
2. Substitution. If a function of $u$ sits next to the derivative of that $u$, the substitution $t = u$ turns the integral into a standard one: in $\int \frac{x\,dx}{x^2 + 1}$ the factor $x\,dx$ is half of $d(x^2 + 1)$, and the answer is $\frac12 \ln(x^2 + 1) + C$.
3. Integration by parts, $\int u\,dv = uv - \int v\,du$, is for products of the form “polynomial times an exponential, sine or cosine” (take the polynomial as $u$: it gets simpler when differentiated) and for logarithms and inverse trigonometric functions (take them as $u$).
4. Rational functions are split into partial fractions: $\frac{1}{x^2 - 1} = \frac12\left(\frac{1}{x - 1} - \frac{1}{x + 1}\right)$, and each one integrates to a logarithm or an arctangent.
5. Trigonometry: an odd power of sine or cosine calls for the substitution $t = \cos x$ or $t = \sin x$; even powers are reduced with the double-angle formulas; as a last resort, the universal substitution $t = \tan\frac{x}{2}$ helps.
After any technique, the answer is checked by differentiating: the derivative of the function you found must match the integrand. The solver does this check twice, symbolically and numerically at three points.
Why an integral is an area
The definite integral $\int_a^b f(x)\,dx$ is the area under the graph, built up from thin strips: split the interval into $n$ parts, draw a rectangle of height $f(x_i)$ on each, and add them up. As the strips get thinner, the sums approach a single number. Computing it through sums takes a long time; the fundamental theorem of calculus gives a short cut.
Why is it true? Let $S(x)$ be the area under the graph from $a$ to $x$. Move the right-hand boundary by a tiny $h$, and the area grows by a narrow strip of width $h$ and height almost $f(x)$, that is, $S(x + h) - S(x) \approx f(x)\,h$. So $S'(x) = f(x)$: the accumulated area is an antiderivative. Two antiderivatives differ by a constant, and $S(a) = 0$, so $S(b) = F(b) - F(a)$.
Hence the need for care. The formula requires $f$ to be continuous on the whole interval. If there’s a point inside where the function runs off to infinity, the integral is improper: split it at that point and compute each part as a limit. Infinite limits are handled the same way: $\int_1^{\infty} \frac{dx}{x^2} = \lim_{b \to \infty}\left(1 - \frac1b\right) = 1$.
Worked examples
Example 1. By parts, twice: $\int x^2 \sin x\,dx$
Take $u = x^2$, $dv = \sin x\,dx$; then $du = 2x\,dx$, $v = -\cos x$:
$$\int x^2 \sin x\,dx = -x^2 \cos x + 2\int x\cos x\,dx.$$
The remaining integral goes by parts again, with $u = x$: $\int x \cos x\,dx = x \sin x + \cos x$. The result:
$$\int x^2 \sin x\,dx = 2x\sin x - (x^2 - 2)\cos x + C.$$
Check: $(2x\sin x)' = 2\sin x + 2x\cos x$, $\bigl(-(x^2 - 2)\cos x\bigr)' = -2x\cos x + (x^2 - 2)\sin x$; the sum is $x^2 \sin x$.
Example 2. Partial fractions: $\int \dfrac{dx}{x^2 - 1}$
The denominator factorises: $x^2 - 1 = (x - 1)(x + 1)$. We look for $\frac{1}{x^2 - 1} = \frac{A}{x - 1} + \frac{B}{x + 1}$; putting everything over a common denominator gives $A(x + 1) + B(x - 1) = 1$, so $x = 1$ gives $A = \frac12$ and $x = -1$ gives $B = -\frac12$. Each fraction gives a logarithm:
$$\int \frac{dx}{x^2 - 1} = \frac12 \ln\lvert x - 1\rvert - \frac12 \ln\lvert x + 1\rvert + C = \frac12 \ln\left\lvert\frac{x - 1}{x + 1}\right\rvert + C.$$
Example 3. An odd power of sine: $\int \sin^3 x\,dx$
Split off one sine: $\sin^3 x = (1 - \cos^2 x)\sin x$, and $\sin x\,dx = -d(\cos x)$. After substituting $t = \cos x$:
$$\int \sin^3 x\,dx = -\int (1 - t^2)\,dt = -t + \frac{t^3}{3} + C = \frac{\cos^3 x}{3} - \cos x + C.$$
Example 4. A definite integral and an area
$\int_0^1 x e^x\,dx$: by parts, an antiderivative is $F(x) = e^x(x - 1)$, and $F(1) - F(0) = 0 - (-1) = 1$.
The area between $y = x^2$ and $y = x$: the graphs cross where $x^2 = x$, that is, at $x = 0$ and $x = 1$. Between these points the line is higher (at $x = \frac12$ we have $\frac12 > \frac14$), so
$$S = \int_0^1 (x - x^2)\,dx = \left.\frac{x^2}{2} - \frac{x^3}{3}\right|_0^1 = \frac12 - \frac13 = \frac16.$$
Common mistakes
- Forgetting $+\,C$. There are infinitely many antiderivatives, all differing by a constant. An answer without $C$ is one of them, but the question asks for all of them.
- Taking the integral of a product to be the product of the integrals. $\int x \cos x\,dx \ne \frac{x^2}{2}\sin x$: differentiate and the extra term shows up at once. Products call for integration by parts.
- $\ln x$ instead of $\ln\lvert x\rvert$. The function $\frac1x$ is defined for $x < 0$ too, but $\ln x$ isn’t. The absolute value is needed.
- Substituting without changing the differential. In $\int \sin 3x\,dx$, after $t = 3x$ you must also replace $dx = \frac{dt}{3}$; the answer is $-\frac13 \cos 3x + C$, not $-\cos 3x + C$. In a definite integral, a substitution also changes the limits.
- Newton–Leibniz across a discontinuity. The “calculation” $\int_{-1}^{1} \frac{dx}{x^2} = \left[-\frac1x\right]_{-1}^{1} = -2$ is meaningless: a positive function can’t give a negative area. The function is infinite at zero, and the integral diverges.
- An area that “cancels out”. $\int_0^{2\pi} \sin x\,dx = 0$, but the area under the sine curve is $4$: the part below the axis has to be taken with a minus sign.
- An invented antiderivative. $\int e^{x^2}dx \ne \frac{e^{x^2}}{2x}$: the derivative of this fraction isn’t $e^{x^2}$. This integral can’t be expressed in elementary functions; the solver says so plainly and computes the definite integral numerically.
See also
How the integral grew out of Archimedes’ quadrature of the parabola and Riemann sums, and why area is connected with tangents, is told in the chapter on the integral; it also has integration techniques and Torricelli’s trumpet, an improper integral with a finite volume and an infinite surface area. You can check an antiderivative with the derivative solver, and improper integrals come down to limits. Integrals are the main tool for solving differential equations. To practise the technique, try the antiderivatives trainer.
Where this is explained
Other solvers
- Quadratic equation
- Linear equation
- System of linear equations
- Higher-degree equations and factoring
- Inequalities by the interval method
- Derivative
- Limit
- Curve sketching
- Fraction arithmetic
- GCD, LCM and Euclid's algorithm
- Prime factorisation
- Solving a triangle
- Matrices: determinant, inverse, rank, eigenvalues
- Trigonometric equation
- Exponential and logarithmic equations
- Percentages, compound interest, loans
- Permutations and combinations
- Number bases
- Complex numbers
- Congruences
- Progressions
- Probability: Bayes and Bernoulli trials
- Differential equation