 # APEX Calculus: for University of Lethbridge

## Section6.2Integration by Parts

Here’s a simple integral that we can’t yet evaluate:
\begin{equation*} \int x\cos(x) \,dx\text{.} \end{equation*}
It’s a simple matter to take the derivative of the integrand using the Product Rule, but there is no Product Rule for integrals. However, this section introduces Integration by Parts, a method of integration that is based on the Product Rule for derivatives. It will enable us to evaluate this integral.
The Product Rule says that if $$u$$ and $$v$$ are functions of $$x\text{,}$$ then $$(uv)' = u'v + uv'\text{.}$$ For simplicity, we’ve written $$u$$ for $$u(x)$$ and $$v$$ for $$v(x)\text{.}$$ Suppose we integrate both sides with respect to $$x\text{.}$$ This gives
\begin{equation*} \int (uv)'\,dx = \int (u'v+uv')\,dx\text{.} \end{equation*}
By the Fundamental Theorem of Calculus, the left side integrates to $$uv\text{.}$$ The right side can be broken up into two integrals, and we have
\begin{equation*} uv = \int u'v\,dx + \int uv'\,dx\text{.} \end{equation*}
Solving for the second integral we have
\begin{equation*} \int uv'\,dx = uv - \int u'v\,dx\text{.} \end{equation*}
Using differential notation, we can write $$du = u'(x)dx$$ and $$dv=v'(x)dx$$ and the expression above can be written as follows:
\begin{equation*} \int u\,dv = uv - \int v\,du\text{.} \end{equation*}
This is the Integration by Parts formula. For reference purposes, we state this in a theorem.
Let’s try an example to understand our new technique.

### Example6.2.3.Integrating using Integration by Parts.

Evaluate $$\ds\int x\cos(x) \, dx\text{.}$$
Solution 1. Video solution
Solution 2.
The key to Integration by Parts is to identify part of the integrand as “$$u$$” and part as “$$dv\text{.}$$” Regular practice will help one make good identifications, and later we will introduce some principles that help. For now, let $$u=x$$ and $$dv=\cos(x) \, dx\text{.}$$
It is generally useful to make a small table of these values as done below. Right now we only know $$u$$ and $$dv$$ as shown on the left of Figure 6.2.4; on the right we fill in the rest of what we need. If $$u = x\text{,}$$ then $$du = dx\text{.}$$ Since $$dv = \cos(x)\, dx\text{,}$$ $$v$$ is an antiderivative of $$\cos(x)\text{.}$$ We choose $$v = \sin(x)\text{.}$$
Now substitute all of this into the Integration by Parts formula, giving
\begin{equation*} \int x\cos(x)\,dx = x\sin(x) - \int \sin(x) \,dx\text{.} \end{equation*}
We can then integrate $$\sin(x)$$ to get $$-\cos(x) + C$$ and overall our answer is
\begin{equation*} \int x\cos(x)\, dx = x\sin(x) + \cos(x) + C\text{.} \end{equation*}
Note how the antiderivative contains a product, $$x\sin(x)\text{.}$$ This product is what makes Integration by Parts necessary.
We can check our work by taking the derivative:
\begin{align*} \lzoo{x}{x\sin(x) + \cos(x) + C} \amp =x\cos(x)+\sin(x)-\sin(x)+0\\ \amp = x\cos(x)\text{.} \end{align*}
You may wonder what would have happened in Example 6.2.3 if we had chosen our $$u$$ and $$dv$$ differently. If we had chosen $$u=\cos(x)$$ and $$dv=x \, dx$$ then $$du=-\sin(x)\, dx$$ and $$v=x^2/2\text{.}$$ Our second integral is not simpler than the first; we would have
\begin{equation*} \int x\cos(x)\,dx=\cos(x)\frac{x^2}{2}-\int \frac{x^2}{2}\left(-\sin(x)\right)\,dx\text{.} \end{equation*}
The only way to approach this second integral would be yet another integration by parts.
Example 6.2.3 demonstrates how Integration by Parts works in general. We try to identify $$u$$ and $$dv$$ in the integral we are given, and the key is that we usually want to choose $$u$$ and $$dv$$ so that $$du$$ is simpler than $$u$$ and $$v$$ is hopefully not too much more complicated than $$dv\text{.}$$ This will mean that the integral on the right side of the Integration by Parts formula, $$\int v\,du$$ will be simpler to integrate than the original integral $$\int u\,dv\text{.}$$
In the example above, we chose $$u=x$$ and $$dv=\cos(x)\,dx\text{.}$$ Then $$du=dx$$ was simpler than $$u$$ and $$v=\sin(x)$$ is no more complicated than $$dv\text{.}$$ Therefore, instead of integrating $$x\cos(x) \,dx\text{,}$$ we could integrate $$\sin(x)\,dx\text{,}$$ which we knew how to do.
A useful mnemonic for helping to determine $$u$$ is “LIATE,” where
L = Logarithmic, I = Inverse Trig., A = Algebraic (polynomials, roots, power functions), T = Trigonometric, and E = Exponential.
If the integrand contains both a logarithmic and an algebraic term, in general letting $$u$$ be the logarithmic term works best, as indicated by L coming before A in LIATE.
We now consider another example.

### Example6.2.5.Integrating using Integration by Parts.

Evaluate $$\displaystyle \int x e^x\,dx\text{.}$$
Solution.
The integrand contains an Algebraic term ($$x$$) and an Exponential term ($$e^x$$). Our mnemonic suggests letting $$u$$ be the algebraic term, so we choose $$u=x$$ and $$dv=e^x\,dx\text{.}$$ Then $$du=dx$$ and $$v=e^x$$ as indicated by the tables below.
We see $$du$$ is simpler than $$u\text{,}$$ while there is no change in going from $$dv$$ to $$v\text{.}$$ This is good. The Integration by Parts formula gives
\begin{equation*} \int x e^x\,dx = xe^x - \int e^x\,dx\text{.} \end{equation*}
The integral on the right is simple; our final answer is
\begin{equation*} \int xe^x\, dx = xe^x - e^x + C\text{.} \end{equation*}
Note again how the antiderivatives contain a product term.

### Example6.2.7.Integrating using Integration by Parts.

Evaluate $$\displaystyle \int x^2\cos(x) \,dx\text{.}$$
Solution 1. Video solution
Solution 2.
The mnemonic suggests letting $$u=x^2$$ instead of the trigonometric function, hence $$dv=\cos(x)\,dx\text{.}$$ Then $$du=2x\,dx$$ and $$v=\sin(x)$$ as shown below.
The Integration by Parts formula gives
\begin{equation*} \int x^2\cos(x)\,dx = x^2\sin(x) - \int 2x\sin(x)\,dx\text{.} \end{equation*}
At this point, the integral on the right is indeed simpler than the one we started with, but to evaluate it, we need to do Integration by Parts again. Here we choose $$r=2x$$ and $$ds=\sin(x)$$ and fill in the rest below. (We are choosing new names since we have already used $$u$$ and $$v\text{.}$$ Our integration by parts formula is now $$\int r\,ds=rs-\int s\,dr\text{.}$$)
\begin{equation*} \int x^2\cos(x)\,dx = x^2\sin(x) - \left(-2x\cos(x) - \int -2\cos(x)\,dx\right)\text{.} \end{equation*}
The integral all the way on the right is now something we can evaluate. It evaluates to $$-2\sin(x)\text{.}$$ Then going through and simplifying, being careful to keep all the signs straight, our answer is
\begin{equation*} \int x^2\cos(x)\, dx = x^2\sin(x) + 2x\cos(x) - 2\sin(x) + C\text{.} \end{equation*}

### Example6.2.10.Integrating using Integration by Parts.

Evaluate $$\displaystyle \int e^x\cos(x) \,dx\text{.}$$
Solution 1. Video solution
Solution 2.
This is a classic problem. Our mnemonic suggests letting $$u$$ be the trigonometric function instead of the exponential. In this particular example, one can let $$u$$ be either $$\cos(x)$$ or $$e^x\text{;}$$ to demonstrate that we do not have to follow LIATE, we choose $$u=e^x$$ and hence $$dv = \cos(x)\,dx\text{.}$$ Then $$du=e^x\,dx$$ and $$v=\sin(x)$$ as shown below.
Notice that $$du$$ is no simpler than $$u\text{,}$$ going against our general rule (but bear with us). The Integration by Parts formula yields
\begin{equation*} \int e^x\cos(x)\, dx = e^x\sin(x) - \int e^x\sin(x)\,dx\text{.} \end{equation*}
The integral on the right is not much different than the one we started with, so it seems like we have gotten nowhere. Let’s keep working and apply Integration by Parts to the new integral, using $$u=e^x$$ and $$dv = \sin(x)\,dx\text{.}$$ This leads us to the following:
The Integration by Parts formula then gives:
\begin{align*} \int e^x\cos(x)\,dx \amp = e^x\sin(x) - \left(-e^x\cos(x) - \int -e^x\cos(x)\,dx\right)\\ \amp = e^x\sin(x)+ e^x\cos(x) - \int e^x\cos(x)\, dx\text{.} \end{align*}
It seems we are back right where we started, as the right hand side contains $$\int e^x\cos(x)\,dx\text{.}$$ But this is actually a good thing.
Add $$\ds\int e^x\cos(x)\, dx$$ to both sides. This gives
\begin{align*} 2\int e^x\cos(x) \, dx \amp = e^x\sin(x) + e^x\cos(x)\\ \end{align*}

Now divide both sides by 2 and then add the integration constant:

\begin{align*} \int e^x\cos(x) \, dx \amp = \frac{1}{2}\big(e^x\sin(x) + e^x\cos(x) \big)+C\text{.} \end{align*}
Simplifying a little, our answer is thus
\begin{equation*} \int e^x\cos(x)\, dx = \frac12e^x\left(\sin(x) + \cos(x)\right)+C\text{.} \end{equation*}

### Example6.2.13.Integrating using Integration by Parts: antiderivative of $$\ln(x)$$.

Evaluate $$\int \ln(x)\,dx\text{.}$$
Solution 1. Video solution
Solution 2.
One may have noticed that we have rules for integrating the familiar trigonometric functions and $$e^x\text{,}$$ but we have not yet given a rule for integrating $$\ln(x)\text{.}$$ That is because $$\ln(x)$$ can’t easily be integrated with any of the rules we have learned up to this point. But we can find its antiderivative by a clever application of Integration by Parts. Set $$u=\ln(x)$$ and $$dv=dx\text{.}$$ This is a good, sneaky trick to learn as it can help in other situations. This determines $$du=(1/x)\,dx$$ and $$v=x$$ as shown below.
Putting this all together in the Integration by Parts formula, things work out very nicely:
\begin{equation*} \int \ln(x)\,dx = x\ln(x) - \int x\,\frac1x\,dx\text{.} \end{equation*}
The new integral simplifies to $$\int 1\,dx\text{,}$$ which is about as simple as things get. Its integral is $$x+C$$ and our answer is
\begin{equation*} \int \ln(x) \, dx = x\ln(x) - x + C\text{.} \end{equation*}

### Example6.2.15.Integrating using Int. by Parts: antiderivative of $$\arctan x$$.

Evaluate $$\displaystyle \int \arctan x \,dx\text{.}$$
Solution 1. Video solution
Solution 2.
The same sneaky trick we used above works here. Let $$u=\arctan x$$ and $$dv=dx\text{.}$$ Then $$du=1/(1+x^2)\,dx$$ and $$v=x\text{.}$$ The Integration by Parts formula gives
\begin{equation*} \int \arctan x \,dx = x\arctan x - \int \frac x{1+x^2}\,dx\text{.} \end{equation*}
The integral on the right can be solved by substitution. Taking $$w=1+x^2\text{,}$$ we get $$dw=2x\,dx\text{.}$$ The integral then becomes
\begin{equation*} \int \arctan x \,dx = x\arctan x - \frac12\int \frac 1{w}\,dw\text{.} \end{equation*}
The integral on the right evaluates to $$\ln\abs{w}+C\text{,}$$ which becomes $$\ln(1+x^2)+C$$ (we can drop the absolute values as $$1+x^2$$ is always positive). Therefore, the answer is
\begin{equation*} \int \arctan x\, dx = x\arctan x - \frac12\ln(1+x^2) + C\text{.} \end{equation*}

### Substitution Before Integration.

When taking derivatives, it was common to employ multiple rules (such as using both the Quotient and the Chain Rules). It should then come as no surprise that some integrals are best evaluated by combining integration techniques. In particular, here we illustrate making an “unusual” substitution first before using Integration by Parts.

#### Example6.2.16.Integration by Parts after substitution.

Evaluate $$\ds \int \cos(\ln(x))\, dx\text{.}$$
Solution 1. Video solution
Solution 2.
The integrand contains a composition of functions, leading us to think Substitution would be beneficial. Letting $$u=\ln(x)\text{,}$$ we have $$du = 1/x\, dx\text{.}$$ This seems problematic, as we do not have a $$1/x$$ in the integrand. But consider:
\begin{equation*} du = \frac 1x\, dx \quad \Rightarrow \quad x\cdot du = dx\text{.} \end{equation*}
Since $$u = \ln(x)\text{,}$$ we can use inverse functions and conclude that $$x = e^u\text{.}$$ Therefore we have that
\begin{align*} dx \amp = x\cdot du\\ \amp = e^u\, du\text{.} \end{align*}
We can thus replace $$\ln(x)$$ with $$u$$ and $$dx$$ with $$e^u\, du\text{.}$$ Thus we rewrite our integral as
\begin{equation*} \int \cos(\ln(x))\, dx = \int e^u\cos u \, du\text{.} \end{equation*}
We evaluated this integral on the right in Example 6.2.10. (This integral can also be found in a table of integrals). Using the result there, we have:
\begin{align*} \int \cos(\ln(x) )\, dx \amp = \int e^u\cos(u) \, du\\ \amp = \frac12e^u\big(\sin(u) + \cos(u) \big) + C\\ \amp = \frac12e^{\ln(x) } \big(\sin(\ln(x) ) + \cos(\ln(x) )\big)+C\\ \amp = \frac12x \big(\sin(\ln(x) ) + \cos(\ln(x) )\big)+C\text{.} \end{align*}

### Definite Integrals and Integration By Parts.

So far we have focused only on evaluating indefinite integrals. Of course, we can use Integration by Parts to evaluate definite integrals as well, as Theorem 6.2.2 states. We do so in the next example.

#### Example6.2.17.Definite integration using Integration by Parts.

Evaluate $$\displaystyle \int_1^2 x^2 \ln(x) \,dx\text{.}$$
Solution 1. Video solution
Solution 2.
Our mnemonic suggests letting $$u=\ln(x)\text{,}$$ hence $$dv =x^2\,dx\text{.}$$ We then get $$du = (1/x)\,dx$$ and $$v=x^3/3$$ as shown below.
The Integration by Parts formula then gives
\begin{align*} \int_1^2 x^2 \ln(x)\,dx \amp = \left.\frac{x^3}3\ln(x)\right|_1^2 - \int_1^2 \frac{x^3}{3}\,\frac 1x\,dx\\ \amp = \left.\frac{x^3}3\ln(x)\right|_1^2 - \int_1^2 \frac{x^2}{3}\,dx\\ \amp = \left.\frac{x^3}3\ln(x)\right|_1^2 - \left.\frac{x^3}{9}\right|_1^2\\ \amp = \left.\left(\frac{x^3}3\ln(x) - \frac{x^3}{9}\right)\right|_1^2\\ \amp = \left(\frac83\ln(2) - \frac89\right)-\left(\frac13\ln(1) - \frac19\right)\\ \amp = \frac83\ln(2) - \frac79\\ \amp \approx 1.07\text{.} \end{align*}
In general, Integration by Parts is useful for integrating certain products of functions, like $$\int x e^x\,dx$$ or $$\int x^3\sin(x)\,dx\text{.}$$ It is also useful for integrals involving logarithms and inverse trigonometric functions.
As stated before, integration is generally more difficult than derivation. We are developing tools for handling a large array of integrals, and experience will tell us when one tool is preferable/necessary over another. For instance, consider the three similar-looking integrals
While the first is calculated easily with Integration by Parts, the second is best approached with Substitution. Taking things one step further, the third integral has no answer in terms of elementary functions, so none of the methods we learn in calculus will get us the exact answer.
Integration by Parts is a very useful method, second only to Substitution. In the following sections of this chapter, we continue to learn other integration techniques. Section 6.3 focuses on handling integrals containing trigonometric functions.

### ExercisesExercises

#### Terms and Concepts

##### 1.
• True
• False
Integration by Parts is useful in evaluating integrands that contain products of functions.
##### 2.
• True
• False
Integration by Parts can be thought of as the “opposite of the Chain Rule.”
##### 3.
For what is “LIATE” useful?
##### 4.
• True
• False
If the integral that results from Integration by Parts appears to also need Integration by Parts, then a mistake was made in the original choice of “$$u$$”.

#### Problems

##### Exercise Group.
Evaluate the given indefinite integral.
###### 5.
$$\ds \int x\sin(x) \, dx$$
###### 6.
$$\ds \int xe^{-x}\, dx$$
###### 7.
$$\ds \int x^2\sin(x) \, dx$$
###### 8.
$$\ds \int x^3\sin(x) \, dx$$
###### 9.
$$\ds \int xe^{x^2}\, dx$$
###### 10.
$$\ds \int x^3e^{x}\, dx$$
###### 11.
$$\ds \int xe^{-2x}\, dx$$
###### 12.
$$\ds \int e^x\sin(x) \, dx$$
###### 13.
$$\ds \int e^{2x}\cos(x) \, dx$$
###### 14.
$$\ds \int {e^{7x}\sin\mathopen{}\left(9x\right)}\, dx$$
###### 15.
$$\ds \int {e^{8x}\cos\mathopen{}\left(8x\right)}\, dx$$
###### 16.
$$\ds \int \sin(x) \cos(x) \, dx$$
###### 17.
$$\ds \int {\sin^{-1}\mathopen{}\left(x\right)}\, dx$$
###### 18.
$$\ds \int {\tan^{-1}\mathopen{}\left(2x\right)}\, dx$$
###### 19.
$$\ds \int x\tan^{-1}(x) \, dx$$
###### 20.
$$\ds \int {\cos^{-1}\mathopen{}\left(x\right)}\, dx$$
###### 21.
$$\ds \int x\ln(x) \, dx$$
###### 22.
$$\ds \int {\left(x+1\right)\ln\mathopen{}\left(x\right)}\, dx$$
###### 23.
$$\ds \int {x\ln\mathopen{}\left(x-3\right)}\, dx$$
###### 24.
$$\ds \int x\ln(x^2)\, dx$$
###### 25.
$$\ds \int x^2\ln(x) \, dx$$
###### 26.
$$\ds \int \left(\ln(x) \right)^2\, dx$$
###### 27.
$$\ds \int {\ln^{2}\mathopen{}\left(x-8\right)}\, dx$$
###### 28.
$$\ds \int x\sec^2(x) \, dx$$
###### 29.
$$\ds \int x\csc^2(x) \, dx$$
###### 30.
$$\ds \int {x\sqrt{x-2}}\, dx$$
###### 31.
$$\ds \int {x\sqrt{x^{2}-6}}\, dx$$
###### 32.
$$\ds \int \sec(x) \tan(x) \, dx$$
###### 33.
$$\ds \int x\sec(x) \tan(x) \, dx$$
###### 34.
$$\ds \int x\csc(x) \cot(x) \, dx$$
##### Exercise Group.
Evaluate the indefinite integral after first making a substitution.
###### 35.
$$\ds \int {\cos\mathopen{}\left(\ln\mathopen{}\left(x\right)\right)}\, dx$$
###### 36.
$$\ds \int {e^{2x}\sin\mathopen{}\left(e^{x}\right)}\, dx$$
###### 37.
$$\ds \int {\sin\mathopen{}\left(\sqrt{x}\right)}\, dx$$
###### 38.
$$\ds \int \ln(\sqrt{x})\, dx$$
###### 39.
$$\ds \int e^{\sqrt{x}}\, dx$$
###### 40.
$$\ds \int e^{\ln(x) }\, dx$$
##### Exercise Group.
Evaluate the definite integral. Note: the corresponding indefinite integral appears in Exercises 6.2.56.2.13.
###### 41.
$$\ds \int_0^{3\pi/2} x\sin(x) \, dx$$
###### 42.
$$\ds \int_{-2}^{1} {xe^{-x}} \, dx$$
###### 43.
$$\ds \int_{-\pi/2}^{\pi/2} {x^{2}\sin\mathopen{}\left(x\right)} \, dx$$
###### 44.
$$\ds \int_{-\pi/2}^{\pi/2} {x^{3}\sin\mathopen{}\left(x\right)} \, dx$$
###### 45.
$$\ds \int_{0}^{{\sqrt{\ln\mathopen{}\left(2\right)}}} {xe^{x^{2}}} \, dx$$
###### 46.
$$\ds \int_0^1 x^3e^{x}\, dx$$
###### 47.
$$\ds \int_{2}^{3} {xe^{-2x}} \, dx$$
###### 48.
$$\ds \int_{0}^{\pi} {e^{x}\sin\mathopen{}\left(x\right)} \, dx$$
###### 49.
$$\ds \int_{-3\pi/2}^{3\pi/2} {e^{2x}\cos\mathopen{}\left(x\right)} \, dx$$