Integration by Parts

As mentioned in the introduction to u-substitution, the remaining methods of integration of mostly just variations on substitution, and this next method, called integration by parts, is no exception.

Take the following example: xsinx dx\int x \sin x\ dx We'd get frustrated trying to use u-substitution on this one, but we can take a hint from the structure: it's the product of two functions. Go back to what you know about derivatives: in that case we'd use the Product Rule. There's no Product Rule for integration, but it turns out that's still a helpful place to start.

Since ddx[u(x)v(x)]=uv+uv,\dfrac{d}{dx} [u(x) \cdot v(x)] = uv' + u'v, uv+uv dx=uvuv dx+uv dx=uvudvdx dx+vdudx dx=uvu dv+v du=uv\begin{aligned} \int uv' + u'v\ dx &= uv\ \int uv' \ dx + \int u'v \ dx &= uv\ \int u \dfrac{dv}{dx}\ dx + \int v \dfrac{du}{dx}\ dx &= uv\ \int u \ dv + \int v\ du &= uv \end{aligned}

This all just looks like playing with symbols, but it leads to the formula that we'll use every time we use integration by parts: u dv=uvv du\ans{\int u \ dv = uv - \int v \ du}

The process has some similarities with u-substitution. Basically, we'll write the integral we're given to start with as the left hand side; to do that, we'll define half of it as uu and the other half as dvdv. Then we'll need to find vv and dudu, and use this formula to rewrite the given integral. After we do, we'll still have the integral v du\displaystyle\int v \ du to do, but if the process works, it'll be a doable integral.

First IBP

Evaluate xsinx dx\displaystyle\int x \sin x\ dx.

Solution

Our goal is to match xsinx dx\displaystyle\int x \sin x\ dx to u dv\displaystyle\int u \ dv. The differential dxdx will always be part of dvdv, but the question is, should uu be xx and dvdv be sinx dx\sin x \ dx, or should they be swapped?

We'll find a shortcut to answer that question in a moment, but for now, we could just try both options and see which one works.

Try this: let u=xu=x and let dv=sinx dxdv = \sin x \ dx. Then, we need to find dudu and vv. We already know how to find dudu - we'll do it the same way we did it during u-substitution. To find vv from dvdv, we'll reverse the process - integrate dvdv.

u=xv=cosxdu=dxdv=sinx dx\begin{array}{c c} u = x & v = -\cos x\ \downarrow & \uparrow\ du = dx & dv = \sin x \ dx \end{array}

Now just plug everything into the IBP (integration by parts) formula: u dv=uvv duxsinx dx=(x)(cosx)cosx dx=xcosx+sinx+C\begin{aligned} \int u \ dv &= uv - \int v \ du\ \int x \sin x \ dx &= (x)(-\cos x) - \int -\cos x \ dx\ &= \ans{-x \cos x + \sin x + C} \end{aligned}

Check

Differentiate the answer: ddx[xcosx+sinx+C]=cosx+xsinx+cosx=xsinx\dfrac{d}{dx}[-x \cos x + \sin x + C] = -\cos x + x \sin x + \cos x = x \sin x

We happened to pick uu and dvdv in such a way that it worked out, but what if we'd picked them the other way? Let's try that:

u=sinxv=12x2du=cosx dxdv=x dx\begin{array}{c c} u = \sin x & v = \dfrac{1}{2}x^2\ du = \cos x \ dx & dv = x \ dx \end{array}

Plugging these into the formula gives u dv=uvv du=12x2sinx12x2cosx dx\begin{aligned} \int u \ dv &= uv - \int v \ du\ &= \dfrac{1}{2}x^2 \sin x - \int \dfrac{1}{2}x^2 \cos x \ dx \end{aligned}

This results in a more difficult integral instead of a simpler one, so we're headed in the wrong direction; that's what happens when we pick uu and dvdv backwards.

We could always try the problem both ways and see which one works, but there's a quicker way.

How to pick uu and dvdv: LIPTE

There's a shortcut to pick uu and dvdv right the first time; there's no magic to it, but there's simply a pattern to what works, and it depends on the types of functions are in the problem.

Like in the example above, there will be two functions, typically multiplied together, and all we have to do is look at what kind of functions these are.

We'll use the acronym LIPTE for Logarithmic functions, Inverse trig functions, Power functions and polynomials, Trigonometric functions, and Exponential functions. The function that comes earlier in the list will be uu and the other will be dvdv: uLogarithmic functionsInverse trig functionsPower functionsTrig functionsdvExponential functions\begin{array}{r l} u & \textrm{Logarithmic functions}\ \uparrow & \textrm{Inverse trig functions}\ & \textrm{Power functions}\ \downarrow & \textrm{Trig functions}\ dv & \textrm{Exponential functions} \end{array}

For instance, in the example above, xx is a power function and sinx\sin x is a trig function, so since xx comes earlier in the list, we picked that as uu.

With that, let's do some more examples.

Examples

Evaluate 5x ex dx\displaystyle\int 5x \ e^x \ dx.

Solution

Here again, we have two functions: one (5x5x) is a power function and the other (exe^x) is an exponential function. Since P comes before E in LIPTE, let u=5xu=5x and dv=exdv=e^x.

Then u=5xv=exdu=5 dxdv=ex dx\begin{array}{c c} u = 5x & v = e^x\ du = 5 \ dx & dv = e^x \ dx \end{array}

and plugging these into the formula gives u dv=uvv du5x ex dx=5x ex5ex dx=5x ex5ex+C\begin{aligned} \int u \ dv &= uv - \int v \ du\ \int 5x\ e^x\ dx &= 5x\ e^x - \int 5e^x \ dx\ &= \ans{5x\ e^x - 5e^x + C} \end{aligned}

  1. xcosx dx\displaystyle\int x \cos x \ dx

  2. xsinx+cosx+Cx \sin x + \cos x + C

  3. tsin(2t) dt\displaystyle\int t \sin (2t) \ dt

  4. 12tcos(2t)+14sin(2t)+C-\dfrac{1}{2}t \cos (2t) + \dfrac{1}{4}\sin (2t) + C

  5. x2sin(πx) dx\displaystyle\int x^2 \sin (\pi x) \ dx

  6. 1πx2cos(πx)+2π2xsin(πx)+2π3cos(πx)+C-\dfrac{1}{\pi}x^2 \cos (\pi x) + \dfrac{2}{\pi^2} x \sin (\pi x) + \dfrac{2}{\pi^3} \cos (\pi x) + C

Using IBP Twice

Evaluate x2ex dx\displaystyle\int x^2 e^x \ dx.

Solution

This example looks very similar to the last one, and it starts the same way: u=x2v=exdu=2x dxdv=ex dx\begin{array}{c c} u = x^2 & v = e^x\ du = 2x \ dx & dv = e^x \ dx \end{array}

It's only when we plug all this into the formula that we notice the difference: u dv=uvv dux2ex dx=x2ex2xex dx\begin{aligned} \int u \ dv &= uv - \int v \ du\ \int x^2 e^x\ dx &= x^2 e^x - \int 2xe^x \ dx \end{aligned}

That integral on the right-hand side isn't one that we can do directly. However, it looks almost identical to the example we just finished doing, so it shouldn't come as a great surprise that we're going to use IBP again to finish solving this one.

It's important not to get sloppy in writing all of this down, because that can lead to simple mistakes.

Now if u=2xu=2x and dv=ex dxdv=e^x\ dx (still using LIPTE), we can use the IBP formula to rewrite 2xex dx\displaystyle\int 2x e^x \ dx: x2ex dx=x2ex2xex dx=x2exu dv=x2ex(uvv du)=x2ex(2xex2ex dx)=x2ex2xex+2ex+C\begin{aligned} \int x^2 e^x\ dx &= x^2 e^x - \int 2xe^x \ dx\ &= x^2e^x - \int u \ dv\ &= x^2e^x - \left(uv - \int v \ du\right)\ &= x^2e^x - \left(2xe^x - \int 2e^x\ dx\right)\ &= \ans{x^2e^x - 2xe^x + 2e^x + C} \end{aligned}

Notice the parentheses there; it's easy to forget those and have a sign error in your answer.

There are times when, after applying the IBP formula, the integral on the right-hand side needs more work. This may involve using integration by parts again, or it may involve u-substitution or some other method.

Evaluate lnyy dy\displaystyle\int \dfrac{\ln y}{\sqrt{y}}\ dy.

Solution

We've got a log function and a power function, so LIPTE says we should let u=lnyu=\ln y. Now be careful on this next step: you may be tempted to let dv=y dydv=\sqrt{y} \ dy, but if you did, the integral above wouldn't be exactly u dv\displaystyle\int u\ dv. In other words, we have to pick uu and dvdv so that the original problem is the product of the two. Thus, we should let dv=1y dydv = \dfrac{1}{\sqrt{y}}\ dy. To integrate that, rewrite it as y1/2y^{-1/2} and apply the Power Rule: u=lnyv=2y1/2du=1y dydv=y1/2 dy\begin{array}{c c} u = \ln y & v = 2y^{1/2}\ du = \dfrac{1}{y} \ dy & dv = y^{-1/2} \ dy \end{array}

Once we plug all this into the formula, we can finish integrating: u dv=uvv dulnyy dy=2y1/2lny2y1/21y dy=2y1/2lny2y1/2 dy=2y1/2lny4y1/2+C=2ylny4y+C\begin{aligned} \int u \ dv &= uv - \int v \ du\ \int \dfrac{\ln y}{\sqrt{y}}\ dy &= 2y^{1/2}\ln y - \int 2y^{1/2} \cdot \dfrac{1}{y} \ dy\ &= 2y^{1/2}\ln y - \int 2y^{-1/2} \ dy\ &= 2y^{1/2}\ln y - 4y^{1/2} + C\ &= \ans{2\sqrt{y}\ln y - 4\sqrt{y} + C} \end{aligned}

  1. p5 lnp dp\displaystyle\int p^5 \ \ln p \ dp

  2. 16p6 lnp136p6+C\dfrac{1}{6}p^6\ \ln p - \dfrac{1}{36}p^6 + C

The Natural Log Function

Evaluate lnx dx\displaystyle\int \ln x \ dx.

Solution

You may be tempted, when you see this, to automatically jump to the answer of 1x\dfrac{1}{x}, but that's only if you get the derivative and integral mixed up (which is a common enough mistake). We haven't encountered the integral of the natural log function yet, only its derivative.

As you may imagine based on where we see this problem, we're going to use integration by parts to solve it, but the difference from all the other problems is that there only appears to be one function.

Since the function we have occurs at the very top of the LIPTE scale, let's make that uu and make dvdv simply equal dxdx.

Then following the process... u=lnxv=xdu=1x dxdv= dx\begin{array}{c c} u = \ln x & v = x\ du = \dfrac{1}{x} \ dx & dv = \ dx \end{array}

u dv=uvv dulnx dx=xlnxx1x dx=xlnxdx=xlnxx+C\begin{aligned} \int u \ dv &= uv - \int v \ du\ \int \ln x \ dx &= x \ln x - \int x \cdot \dfrac{1}{x} \ dx\ &= x \ln x - \int dx\ &= \ans{x \ln x - x + C} \end{aligned}

At this point, you can memorize the integral of the natural log function if you like, or you can remember that we used integration by parts to find it, and you can re-derive it if needed.

  1. (lnx)2 dx\displaystyle\int (\ln x)^2 \ dx

  2. u=(lnx)2v=xdu=2lnx1x dxdv= dx\begin{array}{c c} u = (\ln x)^2 & v = x\ du = 2\ln x \cdot \dfrac{1}{x} \ dx & dv = \ dx \end{array}

    u dv=uvv du(lnx)2 dx=x(lnx)22lnx dx=x(lnx)22(xlnxx)+C=x(lnx)22xlnx+2x+C\begin{aligned} \int u \ dv &= uv - \int v \ du\ \int (\ln x)^2 \ dx &= x (\ln x)^2 - \int 2 \ln x \ dx\ &= x (\ln x)^2 - 2(x \ln x - x) + C\ &= \ans{x (\ln x)^2 - 2x \ln x + 2x + C} \end{aligned}

I'll do one final (tricky) example, then leave you with several more to try on your own.

A Tricky One

Evaluate exsinx dx\displaystyle\int e^x \sin x \ dx.

Solution

Using LIPTE again, we can pick the following: u=sinxv=exdu=cosx dxdv=ex dx\begin{array}{c c} u = \sin x & v = e^x\ du = \cos x \ dx & dv = e^x \ dx \end{array}

Let's try the IBP formula: u dv=uvv duexsinx dx=exsinxexcosx dx\begin{aligned} \int u \ dv &= uv - \int v \ du\ \int e^x \sin x \ dx &= e^x \sin x - \int e^x \cos x \ dx \end{aligned}

That integral on the right-hand side isn't one we can do directly, but we can use IBP again on it, like we've done before.

For this one, u=cosxv=exdu=sinx dxdv=ex dx\begin{array}{c c} u = \cos x & v = e^x\ du = -\sin x \ dx & dv = e^x \ dx \end{array}

This gets long, but the double IBP looks like this: exsinx dx=exsinxexcosx dx=exsinx(excosx+exsinx dx)=exsinxexcosxexsinx dx\begin{aligned} \int e^x \sin x \ dx &= e^x \sin x - \int e^x \cos x \ dx\ &= e^x \sin x - \left(e^x \cos x + \int e^x \sin x \ dx\right)\ &= e^x \sin x - e^x \cos x - \int e^x \sin x \ dx \end{aligned}

Well, this is awkward. This new integral also needs IBP; in fact, it's the exact integral we started with, so we're stuck in an infinite loop.

Here's the trick: we can solve for this integral like it is any variable. Add it to both sides, then divide by 2. exsinx dx=exsinxexcosxexsinx dx2exsinx dx=exsinxexcosxexsinx dx=12exsinx12excosx\begin{aligned} \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\ \int e^x \sin x \ dx &= \ans{\dfrac{1}{2}e^x \sin x - \dfrac{1}{2}e^x \cos x} \end{aligned}

  1. eθcos(2θ) dθ\displaystyle\int e^{-\theta} \cos (2\theta) \ d\theta

  2. 15eθcos(2θ)+25eθsin(2θ)+C-\dfrac{1}{5}e^{-\theta} \cos (2\theta) + \dfrac{2}{5}e^{-\theta} \sin (2\theta) + C

  3. cosxln(sinx) dx\displaystyle\int \cos x \cdot \ln (\sin x) \ dx

  4. sinxln(sinx)sinx+C\sin x \cdot \ln (\sin x) - \sin x + C

  5. x4(lnx)2 dx\displaystyle\int x^4 (\ln x)^2 \ dx

  6. 15x5(lnx)2225x5lnx+2125x5+C\dfrac{1}{5}x^5 (\ln x)^2 - \dfrac{2}{25}x^5 \ln x + \dfrac{2}{125}x^5 + C

  7. ye2y dy\displaystyle\int \dfrac{y}{e^{2y}} \ dy

  8. 12ye2y14e2y+C-\dfrac{1}{2}ye^{-2y} - \dfrac{1}{4}e^{-2y} + C