Review 4: Integration by Parts

The product rule says that

LaTeX: \tfrac{d}{dx}(F(x)G(x))= F'(x) G(x)+F(x) G'(x),ddx(F(x)G(x))=F(x)G(x)+F(x)G(x),

so by integrating both sides and applying the fundamental theorem of calculus we have

LaTeX: \displaystyle F(x)G(x)+C=\int  F'(x) G(x) \, dx + \int F(x) G'(x) \, dx.F(x)G(x)+C=F(x)G(x)dx+F(x)G(x)dx.

Rearranging this equation, we get

LaTeX: \displaystyle \int F(x) G'(x) \, dx= F(x)G(x) - \int F'(x) G(x) \, dx.F(x)G(x)dx=F(x)G(x)F(x)G(x)dx.

You might be wondering where the LaTeX: +C+C went. Since indefinite integrals are not just a function but a family of functions corresponding to different values of C and we have an indefinite integral on both sides of the equation, we can absorb the LaTeX: +C+C into LaTeX: \int F(x) G'(x) \, dx.F(x)G(x)dx.

Let's rewrite the above equation with notation you may be more familiar with.  Let LaTeX: F(x)=u, G(x)=v,F(x)=u,G(x)=v, so that LaTeX: \tfrac{du}{dx}=F'(x)dudx=F(x) and LaTeX: \tfrac{dv}{dx}=G'(x).dvdx=G(x).Then if we agree that LaTeX: \tfrac{du}{dx} dx=dududxdx=du and LaTeX: \tfrac{dv}{dx}dx=dvdvdxdx=dv we get the more familiar

LaTeX: \displaystyle \int u \, dv= uv-\int v \, du.udv=uvvdu.

Because integration by parts has an integral on each side of the equation, one uses integration by parts to trade a more complicated integral for a less complicated integral. 

A Few Examples

1. Compute LaTeX: \int xe^x \, dx.xexdx.

This is a typical example of an indefinite integral where integration by parts is clearly able to help. Let LaTeX: u=xu=x and LaTeX: dv=e^x dx.dv=exdx. Then LaTeX: du=dxdu=dx and LaTeX: v=e^xv=ex, implying

LaTeX: \displaystyle \int x ex \, dx= xe^x-\int e^x \, dx=xe^x-e^x+C.xexdx=xexexdx=xexex+C.

Notice that through integration by parts we traded the more complicated integral LaTeX: \int xe^x \, dxxexdx for the simpler LaTeX: \int e^x \, dx.exdx.

2. Compute LaTeX: \int \arcsin(x) \, dx.arcsin(x)dx.

At first this does not look like a problem that can be solved by integration by parts; after all there is only one function in the integrand, not two as in the above formula. Keep in mind however, that we can always choose one of the two functions to be 1. Since we know that LaTeX: \tfrac{d}{dx} \arcsin(x)=\tfrac{1}{\sqrt{1-x^2}}ddxarcsin(x)=11x2let's pick LaTeX: u=\arcsin(x)\implies du=\tfrac{1}{\sqrt{1-x^2}} \, dxu=arcsin(x)du=11x2dx, leaving LaTeX: dv= dx \implies v=x.dv=dxv=x. Thus applying integration by parts, 

LaTeX: \displaystyle \int \arcsin(x) \, dx=x\arcsin(x)-\int \tfrac{x}{\sqrt{1-x^2}} \, dx.
arcsin(x)dx=xarcsin(x)x1x2dx.

Again we traded an unknown integral for one that is hopefully a little more familiar. Using the substitution LaTeX: w=1-x^2 \implies dw=-2x \, dxw=1x2dw=2xdx we can transform the above into

LaTeX: \begin{align*}
\int \arcsin(x) \, dx&=x\arcsin(x)-\int \tfrac{-1}{2}w^{-1/2} \, dw \\
&= x\arcsin(x)+w^{1/2} +C \\
&=x\arcsin(x)+\sqrt{1-x^2}+C.
\end{align*}arcsin(x)dx=xarcsin(x)12w1/2dw=xarcsin(x)+w1/2+C=xarcsin(x)+1x2+C.

3. Compute LaTeX: \int \sin^3(x/4)\cos(x/4)( \ln(\sin(x/4))^2 \, dx.sin3(x/4)cos(x/4)(ln(sin(x/4))2dx.

First let's make our lives a little easier. Notice that because of the presence of LaTeX: \cos(x/4)cos(x/4) we can make a substitution LaTeX: z=\sin(x/4)\implies dz=1/4\cos(x/4) \, dxz=sin(x/4)dz=1/4cos(x/4)dx so that 

LaTeX: \displaystyle \int \sin^3(x/4)\cos(x/4)(\ln(\sin(x/4)))^2 \, dx=\int 4 z^3(\ln(z))^2 \, dz.sin3(x/4)cos(x/4)(ln(sin(x/4)))2dx=4z3(ln(z))2dz.

Then we will integrate by parts with LaTeX: u=(\ln(z))^2, dv=4z^3 \, dz \implies du=\tfrac{2\ln z}{z} \, dz, v=z^4.u=(ln(z))2,dv=4z3dzdu=2lnzzdz,v=z4. Then applying the formula we get 

LaTeX: \displaystyle \int 4z^3(\ln(z))^2 \, dz=z^4(\ln(z))^2-\int z^4\tfrac{2\ln z}{z} \, dz= z^4(\ln (z))^2-\int 2z^3\ln z \, dz.4z3(ln(z))2dz=z4(ln(z))2z42lnzzdz=z4(ln(z))22z3lnzdz.

We still cannot integrate the last integral directly, but it is simpler than before. Let's try applying integration by parts a second time, with LaTeX: u=\ln z, dv=2z^3 \implies du=\tfrac1z, v=\tfrac{z^4}{2},u=lnz,dv=2z3du=1z,v=z42, so that 

LaTeX: \displaystyle \int 2 z^3\ln z \, dz=\tfrac{z^4}{2}\ln z-\int \tfrac{z^4}{2} \tfrac1z \, z=\tfrac12 z^4\ln z-\tfrac12\int z^3\, dz=\tfrac12 z^4\ln z-\tfrac{z^4}{8}+C.2z3lnzdz=z42lnzz421zz=12z4lnz12z3dz=12z4lnzz48+C.

Plugging this back into our original problem, we get

LaTeX: \begin{align*}
\int \sin^3\big(\tfrac{x}{4}\big) \cos\big(\tfrac{x}{4}\big) \big(\ln\big(\sin\big(\tfrac{x}{4}\big)\big)\big)^2 \, dx&=\int 4z^3(\ln(z))^2 \, dz \\
&=z^4(\ln(z))^2-\Big(\tfrac12 z^4 \ln z-\tfrac{z^4}{8}\Big)+C \\
&=\sin^4\big(\tfrac{x}{4}\big)\Big(\big(\ln\big(\sin\big(\tfrac{x}{4}\big)\big)\big)^2-\tfrac12\ln\big(\sin\big(\tfrac{x}{4}\big)\big)+\tfrac18\Big) +C.
\end{align*}sin3(x4)cos(x4)(ln(sin(x4)))2dx=4z3(ln(z))2dz=z4(ln(z))2(12z4lnzz48)+C=sin4(x4)((ln(sin(x4)))212ln(sin(x4))+18)+C.

Remark: Sometimes it can be hard to determine whether integration by parts applies, and if so, which choices of u and v will lead somewhere. Practice and trial and error will help the most with improving your skill. Generally speaking you want to pick your function LaTeX: uu to be something that gets simpler when differentiated, and LaTeX: dvdv to be a function which you know how to integrate.

4. Compute LaTeX: \int e^x \sin(x) \, dxexsin(x)dx.

This integral is clearly suited to integration by parts, the integrand being a product. We will see the situation is a little more complicated, however.

Approach a)  Let LaTeX: u=\sin(x)u=sin(x) and LaTeX: dv=e^x.dv=ex. Then 

LaTeX: \displaystyle \int e^x \sin(x)\, dx=e^x\sin(x)-\int e^x\cos(x) \, dx.exsin(x)dx=exsin(x)excos(x)dx.

The resulting integral is not much simpler than before. Let's try integration by parts again with LaTeX: u=\cos(x)u=cos(x) and LaTeX: dv=e^x.dv=ex. Then

LaTeX: \displaystyle \int e^x\cos(x) \, dx=e^x\cos(x)+\int e^x\sin(x) \, dx.excos(x)dx=excos(x)+exsin(x)dx.

Notice that the resulting integral from this second integration by parts is the initial integral, which allows us to use a technique sometimes called doubling back. Putting both steps together, we see

LaTeX: \displaystyle \int e^x\sin(x) \, dx=e^x\sin(x)-e^x\cos(x)-\int e^x\sin(x) \, dxexsin(x)dx=exsin(x)excos(x)exsin(x)dx.

Since the same integral appears on both sides of this equation, we can algebraically move it to one side and solve for it.

LaTeX: \begin{align*}
\int e^x\sin(x)\, dx&=e^x\sin(x)-e^x\cos(x)-\int e^x\sin(x)\, dx \\
2\int e^x\sin(x) \, dx&=e^x\sin(x)-e^x\cos(x)+C \\
\int e^x\sin(x) \, dx&=\frac12\Big(e^x\sin(x)-e^x\cos(x)\Big) +C.
\end{align*}exsin(x)dx=exsin(x)excos(x)exsin(x)dx2exsin(x)dx=exsin(x)excos(x)+Cexsin(x)dx=12(exsin(x)excos(x))+C.

You may be wondering where the LaTeX: CC came from. Since antiderivatives are families of functions, not functions themselves, there is a variable LaTeX: CC on either side of the equation that has been subsumed into the two integrals on each side. When we remove one of those integrals, we still require a LaTeX: CC on each side to stay balance.

Unlike previous examples, for this problem it does not matter which functions we choose to be LaTeX: uu and LaTeX: dvdv as long as we're consistent in our choice. 

Indeed, let's try this problem again, picking LaTeX: u=e^x, dv=\sin(x).u=ex,dv=sin(x). Then

LaTeX: \begin{align*}
\int e^x\sin(x) \, dx&=-e^x\cos(x)+\int e^x\cos(x) \, dx, \qquad u=e^x, \ dv=\cos(x) dx \\
&=-e^x\cos(x)+e^x\sin(x)-\int e^x\sin(x) \, dx \\
2\int e^x\sin(x) \, dx&=e^x\sin(x)-e^x\cos(x)+C \\
\int e^x\sin(x) \, dx&=\frac12\Big(e^x\sin(x)-e^x\cos(x)\Big) +C.
\end{align*}exsin(x)dx=excos(x)+excos(x)dx,u=ex, dv=cos(x)dx=excos(x)+exsin(x)exsin(x)dx2exsin(x)dx=exsin(x)excos(x)+Cexsin(x)dx=12(exsin(x)excos(x))+C.

This is the same answer as before.

Now let's see what happens if we are not consistent in our choices of LaTeX: uu and LaTeX: dvdv. Notice we picked first LaTeX: u=\sin(x), dv=e^xu=sin(x),dv=ex then LaTeX: u=\cos(x), dv=e^x.u=cos(x),dv=ex. If we had instead picked LaTeX: u=e^x, dv=\cos(x)u=ex,dv=cos(x) for the second step of integration by parts, we would get

LaTeX: \begin{align*}
\int e^x\sin(x) \, dx &= e^x\sin(x)-\int e^x\cos(x) \, dx \\
&=e^x\sin(x)-e^x\sin(x)+\int e^x\sin(x)\, dx \\
\int e^x\sin(x) \, dx&=\int e^x \sin(x) \, dx.
\end{align*}exsin(x)dx=exsin(x)excos(x)dx=exsin(x)exsin(x)+exsin(x)dxexsin(x)dx=exsin(x)dx. 

as you can see, this choice of integration by parts undoes our previous work, getting us back where we started.