Skip to main content

Section 3.3 Integration by Parts

Subsection 3.3.1 Definition

In this section, I am going to try to invert the product rule for derivatives to build a new rule for integration. First, recall the product rule, for \(f(x)\) and \(g(x)\) differentiable functions.
\begin{equation*} \frac{d}{dx} f(x) g(x) = \frac{df}{dx} g(x) + f(x) \frac{dg}{dx} \end{equation*}
I’m simply going to integrate both sides of this equation. On the left, the integral of a derivative returns the original function. (I’ll simplify the notation from \(f(x)\) to just \(f\text{;}\) this is a very common notation shift that makes some of these more compicated integration rules a bit more succinct. It’s just up to you to remember that \(f\) and \(g\) are functions.)
\begin{align*} \int \frac{d}{dx} fg dx \amp = \int \frac{df}{dx} g dx + \int f \frac{dg}{dx} dx\\ fg \amp = \int \frac{df}{dx} g dx + \int f \frac{dg}{dx} dx \end{align*}
This is a rule about integrals, but it’s not clear how to use it. I’m going to isolate one of the two integral pieces.
\begin{equation*} \int \frac{df}{dx} g dx = fg - \int f \frac{dg}{dx} dx \end{equation*}
This might be more useful, since it tells me how to transform certain integral. This is useful enough that there is a name for it.

Definition 3.3.1.

Let \(f\) and \(g\) be functions, with \(f\) integrable and \(g\) differentiable. The following equation for the integral of \(\frac{df}{dx} g\) is called integration by parts.
\begin{equation*} \int \frac{df}{dx} g dx = fg - \int f \frac{dg}{dx} dx \end{equation*}
So how do I actually use this? The left side of integration by parts is a product: \(\frac{df}{dx} g\text{.}\) Integration by parts applies to integals of product. However, I have to identify one part of the product as \(g\) and another part as \(\frac{df}{dx}\text{.}\) Then, I need to calculate \(\frac{dg}{dx}\text{,}\) a derivative, and \(f\text{,}\) an antiderivative. If I can do these two things for the choice I made, then I can transfer to the right side of integration by parts. The first part, \(fg\) is just a function, but the second part is a new integral, with integrand \(f \frac{dg}{dx}\text{.}\) Maybe this is an easier integral. Like the substitution rule, integration by parts doesn’t solve the integral by itself; instead, it changes the form of the integral into something which is (hopefully) more approachable.
In applying the substitution rule, I encouraged careful labelling. The same is true here: I recommend labelling the terms and being particularly careful with \(\pm\) signs. In other literature, there are some concise version of integration by parts with slightly different notations (using \(df\) and \(dg\) for the integrals). I’m not going to use that notation, but for reference, here is what the rule looks like.
\begin{equation*} \int g df = fg - \int f dg \end{equation*}
If I have a definite integral, I can still use integration by parts. On the middle term (the term which is not an integral), I have to evalute on the bounds.
\begin{equation*} \int_a^b \frac{df}{dx} g(x) dx = f(x)g(x) \Bigg|_a^b - \int_a^b f(x) \frac{dg}{dx} dx \end{equation*}

Subsection 3.3.2 Examples

Example 3.3.2.

The first step in any integration by parts is chooing which piece is \(f\) and which is \(g\text{.}\) In this integral, one choice makes the following integral easier and one makes it more difficult. The first choice I might make is \(\frac{df}{dx} = x\) and \(g = e^x\text{.}\)
\begin{align*} \int x e^x dx \amp\\ \frac{df}{dx} \amp = x \implies f = \frac{x^2}{2}\\ g \amp = e^x \implies \frac{dg}{dx} = e^x\\ \int x e^x dx \amp = \frac{x^2}{2} e^x - \int \frac{x^2}{2} e^x dx \end{align*}
This gives a new integral which isn’t any easier than the previous. This use of integration by parts hasn’t helped. Instead, I’ll try \(\frac{df}{dx} = e^x\) and \(g = x\text{.}\)
\begin{align*} \int x e^x dx \amp\\ \frac{df}{dx} \amp = e^x \implies f = e^x\\ g \amp = x \implies \frac{dg}{dx} = 1\\ \int x e^x dx \amp = xe^x - \int e^x dx = xe^x - e^x + c = (x-1)e^x + c \end{align*}
This choice worked, and I was able to continue on to the complete solution. As with all integration problems, I can check my answer by differentiation.
\begin{equation*} \frac{d}{dx} (x-1)e^x + c = e^x \frac{d}{dx} (x-1) + (x-1) \frac{d}{dx} e^x = e^x + xe^x - e^x = xe^x \end{equation*}

Example 3.3.3.

For integration by parts, I choose \(g = x\) and \(\frac{df}{dx} = \cos x\text{,}\) since finding the antiderivative of the cosine is easy and the derivate of \(x\) is just a constant. This choice should simplify the integral.
\begin{align*} \int x \cos x dx \amp\\ \frac{df}{dx} \amp = \cos x \implies f = \sin x\\ g \amp = x \implies \frac{dg}{dx} = 1\\ \int x \cos x dx \amp = x \sin x - \int \sin x dx = (x \sin x + \cos x) + c \end{align*}
The choice did indeed simplify the integral, leaving only \(\sin x\) in the integral.

Example 3.3.4.

This example uses integration by parts twice. Pay attention to the \(\pm\) signs. In the first step, I choose \(g = x^2\) and \(\frac{df}{dx} = e^x\text{.}\)
\begin{align*} \int x^2 e^x dx \amp \\ \frac{df}{dx} \amp = e^x \implies f = e^x\\ g \amp = x^2 \implies \frac{dg}{dx} = 2x \\ \int x^2 e^x dx \amp = x^2 e^x - \int 2x e^x dx \end{align*}
Now I do integration by parts again on the remaining integral. I choose \(g = 2x\) and \(\frac{df}{dx} = e^x\text{,}\) so that \(\frac{dg}{dx} = 2\) and \(f = e^x\text{.}\)
\begin{align*} x^2 e^x - \int 2x e^x \amp = x^2 e^x - \left( 2xe^x - \int 2e^x dx \right)\\ \amp = x^2 e^x - 2xe^x + 2e^x + c \end{align*}

Example 3.3.5.

In this example, I choose \(g = x\) and \(\frac{df}{dx} = e^x\text{,}\) which leads to \(\frac{dg}{dx} = 1\) and \(f = e^x\text{.}\) Since this is a definite integral, I need to evalute the bounds on the resulting middle term. After integration by parts, the remaining integral is a simple antiderivative.
\begin{equation*} \int_1^2 x e^x dx = xe^x \Bigg|_1^2 - \int_1^2 e^x dx = 2e^2 - e - e^x \Bigg|_1^2 = 2e^2 - e - e^2 + e = e^2 \end{equation*}

Example 3.3.6.

In this example, I choose \(\frac{df}{dx} = x^2\) and \(g = \ln x\text{.}\) Since this is a definite integral, I evaluate the middle term on the bounds of the integral.
\begin{align*} \int_1^{e^2} x^2 \ln x dx \amp = \frac{x^3}{3} \ln x \Bigg|_1^{e^2} - \int_1^{e^2} \frac{x^3}{3} \frac{1}{x} dx\\ \amp = \frac{e^6}{3} 2 - \frac{1}{3} 0 - \frac{1}{3} \int_1^{e^2} x^2 dx = \frac{2e^6}{3} - \frac{x^3}{9} \Bigg|_1^{e^2}\\ \amp = \frac{2e^6}{3} - \frac{e^6}{9} + \frac{1}{9} = \frac{5e^6 + 1}{9} \end{align*}

Example 3.3.7.

The next integrand doesn’t look anything like a product, but I can still use integration by parts by making a very clever choice of the functions. I choose \(g = \ln x\) and \(\frac{df}{dx}= 1\) which leads to \(f = x\) and \(\frac{dg}{dx} = \frac{1}{x}\text{.}\)
\begin{equation*} \int \ln x dx = x \ln x - \int \frac{x}{x} dx = x \ln x - \int 1 dx = x \ln x - x + c \end{equation*}

Example 3.3.8.

This example is a clever and tricky use of integration by parts to deal with an important but difficult types of integral. Let \(a,b \in \RR\) with \(a,b \neq 0\text{.}\) In the following integral, I am going to use integration by parts twice in a row.
\begin{align*} \int e^{ax} \sin bx dx \amp\\ \frac{df}{dx} \amp = e^{ax} \implies f = \frac{e^{ax}}{a}\\ g \amp = \sin bx \implies \frac{dg}{dx} = b \cos bx\\ \int e^{ax} \sin bx dx \amp = \frac{e^{ax} \sin bx}{a} - \int \frac{b}{a} e^{ax} \cos bx dx\\ \frac{df}{dx} \amp = e^{ax} \implies f = \frac{e^{ax}}{a}\\ g \amp = \cos bx \implies \frac{dg}{dx} = -b \sin bx\\ \amp = \frac{e^{ax}\sin bx}{a} - \frac{b}{a} \left( \frac{e^{ax} \cos bx}{a} - \int \frac{b}{a} e^{ax} (-\sin bx) dx \right)\\ \int e^{ax} \sin bx dx \amp = \frac{e^{ax}\sin bx}{a} - \frac{be^{ax} \cos bx}{a^2} - \frac{b^2}{a^2} \int e^{ax} \sin bx dx \end{align*}
What have I accomplished? I’ve done integration by parts twice, but all I’ve done is returned back to the original integral. This seems like a dead end, but I can actually solve the integral from this equation. I’ll add whole last term on the right from both sides of the equation, to cancel it from the right and add it to the left.
\begin{equation*} \int e^{ax} \sin bx dx - \frac{b^2}{a^2} \int e^{ax} \sin bx dx = \frac{e^{ax}\sin bx}{a} - \frac{be^{ax} \cos bx}{a^2} \end{equation*}
Now I’ll rewrite the left side, factoring out the common integral term from both pieces. After doing that, I can divide by the resulting non-integral term.
\begin{align*} \left( 1 + \frac{b^2}{a^2} \right) \int e^{ax} \sin bx dx \amp = \frac{ae^{ax} \sin b x - b e^{ax} \cos bx}{a^2}\\ \int e^{ax} \sin bx dx \amp = \frac{\frac{ae^{ax} \sin b x - b e^{ax} \cos bx}{a^2}}{\frac{a^2+b^2}{a^2}}\\ \int e^{ax} \sin bx dx \amp = \frac{ae^{ax} \sin b x - b e^{ax} \cos bx}{a^2+b^2} \end{align*}
The result is an expression for the antiderivative of this difficult function.

Example 3.3.9.

Some integrals need a combination of techniques and rules. Here, I’m first going to do a substitution, using \(u = \sqrt{x}\) with \(du = \frac{1}{2\sqrt{x}} dx\text{.}\) By changing \(\sqrt{x}\) yto \(u\text{,}\) I can write this as \(2udu = dx\text{,}\) allowing me to directly replace the \(dx\text{.}\) The bounds will change as well, with \(x = 0\) becoming \(u = \sqrt{0} = 0\) and \(x = \frac{\pi^2}{4}\) bcoming \(u = \sqrt{\frac{\pi^2}{4}} = \frac{\pi}{2}\text{.}\)
\begin{equation*} \int_0^{\frac{\pi^2}{4}} \sin \sqrt{x} dx = \int_0^{\frac{\pi}{2}} 2u \sin u du \end{equation*}
then I’m going to use integration by parts to solve the integral that results from the substitution. I will choose \(\frac{df}{du} = \sin u\) and \(g = 2u \text{,}\) which leads to \(f = -\cos u\) and \(\frac{dg}{du} = 2\text{.}\) Since this is a definite integral, I’ll evaluate the middle non-integral term on the bounds.
\begin{align*} \int_0^{\frac{\pi}{2}} 2u \sin u du \amp = 2u (-\cos u) \Bigg|_0^{\frac{\pi}{2}} - \int_0^{\frac{\pi}{2}} 2 (-\cos u) du\\ \amp = 2 \frac{\pi}{2} \left( -\cos \frac{\pi}{2} \right) + 2 \int_0^{\frac{\pi}{2}} \cos u du = 2 \sin u \Bigg|_0^{\frac{\pi}{2}} = 2 \end{align*}