Integration by parts
Tonight's idea
The product rule says \((uv)' = u'v + uv'\). Integrate both sides: \(uv = \int u'v\,dx + \int uv'\,dx\). Move one integral across and you have a new tool.
\(\displaystyle\int u\,v'\,dx = uv - \int u'\,v\,dx\). In the shorthand \(dv = v'\,dx\), \(du = u'\,dx\): \(\int u\,dv = uv - \int v\,du\).
It is a trade: you hand over \(\int uv'\) and get back a boundary term \(uv\) plus a different integral, \(\int u'v\). It pays when the new integral is easier. For \(\int xe^x\,dx\), take \(u = x\) (its derivative is 1) and \(v' = e^x\) (integrating leaves it alone):
\[\int xe^x\,dx = xe^x - \int 1\cdot e^x\,dx = xe^x - e^x + C.\]
Check by differentiating. The figure says the same with areas: the two integrals are the two regions beside the curve; together they make the rectangle, the boundary term.
Rule of thumb: differentiate the factor that gets simpler (a power of \(x\), a logarithm, an inverse trig function) and integrate the one that does not get worse (\(e^x\), \(\sin x\), \(\cos x\)). Two tricks extend the reach; the example shows both.
Watch two: \(\int \ln x\,dx\), and a boomerang
There is no product in \(\ln x\). Make one: \(u = \ln x\), \(v' = 1\). Then \(u' = 1/x\) and \(v = x\):
\[\int \ln x\,dx = x\ln x - \int x\cdot\frac1x\,dx = x\ln x - x + C.\]
Now \(I = \int e^x\sin x\,dx\). Neither factor simplifies, so go round twice, with \(u\) the trig factor each time:
\[I = e^x\sin x - \int e^x\cos x\,dx = e^x\sin x - \Big(e^x\cos x + \int e^x\sin x\,dx\Big).\]
The last integral is \(I\) again. So \(2I = e^x(\sin x - \cos x)\), and \(I = \tfrac12 e^x(\sin x - \cos x) + C\). The integral came back to itself; treat it as an unknown and solve for it.
Your turn
- Find (a) \(\int x\cos x\,dx\) and (b) \(\int xe^{2x}\,dx\). Check each by differentiating.
- Evaluate exactly (a) \(\int_0^1 xe^{-x}\,dx\) and (b) \(\int_1^e \ln x\,dx\). For a definite integral the boundary term \(\big[uv\big]\) is evaluated between the limits too.
- (a) \(\int x^2e^x\,dx\) needs parts twice; each pass knocks one power off \(x^2\). (b) \(\int \arctan x\,dx\): the \(\ln x\) trick again, with \(v' = 1\). You will need \(\frac{d}{dx}\arctan x = \frac{1}{1+x^2}\).
- Let \(J = \int e^{-x}\cos x\,dx\). Integrate by parts twice until \(J\) reappears, solve for it, and then evaluate \(\int_0^\infty e^{-x}\cos x\,dx\). (As \(x \to \infty\), \(e^{-x}\) beats any bounded factor.)
Stretch: a formula for \(n!\)
Let \(I_n = \int_0^\infty x^ne^{-x}\,dx\). Show that \(I_0 = 1\). Integrate by parts once to show that \(I_n = n\,I_{n-1}\) for \(n \ge 1\). What is \(I_n\)? (With \(n\) not a whole number, this integral is how the factorial is extended beyond whole numbers: the gamma function.)
Answers
- (a) \(u = x\), \(v' = \cos x\): \(x\sin x - \int\sin x\,dx = x\sin x + \cos x + C\). (b) \(u = x\), \(v = \tfrac12e^{2x}\): \(\tfrac12xe^{2x} - \tfrac14e^{2x} + C\).
- (a) \(u = x\), \(v = -e^{-x}\): \(\big[-xe^{-x}\big]_0^1 + \int_0^1 e^{-x}\,dx = -e^{-1} + (1 - e^{-1}) = 1 - 2/e \approx 0.264\). (b) \(\big[x\ln x - x\big]_1^e = (e - e) - (0 - 1) = 1\).
- (a) \(x^2e^x - 2\int xe^x\,dx = x^2e^x - 2(xe^x - e^x) + C = (x^2 - 2x + 2)e^x + C\). (b) \(u = \arctan x\), \(v = x\): \(x\arctan x - \int\frac{x}{1+x^2}\,dx = x\arctan x - \tfrac12\ln(1 + x^2) + C\), the last integral by the substitution \(w = 1 + x^2\).
- \(u = \cos x\), \(v = -e^{-x}\): \(J = -e^{-x}\cos x - \int e^{-x}\sin x\,dx\). Again, \(u = \sin x\): \(\int e^{-x}\sin x\,dx = -e^{-x}\sin x + J\). So \(J = -e^{-x}\cos x + e^{-x}\sin x - J\), giving \(J = \tfrac12e^{-x}(\sin x - \cos x) + C\). Between 0 and \(\infty\): the value at \(\infty\) is 0, at 0 it is \(\tfrac12(0 - 1) = -\tfrac12\), so the integral is \(0 - (-\tfrac12) = \tfrac12\).
Stretch. \(I_0 = \big[-e^{-x}\big]_0^\infty = 0 - (-1) = 1\). With \(u = x^n\), \(v = -e^{-x}\): \(I_n = \big[-x^ne^{-x}\big]_0^\infty + n\int_0^\infty x^{n-1}e^{-x}\,dx = 0 + nI_{n-1}\), the boundary term vanishing at both ends for \(n \ge 1\). So \(I_n = n(n-1)\cdots 1\cdot I_0 = n!\).