Repeated Integration by Parts
Textbook Reference
| Primary source | OpenStax Calculus Volume 2, Section 3.1: “Integration by Parts” |
| Direct link | https://openstax.org/books/calculus-volume-2/pages/3-1-integration-by-parts |
| Supplementary | Calculus (Stewart), Section 7.1: “Integration by Parts,” pages 525 to 527 |
OpenStax Calculus Volume 2 is free and openly licensed. The repeated example $\int x^2 e^{3x}\, dx$ and the cyclic example are in this section.
Key idea
Sometimes one trade is not enough, so you trade again.
You already know that integration by parts swaps a hard integral $\int u\, dv$ for an easier one $\int v\, du$. But what if the new integral is easier, yet still not something you can finish directly? Then you do parts a second time on that new integral. Each pass peels off one layer. There are exactly two situations where this happens, and they have different endings.
Here is the picture. In the first situation, $u$ is a power of $x$ like $x^2$. Each time you differentiate it, the power drops by one: $x^2$ becomes $2x$, then $2x$ becomes $2$, then $2$ becomes $0$. So after enough parts steps, the troublesome factor disappears and you are left with an integral you can finish. This is the “grind it down to zero” situation, and a bookkeeping shortcut called the tabular method makes it fast.
In the second situation, $u$ and $dv$ are both functions that cycle under differentiation and integration, like $e^x$ and $\sin x$. They never grind down to zero. Instead, after two parts steps, the original integral reappears on the right side of your equation. That looks like failure, but it is actually a gift: you treat the integral as an unknown and solve for it algebraically. This is the “it comes back, so solve for it” situation.
This means: when you see a power of $x$ times an exponential or trig function, expect to repeat parts until the power dies. When you see an exponential times a trig function, expect the integral to loop back and plan to solve for it.
Prerequisite Check
Before this lesson, make sure you can do all of the following:
If single-step parts is not yet automatic, review the Integration by Parts Formula lesson first.
Quick Reference
Two patterns that need repeated parts.
| Pattern | Example | Ending |
|---|---|---|
| Polynomial times exponential or trig | $\int x^2 e^x\, dx$, $\int x^2 \cos x\, dx$ | Repeat until the polynomial differentiates to $0$; the tabular method organizes it |
| Exponential times trig | $\int e^x \sin x\, dx$, $\int e^{2x}\cos x\, dx$ | The integral reappears after two steps; solve for it algebraically |
The tabular method (for polynomial times easy-to-integrate factor). Make two columns. In the left column, repeatedly differentiate $u$ down to $0$. In the right column, repeatedly integrate $dv$. Then multiply along diagonals, alternating signs $+, -, +, \ldots$
The cyclic trick. After two parts steps you reach an equation of the form $I = (\text{stuff}) - kI$ for some constant $k$. Add $kI$ to both sides and divide: $I = \dfrac{\text{stuff}}{1 + k}$.
Key Concepts
1. Repeating Parts the Long Way
Example 1. Find $\displaystyle\int x^2 e^x\, dx$.
Goal and thought process. The factor $x^2$ is algebraic and $e^x$ is exponential, so by LIATE $u = x^2$. One parts step will not finish it, because differentiating $x^2$ gives $2x$, not a constant. Expect two steps.
First parts step. $u = x^2$, $dv = e^x\, dx$, so $du = 2x\, dx$, $v = e^x$: \[ \int x^2 e^x\, dx = x^2 e^x - \int 2x e^x\, dx = x^2 e^x - 2\int x e^x\, dx. \]
Second parts step on $\int x e^x\, dx$. From the formula lesson, $\int x e^x\, dx = x e^x - e^x$. Substitute: \[ \int x^2 e^x\, dx = x^2 e^x - 2\big(x e^x - e^x\big) + C = x^2 e^x - 2x e^x + 2 e^x + C. \]
Boxed answer. \[ \boxed{\int x^2 e^x\, dx = e^x\big(x^2 - 2x + 2\big) + C} \]
Check by differentiating. Differentiate $e^x(x^2 - 2x + 2)$ with the product rule: $e^x(x^2 - 2x + 2) + e^x(2x - 2) = e^x(x^2 - 2x + 2 + 2x - 2) = e^x x^2$. That is the original integrand. Correct.
Recap. Each parts step lowered the power of $x$ by one. Two steps took $x^2$ down to a constant, at which point the integral finished. The pattern of signs $+, -, +$ on the terms is not an accident, and the tabular method below makes it mechanical.
2. The Tabular Method (A Shortcut for the Same Work)
When $u$ is a polynomial that differentiates down to $0$ and $dv$ is easy to integrate repeatedly, the tabular method does Example 1 in one compact table. It is the same calculation, organized so you do not lose track of signs.
The recipe.
- Left column: write $u$, then its successive derivatives, down to $0$.
- Right column: write $dv$ (without the $dx$), then its successive antiderivatives, one for each row.
- Attach signs to the diagonals, starting $+$ then alternating: $+, -, +, -, \ldots$
- Multiply each left-column entry by the right-column entry one row below it, along the signed diagonal, and add the results.
Example 2. Redo $\displaystyle\int x^2 e^x\, dx$ with the table.
| Sign | Differentiate ($u$) | Integrate ($dv$) |
|---|---|---|
| $+$ | $x^2$ | $e^x$ |
| $-$ | $2x$ | $e^x$ |
| $+$ | $2$ | $e^x$ |
| $0$ | $e^x$ |
Multiply along the diagonals with the signs: \[ +\,(x^2)(e^x) \;-\; (2x)(e^x) \;+\; (2)(e^x) = e^x(x^2 - 2x + 2) + C. \]
This matches Example 1 exactly. The table is worth using whenever the polynomial has degree two or more, because it removes the chance of a sign error across several steps.
Quick self-check. Why does the left column always reach $0$, and what would go wrong if you tried the tabular method on $\int e^x \sin x\, dx$?
Show answer
The left column reaches $0$ because differentiating a polynomial lowers its degree by one each time, so after finitely many steps it becomes a constant and then $0$. For $\int e^x \sin x\, dx$, neither $e^x$ nor $\sin x$ ever differentiates to $0$; they cycle forever. The table would never terminate. That integral needs the cyclic trick instead, shown next.
3. The Cyclic Case: Solving for the Integral
Example 3. Find $\displaystyle\int e^x \sin x\, dx$.
Goal and thought process. Both $e^x$ and $\sin x$ cycle under differentiation, so no choice grinds down to $0$. The plan is different: do parts twice, watch the original integral reappear, then solve for it. Name the integral $I = \int e^x \sin x\, dx$ so you can refer to it.
First parts step. Let $u = \sin x$, $dv = e^x\, dx$, so $du = \cos x\, dx$, $v = e^x$: \[ I = e^x \sin x - \int e^x \cos x\, dx. \]
Second parts step on $\int e^x \cos x\, dx$. Keep the same type of choice ($u$ the trig factor): $u = \cos x$, $dv = e^x\, dx$, so $du = -\sin x\, dx$, $v = e^x$: \[ \int e^x \cos x\, dx = e^x \cos x - \int e^x(-\sin x)\, dx = e^x \cos x + \int e^x \sin x\, dx = e^x \cos x + I. \]
Substitute back. Replace the inner integral in the first equation: \[ I = e^x \sin x - \big(e^x \cos x + I\big) = e^x \sin x - e^x \cos x - I. \]
Solve for $I$. Add $I$ to both sides: \[ 2I = e^x \sin x - e^x \cos x \quad\Longrightarrow\quad I = \frac{e^x(\sin x - \cos x)}{2}. \]
Boxed answer. \[ \boxed{\int e^x \sin x\, dx = \frac{e^x(\sin x - \cos x)}{2} + C} \]
Check by differentiating. Differentiate $\frac{1}{2}e^x(\sin x - \cos x)$ with the product rule: $\frac{1}{2}\big[e^x(\sin x - \cos x) + e^x(\cos x + \sin x)\big] = \frac{1}{2}e^x(2\sin x) = e^x \sin x$. Correct.
Recap. The key discipline is consistency: on the second step, make the same type of choice as the first (here, $u$ is the trig factor both times). If you switch the roles on the second step, you simply undo the first step and return to where you started, learning nothing. (That is the most common way this method stalls.)
4. Which Pattern Am I In?
A quick decision before you start:
- Polynomial $\times$ ($e^{ax}$ or $\sin$/$\cos$): the polynomial differentiates to $0$. Use repeated parts or the tabular method. The number of steps equals the degree of the polynomial.
- $e^{ax}$ $\times$ ($\sin$/$\cos$): nothing grinds to $0$. Do parts twice, keep choices consistent, and solve for the integral.
- Single transcendental ($\ln x$, $\arctan x$): usually one step (the formula lesson), not repeated parts.
Common Errors Summary
| Error | What it looks like | Correction |
|---|---|---|
| Switching roles on the second cyclic step | Picking $u = e^x$ after first picking $u = \sin x$ | Keep the same type of choice both steps, or you return to the start |
| Sign error across several steps | Losing a minus sign in $\int x^2 e^x\, dx$ | Use the tabular method, which fixes the $+, -, +$ pattern |
| Forgetting the table terminates only for polynomials | Trying tabular on $\int e^x\sin x\, dx$ | The differentiate-column must reach $0$; cyclic integrands never do |
| Dropping the $+C$ at the end | Cyclic answer with no constant | After solving for $I$, restore $+C$ on the indefinite result |
| Mishandling $\int e^{ax}\, dx$ | Writing $v = e^{ax}$ instead of $\frac{1}{a}e^{ax}$ | Antiderivative of $e^{ax}$ is $\frac{1}{a}e^{ax}$ |
Common Misconceptions
when repeating integration by parts, the result is the product of integrating each factor separately the required number of times.
This is the multiplicative-not-additive error. There is no rule that $\int f(x)g(x)\,dx$ equals a product of antiderivatives, even after multiple steps. Each round of parts produces a new term plus a new integral; the tabular method for $\int x^2 e^x\,dx$ yields $e^x(x^2 - 2x + 2) + C$, not $\tfrac{x^3}{3}\cdot e^x$. The final answer is a sum of diagonal products, not a product of column results.
the cyclic case can be resolved by switching the role of $u$ on the second parts step.
This is the composition-is-not-chaining error applied to the cyclic pattern. For $\int e^x\sin x\,dx$, the second application of parts must assign the same type to $u$ as the first. Switching from $u = \sin x$ to $u = e^x$ on the second step undoes the first step, returning the original integral with no new information. Consistency of the choice across both steps is what causes the original integral $I$ to reappear with a definite coefficient, making algebraic solution possible.
Leveled Practice
Level 1 -- Direct Application
Problem 1. Find $\displaystyle\int x^2 \sin x\, dx$.
Show answer
Tabular method: differentiate $x^2$, integrate $\sin x$.
| Sign | Differentiate | Integrate |
|---|---|---|
| $+$ | $x^2$ | $\sin x$ |
| $-$ | $2x$ | $-\cos x$ |
| $+$ | $2$ | $-\sin x$ |
| $0$ | $\cos x$ |
Diagonals: $+(x^2)(-\cos x) - (2x)(-\sin x) + (2)(-\sin x)$ \[ = -x^2\cos x + 2x\sin x + 2\cos x + C. \]
Check: differentiate to recover $x^2\sin x$ (the cosine and sine terms combine correctly). $\checkmark$
Problem 2. Find $\displaystyle\int x^2 e^{2x}\, dx$.
Show answer
Tabular method: integrate $e^{2x}$ each row (each antiderivative brings another $\frac{1}{2}$).
| Sign | Differentiate | Integrate |
|---|---|---|
| $+$ | $x^2$ | $\frac{1}{2}e^{2x}$ |
| $-$ | $2x$ | $\frac{1}{4}e^{2x}$ |
| $+$ | $2$ | $\frac{1}{8}e^{2x}$ |
| $0$ |
Diagonals: $+(x^2)\left(\frac{1}{2}e^{2x}\right) - (2x)\left(\frac{1}{4}e^{2x}\right) + (2)\left(\frac{1}{8}e^{2x}\right)$ \[ = \frac{1}{2}x^2 e^{2x} - \frac{1}{2}x e^{2x} + \frac{1}{4}e^{2x} + C. \]
$\checkmark$
Level 2 -- The Cyclic Case
Problem 3. Find $\displaystyle\int e^x \cos x\, dx$.
Show answer
Let $J = \int e^x\cos x\, dx$. First step $u = \cos x$, $dv = e^x\, dx$: \[ J = e^x\cos x - \int e^x(-\sin x)\, dx = e^x\cos x + \int e^x\sin x\, dx. \] From Example 3, $\int e^x\sin x\, dx = \frac{e^x(\sin x - \cos x)}{2}$. So \[ J = e^x\cos x + \frac{e^x(\sin x - \cos x)}{2} = \frac{2e^x\cos x + e^x\sin x - e^x\cos x}{2} = \frac{e^x(\cos x + \sin x)}{2} + C. \]
Check: differentiate $\frac{1}{2}e^x(\cos x + \sin x)$ to get $\frac{1}{2}e^x(2\cos x) = e^x\cos x$. $\checkmark$
Problem 4. Find $\displaystyle\int e^{2x}\sin x\, dx$ by doing parts twice and solving for the integral.
Show answer
Let $I = \int e^{2x}\sin x\, dx$. First step $u = \sin x$, $dv = e^{2x}\, dx$, so $v = \frac{1}{2}e^{2x}$: \[ I = \frac{1}{2}e^{2x}\sin x - \frac{1}{2}\int e^{2x}\cos x\, dx. \] Second step on $\int e^{2x}\cos x\, dx$ with $u = \cos x$, $dv = e^{2x}\, dx$, $v = \frac{1}{2}e^{2x}$: \[ \int e^{2x}\cos x\, dx = \frac{1}{2}e^{2x}\cos x + \frac{1}{2}\int e^{2x}\sin x\, dx = \frac{1}{2}e^{2x}\cos x + \frac{1}{2}I. \] Substitute: \[ I = \frac{1}{2}e^{2x}\sin x - \frac{1}{2}\left(\frac{1}{2}e^{2x}\cos x + \frac{1}{2}I\right) = \frac{1}{2}e^{2x}\sin x - \frac{1}{4}e^{2x}\cos x - \frac{1}{4}I. \] Add $\frac{1}{4}I$: $\frac{5}{4}I = \frac{1}{2}e^{2x}\sin x - \frac{1}{4}e^{2x}\cos x$, so \[ I = \frac{4}{5}\left(\frac{1}{2}e^{2x}\sin x - \frac{1}{4}e^{2x}\cos x\right) = \frac{e^{2x}(2\sin x - \cos x)}{5} + C. \]
$\checkmark$
Level 3 -- Reasoning
Problem 5. Explain, without computing, how many times you would apply integration by parts to evaluate $\int x^4 e^x\, dx$, and why the tabular method is preferable to doing it by hand here.
Show answer
Four times. Each parts step lowers the power of $x$ by one, and $x^4$ must be differentiated four times ($x^4 \to 4x^3 \to 12x^2 \to 24x \to 24$) before it becomes a constant, then once more to $0$. Doing four parts steps by hand invites a sign error, because each step introduces a minus sign that must be tracked and combined with the previous ones. The tabular method lays out all five terms at once with the alternating $+, -, +, -, +$ pattern fixed in advance, so the only work is multiplying along the diagonals. $\checkmark$
Mastery Checklist
You have mastered this skill when you can do all of the following without referring to notes:
Mental Model
Repeated parts is peeling an onion, and there are two kinds of onion.
The first kind has a finite number of layers. The polynomial factor loses one degree with every parts step, like peeling one layer at a time, until nothing is left and the integral finishes. The tabular method is just a neat way to peel all the layers at once and keep the signs straight.
The second kind never runs out of layers. An exponential times a sine or cosine keeps regenerating itself, so peeling forever gets you nowhere. The escape is to notice that after two peels the original onion is sitting on the table again. You name it, write the equation it satisfies, and solve for it like any unknown. The integral that looked unsolvable falls out of simple algebra.
Knowing which onion you are holding before you start is the whole skill: a power of $x$ means peel to the end, an exponential-times-trig means peel twice and solve.
Connections
Within Techniques of Integration (MATH162)
- Built directly on: the single-step Integration by Parts Formula. Repeated parts is that method applied two or more times.
- Reduction formulas: the trigonometric-integrals section (Stewart 7.2) derives reduction formulas, such as one that lowers $\int \sin^n x\, dx$ to $\int \sin^{n-2} x\, dx$, by exactly this repeated-parts idea.
- Definite versions: any repeated-parts integral can carry bounds, evaluating each bracket term at the limits as in the definite-integrals lesson.
Toward Later Mathematics
- Differential equations: the cyclic pattern $\int e^{ax}\sin(bx)\, dx$ is the integral behind damped oscillations and forced-vibration solutions.
- Transforms and series: reduction formulas built from repeated parts compute whole families of integrals at once, which is how transform tables and series coefficients are generated.
Audience Notes
For students who find math intimidating: You do not need to memorize anything new. The tabular method is a small table you fill in: differentiate down the left, integrate down the right, alternate the signs. For the looping kind, the only trick is to do parts twice and then solve a simple equation. If your second step undoes your first, you switched roles; keep them the same and try again.
For students interested in proof: The cyclic method is a clean use of treating an integral as an algebraic unknown. It works because the second integration by parts produces a constant multiple of the original integral, giving a solvable linear equation in $I$. The same structural idea, an operator equation that closes on itself, recurs throughout linear algebra and differential equations.
For students interested in careers: The exponential-times-sinusoid integral is the mathematical heart of alternating-current circuit analysis, control systems, and any setting with damped or driven oscillation. Engineers evaluate it constantly, and the solve-for-the-integral trick is the standard route.
Back to Techniques of Integration | Previous: Integration by Parts with Definite Integrals | Next: Integrals of Powers of Sine and Cosine