How to Solve Integrals Step by Step
Solving an integral is rarely one big trick. It is a short sequence of questions you ask about the function in front of you: can I simplify it, is it in the table, does a substitution help, and so on. Once you know the order of those questions, most integrals in a first calculus course become routine.
This guide gives you that order. You will see a seven-step algorithm, a table that maps the shape of an integrand to a method, and three worked examples. If you want to check your own work along the way, use the integral calculator: it solves indefinite and definite integrals, shows the solution step by step, checks your answer, and plots the graph.
What does it mean to “solve” an integral?
The word “integral” covers a few different tasks, and the goal is slightly different for each. If you are not yet sure what an integral represents, start with What Is an Integral. Here is the short version.
Indefinite integrals
An indefinite integral asks for a family of functions. You are given f(x) and must find every function F(x) whose derivative is f(x):
\int f(x)\,dx = F(x) + C
The + C is part of the answer. Two antiderivatives of the same function differ by a constant, because the derivative of a constant is zero. Leaving out + C is one of the most common ways to lose points.
Definite integrals
A definite integral has limits, and its answer is a number:
\int_a^b f(x)\,dx = F(b) - F(a)
Geometrically it is the signed area between the graph of f and the x-axis from x=a to x=b. To compute it, you first find an antiderivative F and then evaluate it at the limits. This is the idea behind The Fundamental Theorem of Calculus. The details of evaluating it cleanly, including what to do with substitutions, are in How to Evaluate Definite Integrals. No + C is needed here, since it cancels when you subtract.
Improper integrals
If a limit is infinite, or the function blows up inside the interval, the integral is improper. You handle it with a limit, and the first question is whether it converges at all. That topic has its own article: Improper Integrals.
A note on “no answer”
Some integrals cannot be written with elementary functions at all. \int e^{-x^2}\,dx is the classic example. This does not mean you made a mistake. See Non-Elementary Integrals for how to recognize these cases.
A step-by-step algorithm for solving integrals
Work through these steps in order. Most integrals are solved by step 4 or earlier.
Step 1: Simplify the integrand
Before choosing a method, rewrite the function in the simplest form you can. Expand brackets, split fractions, and use identities. For example:
\frac{x^4 + 3x}{x^2} = x^2 + \frac{3}{x}, \qquad \sin x \cos x = \tfrac{1}{2}\sin 2x
A few seconds of algebra often turns a hard-looking integral into a table integral.
Step 2: Check whether it is a table integral
Split the integrand into a sum of basic pieces and use the standard formulas together with the sum and constant-multiple rules:
\int (a f(x) + b g(x))\,dx = a\int f(x)\,dx + b\int g(x)\,dx
The basic formulas you need most are:
| Function | Antiderivative |
|---|---|
| x^n (for n \neq -1) | \dfrac{x^{n+1}}{n+1} + C |
| \dfrac{1}{x} | \ln\lvert x\rvert + C |
| e^x | e^x + C |
| \sin x | -\cos x + C |
| \cos x | \sin x + C |
The longer list is in Integral Formulas and Rules. If your integrand fits, you are done.
Step 3: Try a substitution
Look for a function and its derivative (up to a constant factor) sitting in the same integrand. For instance, in \int 2x\cos(x^2)\,dx the inner function is x^2 and its derivative is 2x. Setting u = x^2 gives du = 2x\,dx, and the integral becomes \int \cos u\,du = \sin u + C = \sin(x^2) + C.
The full technique, including how to change limits in definite integrals, is in Integration by Substitution.
Step 4: Try integration by parts
If the integrand is a product of two different kinds of functions, such as a polynomial times e^x, \sin x or \cos x, use
\int u\,dv = uv - \int v\,du
Choose u so that it becomes simpler when differentiated, and dv so that you can integrate it. See Integration by Parts for how to choose well and what to do when you have to apply the formula twice.
Step 5: Rational functions and partial fractions
If the integrand is a fraction of two polynomials, first check whether the numerator’s degree is at least the denominator’s. If so, divide the polynomials first. Then factor the denominator and split the fraction into simpler pieces. For example,
\frac{1}{x^2 - 1} = \frac{1}{(x-1)(x+1)} = \frac{1/2}{x-1} - \frac{1/2}{x+1}
Each piece is a logarithm after integration. The complete method is in Partial Fractions.
Step 6: Trigonometric integrals and trigonometric substitution
Two situations belong here.
- The integrand is built from powers of \sin, \cos, \tan or \sec. Identities such as \sin^2 x = \frac{1 - \cos 2x}{2} reduce the powers. See Trigonometric Integrals.
- The integrand contains \sqrt{a^2 - x^2}, \sqrt{a^2 + x^2} or \sqrt{x^2 - a^2}. A trigonometric substitution removes the root. See Trigonometric Substitution.
Step 7: Check by differentiating
Differentiate your answer. If you get the original integrand back, the antiderivative is correct. This takes less than a minute and catches sign errors, missing constants and wrong coefficients. For definite integrals, check that you substituted the limits in the right order, upper minus lower.
If you keep losing points on the same kinds of slips, read Common Integration Mistakes.
Which method for which integrand?
This table summarizes steps 2 to 6. Use it as a quick lookup when you are not sure where to start. If more than one row seems to fit, How to Choose an Integration Method explains how to decide.
| The integrand looks like | Try this | Read more |
|---|---|---|
| A sum of powers, e^x, \sin x, \cos x, 1/x | Table formulas, term by term | Integral Formulas and Rules |
| f(g(x))\cdot g'(x), an inner function with its derivative | Substitution | Integration by Substitution |
| Polynomial times e^x, \sin x or \cos x; also \ln x or \arctan x alone | Integration by parts | Integration by Parts |
| A fraction \dfrac{P(x)}{Q(x)} with a factorable denominator | Partial fractions | Partial Fractions |
| Powers of \sin, \cos, \tan, \sec; products like \sin ax \cos bx | Identities and substitution | Trigonometric Integrals |
| \sqrt{a^2 - x^2}, \sqrt{a^2 + x^2}, \sqrt{x^2 - a^2} | Trigonometric substitution | Trigonometric Substitution |
| e^{-x^2}, \dfrac{\sin x}{x} and similar | No elementary antiderivative | Non-Elementary Integrals |
Worked examples
The three examples below go from simple to harder. In each one, the last step is a check by differentiation.
Example 1: Simplify, then use the table
Find
\int \frac{x^4 + 3x}{x^2}\,dx
Step 1. Simplify. Divide each term of the numerator by x^2:
\frac{x^4 + 3x}{x^2} = x^2 + \frac{3}{x}
Step 2. Integrate term by term. Use the power rule for x^2 and the logarithm formula for 1/x:
\int \left(x^2 + \frac{3}{x}\right) dx = \frac{x^3}{3} + 3\ln\lvert x\rvert + C
Check. Differentiate:
\frac{d}{dx}\left(\frac{x^3}{3} + 3\ln\lvert x\rvert + C\right) = x^2 + \frac{3}{x}
This matches the simplified integrand, so the answer is correct.
Example 2: A substitution
Find
\int \frac{x}{x^2 + 1}\,dx
Step 1. Spot the pair. The derivative of x^2 + 1 is 2x, and the numerator is x, which is \tfrac{1}{2} of that. So the inner function is x^2 + 1.
Step 2. Substitute. Let u = x^2 + 1. Then du = 2x\,dx, so x\,dx = \tfrac{1}{2}\,du:
\int \frac{x}{x^2 + 1}\,dx = \frac{1}{2}\int \frac{du}{u} = \frac{1}{2}\ln\lvert u\rvert + C
Step 3. Go back to x. Since x^2 + 1 > 0 for every real x, the absolute value is not needed:
\int \frac{x}{x^2 + 1}\,dx = \frac{1}{2}\ln(x^2 + 1) + C
Check. By the chain rule:
\frac{d}{dx}\left(\frac{1}{2}\ln(x^2 + 1)\right) = \frac{1}{2}\cdot\frac{2x}{x^2 + 1} = \frac{x}{x^2 + 1}
Example 3: Integration by parts, checked in the calculator
Find
\int x\cos x\,dx
The integrand is a product of a polynomial and a trigonometric function, which is the standard signal for integration by parts.
Step 1. Choose u and dv. Take u = x, because it becomes simpler when differentiated, and dv = \cos x\,dx. Then
du = dx, \qquad v = \sin x
Step 2. Apply the formula.
\int x\cos x\,dx = x\sin x - \int \sin x\,dx
Step 3. Finish the remaining integral. Since \int \sin x\,dx = -\cos x + C,
\int x\cos x\,dx = x\sin x + \cos x + C
Check. Differentiate with the product rule:
\frac{d}{dx}\left(x\sin x + \cos x\right) = \sin x + x\cos x - \sin x = x\cos x
The result is the original integrand, so the answer is correct.
You can check this step by step in the integral
calculator, where the expression x*cos(x) is
already filled in.
The same integral with limits
Once you have the antiderivative, a definite integral is just evaluation. For the limits 0 and \frac{\pi}{2}:
\int_0^{\pi/2} x\cos x\,dx = \Big[x\sin x + \cos x\Big]_0^{\pi/2} = \left(\frac{\pi}{2}\cdot 1 + 0\right) - (0 + 1) = \frac{\pi}{2} - 1
The numerical value is about 0.5708. You can try the definite version in the calculator as well.
How the calculator shows steps
Doing a few integrals by hand is the best way to learn the methods, but it helps to have something to compare against. The integral calculator is built for that.
Enter the integrand, for example x*cos(x), and
choose whether you want an indefinite integral or a definite one
with limits. The calculator returns the result and shows the
solution step by step, so you can see how the problem is broken
down and compare each line with your own work. If your
hand-written answer differs from the calculator’s, look for the
first step where the two diverge. That is usually where the
mistake is.
A few practical tips:
- Write multiplication explicitly with
*, for example3*xinstead of3x. - Use
pifor \pi andoofor infinity when you enter limits. - Use the graph to sanity-check a definite integral. If the function is mostly above the axis on your interval, a large negative answer is a red flag.
Treat the calculator as a way to verify and learn, not as a replacement for knowing the methods. On an exam you will need to produce the steps yourself.
FAQ
Is there one method that works for every integral?
No. Different integrands call for different methods, which is why the algorithm above tries them in a fixed order. Some integrals, such as \int e^{-x^2}\,dx, have no antiderivative in terms of elementary functions, so no method will produce a closed form. See Non-Elementary Integrals.
How do I know my answer is correct?
Differentiate it. If the derivative equals the original integrand, the antiderivative is right. You can also enter the integral in the calculator and compare the result with yours. Remember that two correct antiderivatives can differ by a constant, so the forms may not look identical.
Why do I have to write + C?
Because the derivative of any constant is zero, an integrand has infinitely many antiderivatives that differ only by a constant. The + C stands for all of them. In a definite integral the constant cancels when you compute F(b) - F(a), so you do not write it there.
Where to go next
Pick the method that matches your integrand from the table above and work through its article. If you are not sure which one fits, start with How to Choose an Integration Method. And whenever you finish a problem, differentiate the answer or run it through the calculator before moving on.