Having looked at some issues in integration, let’s look at some old questions about integration by parts.

## What is integration by parts, and why?

Our first question is from 2001:

Proof of Integration by Parts Can you please tell me the integration formula for u(x)v(x)?

Kamrul is asking how to integrate the **product of two functions** of the independent variable; there is no “product rule” for integrals, as there is for derivatives, but there is something very similar.

Doctor Jordi answered:

Hello, Kamrul - thanks for writing to Dr. Math. I imagine you are talking about a procedure calledintegration by parts. It really is nothing more than aby-product of the product rule(no pun intended) for differentiation. Check it out: d(f(x)*g(x))/dx = f(x)*g'(x) + f'(x)*g(x) We solve for f(x)*g'(x): f(x)*g'(x) = d(f(x)*g(x))/dx - f'(x)*g(x) Integrate both sides and recall that an integral is the antiderivative: INT[f(x) g'(x)dx] = f(x)*g(x) - INT[ f'(x) g(x) dx]

$$\int f(x)g'(x)dx=f(x)g(x)-\int f'(x)g(x)dx$$

We are turning the product rule for derivatives “inside-out”.

This is the function-notation version; we often memorize it in terms of variables and differentials instead:

Then change to the common notation: u = f(x) v = g(x) du = f'(x)dx dv = g'(x)dx This gives us the formula for integration by parts: INT[u dv] = uv - INT[v du]

$$\int u dv=uv-\int v du$$

What this does is to swap the roles of *u* and *v*, in the hope that the new integral will be something we can work out. Like all methods for integration, this is an art, not a mechanical rule that will always give us an answer.

The hard part is often to decide what part of the integrand to call “*u*“. We need to be able to find *v*, first, and then to be able to carry out the integral.

## Sometimes there’s only one part!

Consider this question from 1996:

Integral of Ln x Dr. Math, Can you please tell me what theintegral of the natural log of xis (ln x)?

It isn’t immediately obvious that this could benefit from integration by parts, since there is only one “part”; I’ll do this directly in a moment. Doctor Sebastien took a different way, which made it more obvious to use parts:

Here's the question: Integral (ln x) dx Let'ssubstituteln x by y: x = e^y dx/dy = e^y So Integral (ln x) dx = Integral (ln x) dx/dy dy = Integral (y e^y) dy

A more traditional way to do this substitution would be to replace \(x\) with \(e^y\), and \(dx\) with \(e^ydy\): $$\int\ln(x)dx=\int\ln(e^y)(e^ydy)=\int ye^ydy$$

So this substitution changed an integral of a single function into a product.

Usingintegration by parts, Integral (y e^y) dy = uv - Integral (v du/dy) dy Let u = y. du/dy = 1 Integral dv = Integral (e^y) dy v = e^y

How did he decide whether to take \(y\) or \(e^y\) as \(u\) in the formula? The exponential function can be either differentiated or integrated without even changing; differentiating \(y\) makes it simpler (reducing the degree), while integrating it *increases* the degree, making it harder. So we take the latter as \(u\), so the new integral will be simpler:

Therefore, Integral (y e^y) dy = y e^y - Integral (e^y * 1) dy = y e^y - (e^y) + c, where c is a constant. Therefore, Integral (ln x) dx = y e^y - (e^y) + c = (ln x)e^(ln x) - e^(ln x) + c = x(ln x) - x + c

Restating this for clarity, $$\int ye^ydy=\int \underset{u}{\underbrace{y}}\cdot\underset{dv}{\underbrace{e^ydy}}=\underset{u}{\underbrace{y}}\cdot\underset{v}{\underbrace{e^y\strut}}-\int\underset{v}{\underbrace{e^y\strut}}\underset{du}{\underbrace{dy}}=ye^y-e^y$$

And back-substituting \(y=\ln(x)\), he got $$\int\ln(x)dx=ye^y-e^y=\ln(x)e^{\ln(x)}-e^{\ln(x)}=x\ln(x)-x+C$$

What he didn’t notice is that **we can integrate directly by parts**, taking \(u=\ln(x)\) and \(dv=dx\). At first, this looks silly, but it allows us to differentiate the log, which we know how to do, rather than integrate it, which we don’t (until we’ve solved this problem!):

$$\int \ln(x)dx=\int \underset{u}{\underbrace{\ln(x)}}\cdot\underset{dv}{\underbrace{dx\strut}}=\underset{u}{\underbrace{\ln(x)}}\cdot\underset{v}{\underbrace{x\strut}}-\int\underset{v}{\underbrace{x\strut}}\underset{du}{\underbrace{\frac{1}{x}dx}}\\=x\ln(x)-\int dx=x\ln(x)-x+C$$

Comparing the two methods, we see that they are really doing the same thing.

### Choosing *u* and *dv*

Note that a key to the work in each case is the fact that a **logarithm** can be differentiated easily, but not integrated (the latter, indeed being this problem!), and differentiating a **power** helps more than integrating it, and that an **exponential** function is happy no matter what we do to it. So we preferred to put \(\ln(x)\) in *u* over anything else, and we preferred to put *x* in *u* rather than the exponential.

A mnemonic I have seen in at least one textbook is LIATE (or, sometimes, ILATE or LIPET):

- Logarithm
- Inverse trigonometric function
- Algebraic function (polynomial, power, root)
- Trigonometric function
- Exponential function

This is the order in which you might consider functions to play the role of *u*; they are listed in order of the value or ease of differentiation as opposed to integrating. (If there’s a log, definitely take it as *u*; only use an exponential if nothing else works!)

I prefer just to think about what I can differentiate, and what I can integrate; LIATE isn’t a rigid rule, and doesn’t cover everything that can happen, so I wouldn’t want to be dependent on it.

## Sometimes there’s a harder choice

Next, take a more complicated question, from 2003:

Choosing Factors When Integrating by Parts I use integration by parts to find 1 / | (r^3)/[(4+r^2)^(1/2)] dr / 0 What I find most difficult isfinding u, v, du, and dv. I tried separating the integral by makingone simple integralto take the anti-derivative of and then using thedifficult integralto do integration by parts. I just don't know how to start it.

This is a definite integral; we’ll be focusing on the indefinite integral in the answer; at the end of the work I’ll bring the limits of integration back in. (This is how I often prefer to handle definite integrals anyway.) So our problem for now is $$\int\frac{r^3}{\sqrt{4+r^2}}dr$$

Consuelo describes, a little awkwardly, the right basic approach: Looking for a part to call *dv* that can be easily integrated to get *v*, and letting the rest be *u*. But it can be harder than it sounds.

Doctor Fenton answered:

Hi Consuelo, Thanks for writing to Dr. Math. I like to write the integration by parts formula in the form / / | u v' dx = uv - | u' v dx , / / because it arises from the Product Rule for derivatives: [u v]' = u' v + u v' . The idea is to look at the integrand as a product of two functions, andone of them must be an exact derivative(or maybe a constant times an exact derivative). The trick is to choose the factors correctly.

This version replaces \(dv\), as it is often written, with \(v’dx\), to keep the focus on the fact that *u* and *v* are both functions of *x*; use whichever makes more sense to you.

### Choosing the parts

The first requirement will be that you can find an antiderivative of \(v’\) reasonably easily; another will be that the result is nicer than what you started with:

Formally, it looks as if you are "moving" the derivative from one factor to the other. This will help onlyif the new integrand is simplerin some sense than the original. In your example, the integrand is (r^3)/[(4+r^2)^(1/2)] The square root is a unit which you can't break up, so the only question is how to distribute the powers of r. Essentially, the only choices are to take the factors to be one of the following: r^3 and (4+r^2)^(-1/2) r^2 and r*(4+r^2)^(-1/2) r and r^2*(4+r^2)^(-1/2) Of course, we also have tochoose one to be u(the factor to be differentiated) andone to be v'(the factor to be integrated).

We don’t want to differentiate the more complicated part (on the right):

You can differentiate (4+r^2)^(-1/2) but if you do, you will obtain a factor of (4+r^2)^(-3/2) plus an additional power of r from applying the Chain Rule. You would also have to integrate r^3, which would produce r^4, so the integrand in the new integral after using this approach would be a constant times r^5*(4+r^2)^(-3/2) Thatlooks worse than the original integral: it has more powers of r, and a larger power of (4+r^2) in the denominator.

Sometimes what looks bad at first turns out to be the best choice, so you have to go with it; but this approach is at least worth setting aside for now!

On the other hand, integrating such a complicated piece seems scary … unless we can arrange things just right:

This observation strongly suggests that you want tointegrate(4+r^2)^(-1/2). However, if you try to use the substitution u = 4+r^2 then du = 2rdr, so you need a power of r to integrate this term. That means that you should write the original integrand as the product of r^2 and r*(4+r^2)^(-1/2) takingu = r^2andv' = r*(4+r^2)^(-1/2).

So we have chosen a pair \(u\) and \(v’\) such that differentiating \(u\) decreases the degree, and integrating \(v’\) is at least possible.

After integrating, you will have an integrand which is a constant times r*(4+r^2)^(1/2) and that can be evaluated with another integration by substitution. If you have any questions or need more help, please write back and show me what you have been able to do, and I will try to offer further suggestions.

### Doing the work

Let’s carry this out:

First, making the substitution \(t=4+r^2,dt=2rdr\), we find$$v=\int (4+r^2)^{-1/2}rdr=\int t^{-1/2}\frac{1}{2}dt=t^{1/2}=(4+r^2)^{1/2}$$ so that

$$\int\frac{r^3}{\sqrt{4+r^2}}dr=\int \underset{u}{\underbrace{r^2\strut}}\cdot\underset{dv}{\underbrace{r(4+r^2)^{-1/2}dr}}\\=\underset{u}{\underbrace{r^2\strut}}\cdot\underset{v}{\underbrace{(4+r^2)^{1/2}}}-\int\underset{v}{\underbrace{(4+r^2)^{1/2}}}\underset{du}{\underbrace{2rdr\strut}}\\=r^2(4+r^2)^{1/2}-2\int r(4+r^2)^{1/2}dr$$

(Note that in my substitution I used *t*, not the usual *u*, as the variable, to avoid confusion with *u* in the parts. This is a reason I am troubled when students are taught to call the method “*u*-substitution”, as if the name mattered.)

As Doctor Fenton said, the remaining integral is much like what we solved to find *v*, and can be solved by again letting \(t=4+r^2,dt=2rdr\): $$\int(4+r^2)^{1/2}rdr=\int t^{1/2}\cdot\frac{1}{2}dt=\frac{1}{2}\cdot\frac{2}{3}t^{3/2}=\frac{1}{3}(4+r^2)^{3/2}$$

Therefore, the entire integral is $$\int\frac{r^3}{\sqrt{4+r^2}}dr=r^2(4+r^2)^{1/2}-\frac{2}{3}(4+r^2)^{3/2}+C$$

This can be simplified a little, to $$(4+r^2)^{1/2}\left(r^2-\frac{2}{3}(4+r^2)\right)\\

=\frac{1}{3}(4+r^2)^{1/2}\left(3r^2-2(4+r^2)\right)\\

=\frac{1}{3}(4+r^2)^{1/2}\left(r^2-8\right)+C$$

Finally, we can find the definite integral: $$\int_0^1\frac{r^3}{\sqrt{4+r^2}}dr=\left[\frac{1}{3}\sqrt{4+r^2}\left(r^2-8\right)\right]_0^1\\=\left[\frac{1}{3}\sqrt{5}\left(-7)\right)\right]-\left[\frac{1}{3}\sqrt{4}\left(-8\right)\right]\\=-\frac{7}{3}\sqrt{5}+\frac{16}{3}$$

## Sometimes it isn’t so easy to find “v”

Another challenge comes from 1999:

Integration Can you help me withINTEGRAL x tan^2 x dx? I think you have to use some kind of substitution or maybe trigonometry identities Thank you.

Seeing a product of two different kinds of functions, integration by parts seems likely; but what are the parts? We can guess that \(x\) is easier to differentiate (and LIATE suggests that that’s more worth doing than the tangent); but then we’ll have to integrate \(\tan^2(x)\) …

Doctor Luis answered:

The first thing that comes to mind isintegration by parts. My primary motivation for this method is the factor of x that appears on the integrand, because I know that differentiating that factor will give me a constant. Quick review: integration by parts is essentially based on the following formula / / | | | u dv = u*v - | v du | | / / In this case the substitutions should beu = x----->du = dxdv = tan^2(x) dx-----> v = ?

Often the antiderivative of \(dv\) is obvious, but not here. We have to go off to the side and work out \(\int\tan^2(x)dx\), which requires a trig identity:

Note that there is a small problem here. We need to integrate the function tan^2(x) in order to obtain v from dv. But this does not really present that much of a problem, if you remember that tan(x) = sin(x)/cos(x) and that cos^2(x)+sin^2(x) = 1. / / | sin^2(x) | 1 - cos^2(x) v = | --------- dx = | ------------- dx | cos^2(x) | cos^2(x) / / / | = | (sec^2(x) - 1)dx = tan(x) - x | / Therefore,v = tan(x) - x.

By the way, it’s worth noting that *v* can be *any* antiderivative of \(\tan^2(x)\), so we don’t need “+ C” here.

Now we can come back to the integration by parts and continue:

Now, substituting into our "integration by parts formula," you get / / | | | (x)*(tan^2(x)dx) = (x)*(tan(x)-x) - | (tan(x)-x)*(dx) | | / / where I have enclosed the substitutions we made in parentheses.

The hope in integration by parts is that the new integral will be easier; and it is, when you take time. Doctor Luis does it a different way than I would:

Now, the second term on the integral on the righthand side of the equation presents no problem. It's just (1/2)x^2, but the first term seems a bit more difficult. However, if yourewrite tan(x) as sin(x)cos(x)/cos^2(x), you can see that we almost have a complete differential; the derivative of cos^2(x) is 2*cos(x)*(-sin(x)). So, concentrating on the integral of tan(x), we have: / / | | sin(x)cos(x) | tan(x)dx = | ------------ dx | | cos^2(x) / / If you make thesubstitution u = cos^2(x), which implies that du = 2cos(x)*(-sin(x))dx or cos(x)sin(x)dx = -du/2), then this last integral becomes / / | sin(x)cos(x) 1 | du | ------------ = - --- | -- = -(1/2)ln(u) = -(1/2)ln(cos^2(x)) | cos^2(x) 2 | u / /

I would have made the substitution \(t=\cos(x),dt=-\sin(x)dx\): $$\int\tan(x)dx=\int\frac{\sin(x)}{\cos(x)}dx=\int\frac{-dt}{t}=-\ln|t|=-\ln|\cos(x)|$$ This is equivalent. (Do you see why?)

Therefore the integral of tan(x) is just -(1/2)ln(cos^2(x)) and so our original integral becomes: / / | | | (x)*(tan^2(x)dx) = (x)*(tan(x)-x) - | (tan(x)-x)*(dx) | | / / = x*tan(x)-x^2 - (-(1/2)ln(cos^2(x))-(1/2)x^2) = x*tan(x) - (1/2)x^2 + (1/2)ln(cos^2(x)) I hope this explanation helps, although it would have been better if you had included an explanation of how you attempted this problem and where you got stuck. (I did not know how or why you got stuck, so I tried to explain everything.) Feel free to reply if you have any questions about this answer.

## Sometimes you have to do it again … and again!

Stepping up the difficulty, consider this from 1995:

Integration by Parts Since most people did calculus in high school, I assume this question you folks will be able to answer. I've been working all day on it, and no luck. I need theintegral from 0 to 1 of x^4 * exp(-x/2). Can you help? Stuck in Seattle

This was very early in the history of *Ask Dr. Math*, when it was assumed we were entirely for pre-college math. Again, the question is about a definite integral; this time we’ll be working that way from the start, finding $$\int_0^1x^4e^{-x/2}dx$$

Doctor Ken answered, starting with a substitution, which is not necessary, but helpful:

Hello there! This is a classic example of a problem that can be solved by using the technique ofIntegration by Parts. But first, let's make the problem a little bit nicer by getting rid of the -x/2. Let's lety = -x/2(i.e. x = -2y), and then we have dx = -2dy. So we have theintegral from 0 to -1/2 of 16y^4 * e^y (-2)dy. We can pull the -32 outside of the integral. So now we've got -32 times the integral from 0 to -1/2 of y^4 * e^y dy.

So far we have $$\int_0^1x^4e^{-x/2}dx=\int_0^{-1/2}\left(-2y\right)^4e^{y}(-2)dy=-32\int_0^{-1/2}y^4e^ydy$$ (I’ve corrected a numerical error in the original, which wasn’t noticed because the problem wasn’t finished.)

We’ll let *u* be the algebraic part (so that differentiating it reduces the degree), and let *dv* be the exponential part (which is essentially unchanged by integrating):

Using Integration by Parts, letu = y^4and letdv = e^y dy. So thendu = 4y^3 dy, andv = e^y. Remember the formula for integration by parts? It's Integral(u dv) = uv - Integral(v du). So we get -32 Integral(y^4 e^y dy) = -32*y^4 e^y + 32*Integral(4y^3 e^y dy) = -32/(16Sqrt{e}) + 128*Integral(y^3 e^y dy)) = -2/Sqrt{e} + 128*Integral(y^3 e^y dy). ***note: all integrals are between 0 and -1/2*** Notice that we've knocked the power down on the y^4 so that it became y^3. You canapply this method againand knock the power down another notch,and another, until you get the integral of e^y. Which you can do, because it's e^y. I hope this makes sense to you.

Writing it as an indefinite integral, the entire process looks like this:

$$-32\int (y^4)(e^ydy)=-32(y^4)(e^y)+32\int(e^y)(4y^3dy)\\

=-32y^4e^y+128\int(y^3)(e^ydy)\\

=-32y^4e^y+128\left((y^3)(e^y)-\int(e^y)(3y^2dy)\right)\\

=-32y^4e^y+128y^3e^y-384\int(y^2)(e^ydy)\\

=-32y^4e^y+128y^3e^y-384\left((y^2)(e^y)-\int(e^y)(2ydy)\right)\\

=-32y^4e^y+128y^3e^y-384y^2e^y+768\int(y)(e^ydy)\\

=-32y^4e^y+128y^3e^y-384y^2e^y+768\left((y)(e^y)-\int e^ydy)\right)\\

=-32y^4e^y+128y^3e^y-384y^2e^y+768ye^y-768e^y\\

=(-32y^4+128y^3-384y^2+768y-768)e^y$$

and substituting for *y*, $$=\left(-32\left(-\frac{x}{2}\right)^4+128\left(-\frac{x}{2}\right)^3-384\left(-\frac{x}{2}\right)^2+768\left(-\frac{x}{2}\right)-768\right)e^{-x/2}\\

=\left(-2x^4-16x^3-96x^2-384x-768\right)e^{-x/2}\\

=-2\left(x^4+8x^3+48x^2+192x+384\right)e^{-x/2}$$

Evaluating this from 0 to 1, we have $$\left[-2\left(x^4+8x^3+48x^2+192x+384\right)e^{-x/2}\right]_0^1\\

=\left[-2\left(1+8+48+192+384\right)e^{-1/2}\right]-\left[-2\left(384\right)e^{0}\right]\\

=768-1266e^{-1/2}$$

If, instead, we do all the work as a definite integral, continuing Doctor Ken’s work, we get the same result:

$$-32\int_0^{-1/2}y^4e^ydy\\

=-32y^4e^y|_0^{-1/2}+128\int_0^{-1/2}y^3e^ydy\\

=-2e^{-1/2}+128\int_0^{-1/2}y^3e^ydy\\

=-2e^{-1/2}+128\left(y^3e^y|_0^{-1/2}-\int_0^{-1/2}3y^2e^ydy\right)\\

=-2e^{-1/2}-16e^{-1/2}-384\int_0^{-1/2}y^2e^ydy\\

=-18e^{-1/2}-384\left(y^2e^y|_0^{-1/2}-\int_0^{-1/2}2ye^ydy\right)\\

=-18e^{-1/2}-96e^{-1/2}+768\int_0^{-1/2}ye^ydy\\

=-114e^{-1/2}+768\left(ye^y|_0^{-1/2}-\int_0^{-1/2}e^ydy\right)\\

=-114e^{-1/2}-384e^{-1/2}-768e^y|_0^{-1/2}\\

=-498e^{-1/2}-768e^{-1/2}+768\\

=768-1266e^{-1/2}$$

## Sometimes you get back where you started

We’ll close with this from 2001:

Integral of e^xsinx I have tried to integrate e^x sinx by parts, but I always get e^x sinx or e^x cosx to integrate, andit just keeps going. Could you show me the steps to this indefinite integral?

We did this same integral in Two Integration Puzzlers.

Doctor Rob answered:

Thanks for writing to Ask Dr. Math, George. There is a pretty clever trick to this one. Integrate by parts twice as follows: INTEGRAL u dv = u*v - INTEGRAL v du, u = sin(x), dv = e^x dx, du = cos(x) dx, v = e^x: INTEGRAL e^x*sin(x) dx = e^x*sin(x) - INTEGRAL e^x*cos(x) dx. INTEGRAL u dv = u*v - INTEGRAL v du, u = cos(x), dv = e^x dx, du = -sin(x) dx, v = e^x: INTEGRAL e^x*sin(x) dx = e^x*sin(x) - [e^x*cos(x) - INTEGRAL -e^x*sin(x) dx], = e^x*[sin(x)-cos(x)] - INTEGRAL e^x*sin(x) dx.

That is, $$\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\left(\sin(x)-\cos(x)\right)-\int e^x\sin(x)dx.$$

Now it may seem that you didn't get anywhere by doing this, but notice that the integral on the left and the one on the right are the same. Now just combine like terms by adding that term to both sides, and finallysolve for that integralto get your answer. You can easily verify the answer by differentiation.

If we define \(I=\int e^x\sin(x)dx\), then we have $$I=e^x\left(\sin(x)-\cos(x)\right)-I$$

so that $$2I=e^x\left(\sin(x)-\cos(x)\right)$$

$$I=\frac{1}{2}e^x\left(\sin(x)-\cos(x)\right)+C$$

If we differentiate this as a check, we get $$\frac{dI}{dx}=\frac{1}{2}e^x\left(\sin(x)-\cos(x)\right)+\frac{1}{2}e^x\left(\cos(x)+\sin(x)\right)=e^x\sin(x)$$