Integration by Parts (and Linear Motion)

Calculus 2, Lectures 3B through 4 (Videotaped Fall 2016)

Integration by parts is needed to compute the definite integral to find the area under this curve representing the speed of a linear motion.
Integration by parts is needed to compute the definite integral to find the area under this curve representing the speed of a linear motion.

You might say that integration by parts is an “unexpected” or “surprising” method of integration.

While the other main method, integration by substitution, can be thought of as “educated guessing” for simple examples, it is more difficult to think of integration by parts in the same way.

Consider the indefinite integral (“most general” antiderivative) \displaystyle\int x\cos(x)\, dx. Since \displaystyle\int\cos(x)\, dx=\sin(x)+C, our answer should probably involve the sine function. But should it also involve an antiderivative of x? Namely, should it involve \frac{1}{2}x^{2}? And if so, how?

Evidently, adding these functions does no good because \frac{d}{dx}\left(\frac{1}{2}x^{2}+\sin(x)\right)=x+\cos(x).

Does multiplication work? Try it. Don’t forget to use the Product Rule:

\frac{d}{dx}\left(\frac{1}{2}x^{2}\sin(x)\right)=x\sin(x)+\frac{1}{2}x^{2}\cos(x).

No dice.

In fact, it seems like we are getting further from the correct answer.

What if we try a product that is a little simpler? Would it work out? Let’s try x\sin(x). Differentiating with the Product Rule gives

\frac{d}{dx}(x\sin(x))=\sin(x)+x\cos(x).

This looks more promising to compute the integral \displaystyle\int x\cos(x)\, dx! We see that the integrand function x\cos(x) is part of the derivative above.

If only we could get rid of that pesky sine function….

A bit of experimentation, keeping in mind our desire to cancel the sine function, leads to the following guess:

\frac{d}{dx}(x\sin(x)+\cos(x))=(\sin(x)+x\cos(x))-\sin(x)=x\cos(x).

Therefore, \displaystyle\int x\cos(x)\, dx=x\sin(x)+\cos(x)+C is the answer! Don’t forget the +C!

But we are left with questions: Is it possible to avoid all this guesswork? In particular, can we approach such a problem in a systematic way?

The answer to these questions is most definitely “yes”!

We will explore the reasons for this answer in the sections below. One big hint about what we will see is that the method is related to the Product Rule, since we had to use that rule to check our answer above.

Lecture 3B: Height from Velocity, Substitution and the FTC, Intro to Integration by Parts

This is my third blog post in a series here at Infinity is Really Big on my Calculus 2 Lectures at Bethel University from the Fall of 2016. The first blog post is titled “Applied vs Pure Mathematics” and it covers Lecture 1. The second post is titled “Integration by Substitution (Method of Integration)” and it covers Lecture 2A, Lecture 2B, and Lecture 3A.

I begin Lecture 3B of Calculus 2 by talking about about applications of integrals.

Calculus 2, Lecture 3B: Height from Velocity, Substitution and the FTC, Introduction to Integration by Parts

One of these applications is about the relationship between the height and velocity of an object moving vertically under the influence of gravity. This is an example of linear motion (also known as rectilinear motion), which is motion along a straight line. I will discuss this topic in more depth further below in this blog post.

I also discuss how to prove that the substitution u=g(x) transforms the definite integral \displaystyle\int_{a}^{b}f(g(x))g'(x)\, dx into the definite integral \displaystyle\int_{g(a)}^{g(b)}f(u)\, du.

These integrals turn out to equal each other, and the Fundamental Theorem of Calculus along with the Chain Rule are needed to prove this fact. This is also a subject I go into detail on in the last blog post, “Integration by Substitution (Method of Integration)”.

Integration By Parts Examples

Finally, I end the class by doing a couple integration by parts examples. The first of these examples is the one from above, \displaystyle\int x\cos(x)\, dx. The other example, \displaystyle\int x\arctan(x)\, dx, is one that I only have time to start in Lecture 3B. I then finish it in Lecture 4.

Let’s analyze the first example again a bit more carefully to see if we can discover a general approach. Later on we’ll look at the second example.

Deriving and Using the Integration by Parts Formula

Start by recalling our answer from above: \displaystyle\int x\cos(x)\, dx=x\sin(x)+\cos(x)+C, since \frac{d}{dx}\left(x\sin(x)+\cos(x)\right)=\sin(x)+x\cos(x)-\sin(x)=x\cos(x).

Now we do a clever little trick. Since \displaystyle\int (-\sin(x))\, dx=\cos(x)+C, we can rewrite the equation \displaystyle\int x\cos(x)\, dx=x\sin(x)+\cos(x)+C as \displaystyle\int x\cos(x)\, dx=x\sin(x)-\displaystyle\int \sin(x)\, dx.

Next, add the integral on the right to both sides and use the linearity of the integral operator to write \displaystyle\int\left(x\cos(x)+\sin(x)\right)\, dx=x\sin(x) (don’t worry that there’s no +C on the right side here — we will allow ourselves to be a bit “sloppy” in derivations sometimes).

If we differentiate both sides of this last equation, we see that it is indeed equivalent to an equation whose truth follows from the Product Rule: \frac{d}{dx}(x\sin(x))=x\cos(x)+\sin(x).

All this can be made systematic by reversing the process in a general setting.

Start with an arbitrary product of differentiable functions u(x)v(x). Differentiate it with the Product Rule to get \frac{d}{dx}(u(x)v(x))=u(x)v'(x)+u'(x)v(x).

Next, integrate both sides and use linearity to write

u(x)v(x)=\displaystyle\int \frac{d}{dx}(u(x)v(x))\, dx=\displaystyle\int u(x)v'(x)\, dx+\displaystyle\int u'(x)v(x)\, dx.

The Integration by Parts Formula

If we subtract the integral \displaystyle\int u'(x)v(x)\, dx from both sides of the last equation and rearrange, we get the formula for the method of integration by parts:

\displaystyle\int u(x)v'(x)\, dx=u(x)v(x)-\displaystyle\int u'(x)v(x)\, dx.

When using this formula, the hope is that we can relate the integral \displaystyle\int u(x)v'(x)\, dx that we want to compute to another integral \displaystyle\int u'(x)v(x)\, dx that we hope is easier to compute.

When we attempt to realize this hope for a particular example, we need to identify our integrand as the product of two functions u(x)v'(x)=v'(x)u(x). We then need to identify which function in that product should play the role of u(x) and which should play the role of v'(x).

Unfortunately, if we make a bad choice in this step, we might make the problem even more difficult than it was to begin with.

Applying the Integration by Parts Formula

So, once again, consider the integral \displaystyle\int x\cos(x)\, dx. If, for example, we let u(x)=\cos(x) and v'(x)=x, then u'(x)=-\sin(x) and v(x)=\frac{1}{2}x^{2} (there’s no need for a +C in the formula for v(x)).

The integration by parts formula would then imply that

\displaystyle\int x\cos(x)\, dx=u(x)v(x)-\displaystyle\int u'(x)v(x)\, dx=\frac{1}{2}x^{2}\cos(x)+\frac{1}{2}\displaystyle\int x^{2}\sin(x)\, dx.

The new integral on the right side is more complicated than the original integral was! We made a bad choice for the pair of functions u(x) and v'(x)!

A Better Choice

So, let’s try the other choice. Let u(x)=x and v'(x)=\cos(x) so that u'(x)=1 and v(x)=\sin(x). Then

\displaystyle\int x\cos(x)\, dx=u(x)v(x)-\displaystyle\int u'(x)v(x)\, dx=x\sin(x)-\displaystyle\int \sin(x)\, dx.

That is a good choice! We can finish the problem easily now:

\displaystyle\int x\cos(x)\, dx=x\sin(x)-\displaystyle\int\sin(x)\, dx=x\sin(x)+\cos(x)+C.

This matches our previous answer and can also be checked by differentiation.

The Key Property That Makes This Work

The key property that makes this second attempt work is that \displaystyle\int u'(x)v(x)\, dx is easy to integrate. Evidently, this is because u'(x) is “simpler” than u(x), while v(x) is “similar” to v'(x), making the product u'(x)v(x) “simpler” than the product u(x)v'(x). In particular, u'(x) is a constant polynomial (of degree zero) while u(x) is a linear polynomial (of degree one).

We might wonder: if the product u(x)v'(x) includes a polynomial factor, should we always let the polynomial factor be u(x)?

The answer, most definitely, is “no”. The next couple examples illustrate this.

Integral of the Arctangent Function (Inverse Tangent Function)

The integral \displaystyle\int \arctan(x)\, dx=\displaystyle\int \tan^{-1}(x)\, dx is rather “innocent-looking”. But, if you try guessing the answer, you will quickly see that it is not as easy as it looks.

Wait a minute though! How is the integrand function even in the form u(x)v'(x)? It is a single function — it’s not the product of two functions — is it?

Well, remember, mathematicians often use “tricks” that might seem insignificant but are actually keys to solving many problems. In this case, the trick is to write \arctan(x)=1\cdot \arctan(x). Now we can say that the integrand is the product of two functions! Right?!?

Yes, we can!

Should we let u(x)=1 and v'(x)=\arctan(x)?

A little bit of thought reveals this is not helpful. In order to find v(x), we would have to integrate \arctan(x). But this is what we are trying to do in the original problem!

An Approach that Works

Don’t panic! Try it the other way around! Let u(x)=\arctan(x) and v'(x)=1. Then u'(x)=\frac{1}{1+x^{2}} and v(x)=x.

There’s still a question of whether this is helpful or not. We have to just try it and see what happens. Recall that the general formula is \displaystyle\int u(x)v'(x)\, dx=u(x)v(x)-\displaystyle\int u'(x)v(x)\, dx. Hence,

\displaystyle\int \arctan(x)\, dx=x\arctan(x)-\displaystyle\int \frac{x}{1+x^{2}}\, dx.

Is this better? Yes! We can do the integral \displaystyle\int \frac{x}{1+x^{2}}\, dx with a substitution! Let w=1+x^{2} so that dw=2xdx and xdx=\frac{1}{2}dw.

Then,

\displaystyle\int \frac{x}{1+x^{2}}\, dx=\frac{1}{2}\displaystyle\int \frac{1}{w}dw=\frac{1}{2}\ln|w|+C=\frac{1}{2}\ln(1+x^{2})+C.

(Note that we can get rid of the absolute value signs at the end since 1+x^{2}>0 for all real numbers x.)

Therefore,

\displaystyle\int \arctan(x)\, dx=x\arctan(x)-\frac{1}{2}\ln(1+x^{2})+C.

Of course, we should check this by differentiation. Once again, we need the Product Rule.

\frac{d}{dx}\left(x\arctan(x)-\frac{1}{2}\ln(1+x^{2})\right)=\arctan(x)+\frac{x}{1+x^{2}}-\frac{1}{2(1+x^{2})}\cdot 2x.

And this simplifies to \frac{d}{dx}\left(x\arctan(x)-\frac{1}{2}\ln(1+x^{2})\right)=\arctan(x).

Another Arctangent Problem

Consider a more complicated example: Find \displaystyle\int x\arctan(x)\, dx.

Consistent with what worked previously, let u(x)=\arctan(x) and v'(x)=x. Then u'(x)=\frac{1}{1+x^{2}} and v(x)=\frac{1}{2}x^{2}. We can therefore write

\displaystyle\int x\arctan(x)\, dx=\frac{1}{2}x^{2}\arctan(x)-\frac{1}{2}\displaystyle\int \frac{x^{2}}{1+x^{2}}\, dx.

This looks better than before, though at the same time, the integral \displaystyle\int \frac{x^{2}}{1+x^{2}}\, dx is one we have not encountered before.

Before integrating this, it is best to rewrite \frac{x^{2}}{1+x^{2}} using polynomial long division. Doing so gives a quotient of q(x)=1 and a remainder of r(x)=-1. This implies that \frac{x^{2}}{1+x^{2}}=q(x)+\frac{r(x)}{1+x^{2}}=1-\frac{1}{1+x^{2}}. This is now easy to integrate.

Hence,

\displaystyle\int x\arctan(x)\, dx=\frac{1}{2}x^{2}\arctan(x)-\frac{1}{2}\displaystyle\int \frac{x^{2}}{1+x^{2}}\, dx

=\frac{1}{2}x^{2}\arctan(x)-\frac{1}{2}x+\frac{1}{2}\arctan(x)+C

Both of the last two examples illustrate the following heuristic: when using integration by parts, the most important thing is that v'(x) is chosen in such a way that v(x) is relatively easy to find.

Lecture 4: Integration by Parts Examples, Speed and Distance Traveled Examples

The last example is actually the second example that I do about 13 minutes into Lecture 4.

Calculus 2, Lecture 4: Integration-by-Parts Examples, Speed and Distance Traveled Examples

The first example I do in Lecture 4 involves using integration by parts more than once. Unfortunately, this is sometimes necessary.

An Example when Integration by Parts Must Be Used Twice

The first example I do in Lecture 4 is to find \displaystyle\int x^{2}e^{5x}\, dx.

If u(x)=x^{2} and v'(x)=e^{5x}, then u'(x)=2x and v(x)=\frac{1}{5}e^{5x}. Therefore,

\displaystyle\int x^{2}e^{5x}\, dx=\frac{1}{5}x^{2}e^{5x}-\frac{2}{5}\displaystyle\int xe^{5x}\, dx

Now use integration by parts again with the new integral on the right. For this integral, let u(x)=x and v'(x)=e^{5x} so that u'(x)=1 and v(x)=\frac{1}{5}e^{5x}. Then

\displaystyle\int x^{2}e^{5x}\, dx=\frac{1}{5}x^{2}e^{5x}-\frac{2}{5}\left(\frac{1}{5}xe^{5x}-\frac{1}{5}\displaystyle\int e^{5x}\, dx\right)

It follows that:

\displaystyle\int x^{2}e^{5x}\, dx=\frac{1}{5}x^{2}e^{5x}-\frac{2}{25}xe^{5x}+\frac{2}{125}e^{5x}+C

Check It With the Product Rule

We should check this. We need the Product Rule in two spots. Here goes:

\frac{d}{dx}\left(\frac{1}{5}x^{2}e^{5x}-\frac{2}{25}xe^{5x}+\frac{2}{125}e^{5x}\right)=\frac{2}{5}xe^{5x}+x^{2}e^{5x}-\frac{2}{25}e^{5x}-\frac{2}{5}xe^{5x}+\frac{2}{25}e^{5x}=x^{2}e^{5x}

It worked! Yay!

Reduction Formulae

Sometimes the process of using integration by parts multiple times can be “automated” with a so-called “reduction formula”. For example, consider the general integral \displaystyle\int x^{n}e^{kx}\ dx for constants n and k\not=0.

Let u(x)=x^{n} and v'(x)=e^{kx} so that u'(x)=nx^{n-1} and v(x)=\frac{1}{k}e^{kx}. Then

\displaystyle\int x^{n}e^{kx}\ dx=\frac{1}{k}x^{n}e^{kx}-\frac{n}{k}\displaystyle\int x^{n-1}e^{kx}\, dx

The purpose of this formula is that we can use it over and over again without having to think about the integration by parts formula. For example, if n=3 and k=2, then

\displaystyle\int x^{3}e^{2x}\, dx=\frac{1}{2}x^{3}e^{2x}-\frac{3}{2}\displaystyle\int x^{2}e^{2x}=\frac{1}{2}x^{3}e^{2x}-\frac{3}{2}\left(\frac{1}{2}x^{2}e^{2x}-\frac{2}{2}\displaystyle\int xe^{2x}\, dx\right)

=\frac{1}{2}x^{3}e^{2x}-\frac{3}{4}x^{2}e^{2x}+\frac{3}{2}\left(\frac{1}{2}xe^{2x}-\frac{1}{2}\displaystyle\int e^{2x}\, dx \right)

This leads to

\displaystyle\int x^{3}e^{2x}\, dx=\frac{1}{2}x^{3}e^{2x}-\frac{3}{4}x^{2}e^{2x}+\frac{3}{4}xe^{2x}-\frac{3}{8}e^{2x}+C

You should definitely take the time to check this!

Sometimes We Are Pleasantly Surprised

The third example I do in Lecture 4 is \displaystyle\int x^{5}\ln(x)\, dx. This looks like a problem where we might need to use integration by parts more than once — perhaps even five times! Yikes!

However, we are in for a pleasant surprise. If u(x)=\ln(x) and v'(x)=x^{5}, then u'(x)=\frac{1}{x} and v(x)=\frac{1}{6}x^{6}. Therefore,

\displaystyle\int x^{5}\ln(x)\, dx=\frac{1}{6}x^{6}\ln(x)-\frac{1}{6}\displaystyle\int x^{5}\, dx=\frac{1}{6}x^{6}\ln(x)-\frac{1}{36}x^{6}+C

We are done! Check that this is correct!

Sometimes Nothing Works

Unfortunately, integration by parts is not an all-powerful method. There are some integrals of products that are just too hard to do by elementary means. For example, consider \displaystyle\int \ln(x)\arctan(x)\, dx.

If we try u(x)=\ln(x) and v'(x)=\arctan(x), then, by our work farther above, u'(x)=\frac{1}{x} and v(x)=x\arctan(x)-\frac{1}{2}\ln(1+x^{2}). This implies that

\displaystyle\int \ln(x)\arctan(x)\, dx=\ln(x)\left(x\arctan(x)-\frac{1}{2}\ln(1+x^{2})\right)-\displaystyle\int \left(\arctan(x)-\frac{1}{2x}\ln(1+x^{2})\right)\, dx

While this is indeed a true fact, it is certainly not very helpful.

How about if we try u(x)=\arctan(x) and v'(x)=\ln(x)? Then u'(x)=\frac{1}{1+x^{2}} and v(x)=x\ln(x)-x. Hence,

\displaystyle\int \ln(x)\arctan(x)\, dx=\arctan(x)(x\ln(x)-x)-\displaystyle\int \frac{x\ln(x)-x}{1+x^{2}}\, dx

Once again, we encounter a true but unhelpful equation.

You should not take our lack of success here as an indication that \displaystyle\int \ln(x)\arctan(x)\, dx does not exist in an abstract (but precise) sense. All it means is that there is probably no simple formula for this family of functions.

Integration by Parts, Definite Integrals, and Linear Motion

The last 28 minutes of Lecture 4 are dedicated to physics examples of linear motion (motion along a straight line). Right before the physics examples, I do a definite integral using integration by parts.

Here are the main principles of linear motion that I emphasize in relation to integrals: 1) the integral of the speed function gives the distance traveled function and 2) the integral of the velocity function gives the displacement (or position) function. We will wait to give reasons for these facts in a later post.

Actually, these principles need to be made a bit more precise.

Consider principle (1). If \mbox{speed}(t) is the speed of motion of an object as a function of time t (i.e., a measure of how fast the motion is), then one of the antiderivatives \displaystyle\int \mbox{speed}(t)\, dt will be the distance traveled function. In particular, if the motion starts at time t=0, then for a variable upper limit of integration t, the definite integral \displaystyle\int_{0}^{t}\mbox{speed}(\tau)\, d\tau will indeed be the distance traveled function \mbox{dist}(t). Note that this implies that \mbox{dist}(0)=0. The object has not moved any distance at the start.

Now consider principle (2). If \mbox{vel}(t) is the velocity of motion of an object as a function of time t (i.e., a measure of how fast the motion is and in what direction), then one of the antiderivatives \displaystyle\int \mbox{vel}(t)\, dt will be the position function. In particular, if initial position is zero at time t=0, then for a variable upper limit of integration t, the definite integral \displaystyle\int_{0}^{t}\mbox{vel}(\tau)\, d\tau will indeed be the position function \mbox{pos}(t). Note that this implies that \mbox{pos}(0)=0. The object has not changed position at the start. The position function is also equivalent to the change in position in this situation (they would be different functions when the initial position is not zero).

An Example Where Integration By Parts is Needed

Let’s consider the simpler situation, where the motion is one direction and we can talk about speed and distance traveled rather than velocity and position. We will consider velocity and position in a future post.

Let \mbox{speed}(t)=te^{-3t} be the instantaneous speed at time t\geq 0, in meters per second, of an object moving along a number line. What is the distance traveled over the interval 0\leq t\leq 2?

The answer, in meters, is the definite integral \mbox{dist}(2)=\displaystyle\int_{0}^{2}\mbox{speed}(t)\, dt=\displaystyle\int_{0}^{2}te^{-3t}\, dt. This integral should be computed using integration by parts. Unlike integration by substitution, we do not need to change the limits of integration while using this technique.

To do the integral, let u(t)=t and v'(t)=e^{-3t} so that u'(t)=1 and v(t)=-\frac{1}{3}e^{-3t}. Then:

\mbox{dist}(2)=-\frac{1}{3}te^{-3t}\biggr\rvert_{0}^{2}+\frac{1}{3}\displaystyle\int_{0}^{2}e^{-3t}\, dt=-\frac{2}{3}e^{-6}-\left(\frac{1}{9}e^{-3t}\biggr\rvert_{0}^{2}\right) =\frac{1}{9}-\frac{2}{3}e^{-6}-\frac{1}{9}e^{-6}=\frac{1}{9}-\frac{7}{9}e^{-6}\approx 0.109\mbox{ meters.}

Geometric Interpretation

Being a definite integral, this is the same as the area under the graph of \mbox{speed}(t)=te^{-3t}>0 for 0\leq t\leq 2. It is illustrated in the graph below. Note that the area of each “box” represents 0.5\times 0.05=0.025 meters.

Integration by parts is needed to compute the area under this curve for a speed function modeling linear motion. This area equals the distance traveled.
Integration by parts is needed to compute the definite integral \displaystyle\int_{0}^{2}te^{-3t}\, dt, which is the area under this curve. This area equals the distance traveled for a linear motion (along a straight line).

Since the speed function increases and then decreases, this represents a motion that speeds up before slowing down.

In Lecture 4, simpler applications to motion are considered as well, where the integrals are not as challenging to compute.

Justifying Integration By Parts for Definite Integrals

The integration by parts formula we just used for the definite integral above takes the form \displaystyle\int_{a}^{b}u(x)v'(x)\, dx=u(x)v(x)\biggr\rvert_{a}^{b}-\displaystyle\int_{a}^{b}u'(x)v(x)\, dx.

This can be justified with the Fundamental Theorem of Calculus (FTC) and, as you would expect, the Product Rule. Note that, for two differentiable functions u(x) and v(x), the Product Rule gives \frac{d}{dx}(u(x)v(x))=u(x)v'(x)+u'(x)v(x).

Therefore, by the FTC,

\displaystyle\int_{a}^{b}(u(x)v'(x)+u'(x)v(x))\, dx=u(b)v(b)-u(a)v(a)=u(x)v(x)\biggr\rvert_{a}^{b}.

Using linearity of the definite integral operator and algebraically rearranging the resulting equation gives the integration by parts formula in the first paragraph of this section.

Alternative Notation for Integration by Parts

We end by mentioning a common “shorthand” notation to memorize the integration by parts formula \displaystyle\int u(x)v'(x)\, dx=u(x)v(x)-\displaystyle\int u'(x)v(x)\, dx.

If we let du=u'(x)dx and dv=v'(x)dx (which is consistent with notation used in the integration by substitution article), then, when we completely suppress the variable x, the preceding formula is written as:

\displaystyle\int udv=uv-\displaystyle\int vdu

The benefit of this formula is that it is easier to remember. You might even say it “rolls off your tongue”.