Apply integration by parts
Guess the answer, then correct it
The top curve is \(x\cos 2x\), and the lower curve is a candidate for its antiderivative. Each short dash shows the slope an antiderivative must have there, which is the height of the top curve. A dash is orange where the candidate has that slope and red where it does not.
Start with a guess: the product of \(x\) and an antiderivative of \(\cos 2x\), which is \(\tfrac12 x\sin 2x\).
By the product rule, the derivative of the guess is \(x\cos 2x + \tfrac12\sin 2x\), shown by the red dashed curve on top. The first term is the top curve, so the extra part is \(\tfrac12\sin 2x\).
To remove it, subtract an antiderivative of the extra part, which is \(-\tfrac14\cos 2x\). Press Add the correction. The candidate becomes \(\tfrac12 x\sin 2x + \tfrac14\cos 2x\), and every dash turns orange.
The product rule backwards
Take two functions \(u\) and \(v\) of \(x\). As \(x\) increases, the point \((u, v)\) moves along the curve. The orange rectangle has corners at the origin and at the point, so its area is \(uv\).
The teal region under the curve has the area \(\int v\,du\), and the green region beside the curve has the area \(\int u\,dv\).
Drag the point. The two regions grow, but together they fill the rectangle. This means the green region equals the rectangle minus the teal region.
Notation
The integral of \(u\,dv\) equals the product term \(uv\) minus the new integral of \(v\,du\), which replaces the one you started with.
\[\cg{\int u\,dv} = \cy{uv} - \cb{\int v\,du}\]Here \(dv = v'\,dx\) and \(du = u'\,dx\).
This is the product rule \((uv)' = u'v + uv'\), integrated. When \(x\) increases by \(dx\), the rectangle gains the thin teal strip \(v\,du\) and the thin green strip \(u\,dv\). Add up all the strips, so \(uv = \int v\,du + \int u\,dv\), and rearrange.
To use it, write the four items \(u\), \(du\), \(dv\) and \(v\). Then substitute them.
\[\begin{aligned} u &= \cdots & dv &= \cdots \\ du &= \cdots & v &= \cdots \end{aligned}\]Keep the minus sign in front of \(\int v\,du\) even when \(v\) is negative. Then the two minus signs give a plus.
With limits \(a\) and \(b\), the regions start at \(x = a\) and fill the big rectangle except for the small dashed rectangle \(u(a)\,v(a)\). This means the product term is the product at \(b\) minus the product at \(a\). Integrate the new integral between the same limits.
\[\cg{\int_a^b u\,dv} = \cy{\Big[uv\Big]_a^b} - \cb{\int_a^b v\,du}\]
When it fails
The formula needs \(u'\) and \(v'\) to be continuous. Press Make v jump to put a jump in \(v\) at one point. Then run the point past the jump.
The curve breaks, and the two regions no longer fill the rectangle. Neither covers the red strip, so the formula gives the wrong area.
Example 1: Carry the formula through
Find \(\displaystyle\int (2x+1)e^x\,dx\).
Choose \(u\) as the factor that becomes simpler when you differentiate it, which is \(2x+1\). Write the four items.
\[\begin{gathered}u = 2x+1, \ \ du = 2\,dx \\ dv = e^x\,dx, \ \ v = e^x\end{gathered}\]Substitute the four items. The teal curve below is the product \(uv\) alone, and its red dashes show that its slope is wrong. The new integral corrects it.
\[\begin{aligned}\int (2x+1)e^x\,dx &= (2x+1)e^x \\ &\quad - \int 2e^x\,dx\end{aligned}\]Integrate the new integral. Then collect the terms. Every dash below turns orange, so this is the antiderivative.
\[\begin{aligned} &= (2x+1)e^x - 2e^x + C \\ &= (2x-1)e^x + C \end{aligned}\]
Example 2: A definite integral
Find \(\displaystyle\int_0^{\pi} x\cos\frac x2\,dx\).
Take \(u = x\), because its derivative is 1. Write the four items. The green region beside the curve is the integral you want.
\[\begin{gathered}u = x, \ \ du = dx \\ dv = \cos\tfrac x2\,dx, \ \ v = 2\sin\tfrac x2\end{gathered}\]A tempting wrong move: Add the new integral to the product term.
\[\begin{aligned}&\int_0^\pi x\cos\tfrac x2\,dx \\ &\quad = \Big[2x\sin\tfrac x2\Big]_0^\pi \\ &\quad\ + \int_0^\pi 2\sin\tfrac x2\,dx\end{aligned}\]The red copy of the teal region sits on top of the rectangle, so the sum is larger than the whole rectangle \(2\pi\). The green region lies inside the rectangle, so its area must be less than \(2\pi\).
Subtract it instead, because the green region is the rectangle minus the teal region.
\[\begin{aligned}&\int_0^\pi x\cos\tfrac x2\,dx \\ &\quad = \Big[2x\sin\tfrac x2\Big]_0^\pi \\ &\quad\ - \int_0^\pi 2\sin\tfrac x2\,dx\end{aligned}\]Evaluate the product at both limits. At \(x = \pi\) it is \(2\pi\sin\tfrac\pi2 = 2\pi\), the area of the rectangle. At \(x = 0\) it is 0.
\[\Big[2x\sin\tfrac x2\Big]_0^\pi = 2\pi\]Integrate the new integral between the same limits. The antiderivative \(-4\cos\tfrac x2\) is 0 at \(\pi\) and \(-4\) at 0, so the teal area is 4. Subtract it from \(2\pi\).
\[\begin{aligned}\int_0^\pi 2\sin\tfrac x2\,dx &= \Big[-4\cos\tfrac x2\Big]_0^\pi \\ &= 4 \\ 2\pi - 4 &\approx 2.28\end{aligned}\]
Practice
Find \(\displaystyle\int (x-2)\sin x\,dx\).
The teal curve is the product \(uv\) alone, and its red tangent shows where its slope is wrong. Keep the minus sign of \(v\) and the minus sign in front of \(\int v\,du\), so the two give a plus.
Solution
Write the four items. The antiderivative of \(\sin x\) is \(-\cos x\), so \(v\) carries a minus sign.
\[\begin{gathered}u = x-2, \ \ du = dx \\ dv = \sin x\,dx, \ \ v = -\cos x\end{gathered}\]Form the product term and the new integral.
\[\begin{aligned}uv &= -(x-2)\cos x \\ \int v\,du &= \int -\cos x\,dx = -\sin x\end{aligned}\]Subtract the new integral. Subtracting \(-\sin x\) adds \(\sin x\), and every dash below turns orange.
\[\begin{aligned}&\int (x-2)\sin x\,dx \\ &\quad = -(x-2)\cos x + \sin x + C\end{aligned}\]
Questions
The figure shows \(u = x\) and \(v = e^x\) for \(x\) from 0 to 1. The orange rectangle has the area \(uv = e \approx 2.72\), and the teal region has the area \(e - 1 \approx 1.72\).
What is the area of the green region, \(\displaystyle\int_0^1 x e^x\,dx\)?
- 1.00
- 4.44
- 1.72
- 2.72
Answer
1.00
A student writes \(\int u\,dv = uv + \int v\,du\). What is wrong?
- The result is larger than the rectangle, but the green region lies inside the rectangle.
- The teal region has a negative area.
- The green region lies outside the rectangle.
Answer
The result is larger than the rectangle, but the green region lies inside the rectangle.
What is \(\displaystyle\int_0^\pi x\sin x\,dx\)? Use \(u = x\) and \(dv = \sin x\,dx\).
- \(\pi\)
- 0
- \(-\pi\)
Answer
\(\pi\)
Summary
You write \(u\), \(du\), \(dv\) and \(v\), and then subtract the integral of \(v\,du\) from the product \(uv\).
This works because the product rule run backwards shows that the regions \(\int u\,dv\) and \(\int v\,du\) fill the rectangle \(uv\).
Use it when the integrand is a product and one factor becomes simpler when you differentiate it.
This is one of four skills in topic 6.11 of Which & Why: AP Calculus.