# Integration by Parts

Integration by parts is a technique that allows us to integrate the product of two functions. It is derived by integrating, and rearrangeing the product rule for differentiation.
The idea behind the integration by parts formula is that it allows us to rearrange the initial integral in such a way that we end-up having to find an alternate integral, which is simpler to find, or work with.

#### Lesson Plan/Objective of this section

We start by learning the formula for integration by parts, for both indefinite and definite integration. We then watch a detailed tutorial to consolidate our knowledge and work through a couple of exercises to check whether we've understood.

We then move on to learn about more complicated cases of integration by parts:

• integrating functions that require integration by parts more than once.

• how to integrate functions such as $$ln(x)$$, $$sin^{-1}(x)$$, $$arctan(x)$$, ... .

• recursive integration by parts
each of the topics we learn about it illustrated by a tutorial and immediately accompnaied by exercises, with answer keys, to check our understanding.

## Formula - Integration by Parts

There are two formula we need to be comfortable with. The first is the indefinite integral formula for integration by parts (aka the anti-derivative formula), the second is the definite integral formula.

### Anti-Derivative Formula

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

### Definite Integral Formula

$\int_a^b u'(x).v(x)dx = \begin{bmatrix}u(x).v(x)\end{bmatrix}_a^b - \int_a^b u(x).v'(x)dx$

## Exercise 1

1. $$\int x.cos(x)dx$$

2. $$\int \begin{pmatrix}3x+4\end{pmatrix}e^x dx$$

3. $$\int \begin{pmatrix} 2x-1 \end{pmatrix}2^x dx$$

4. $$\int 4x.e^{2x+1} dx$$

5. $$\int x^2.ln(x) dx$$

1. $$\int x.cos(x)dx = x.sin(x) + cos(x)+c$$

2. $$\int \begin{pmatrix} 3x + 4 \end{pmatrix} e^x dx = \begin{pmatrix}3x+4 \end{pmatrix}e^x - 3.e^x + c$$

We can also write this in factored form:

$$\int \begin{pmatrix} 3x + 4 \end{pmatrix} e^x dx = \begin{pmatrix} 3x + 1 \end{pmatrix}e^x + c$$

3. $$\int \begin{pmatrix} 2x - 1 \end{pmatrix} 2^x dx = \frac{2x - 1}{ln(2)} - \frac{2}{ln^2(2)}.2^x + c$$

We can also write this in factored form:

$$\int \begin{pmatrix} 2x - 1 \end{pmatrix} 2^x dx = \frac{ \begin{pmatrix} 2x - 1 \end{pmatrix} ln(2)-2}{ln^2(2)}.2^x + c$$

4. $$\int 4x.e^{2x+1} dx = 2x.e^{2x+1} - e^{2x+1}+c$$

We can also write this in factored form:

$$\int 4x.e^{2x+1} dx = \begin{pmatrix}2x - 1 \end{pmatrix}.e^{2x+1}+c$$

5. Either $$\int x^3.ln(x)dx = \frac{x^2}{3}.ln(x) - \frac{x^3}{9} + c$$

We can also write this in factored form:

$$\int x^3.ln(x)dx = \frac{x^3}{9}\begin{pmatrix} 3.ln(x) - 1 \end{pmatrix} + c$$

## Solution With Working

1. We integrate $$\int x. cos(x)dx$$ as follows:

Let $$u'(x)=cos(x)$$ and $$v(x) = x$$.

Then:

$$u(x) = sin(x)$$ and $$v'(x)=1$$.

Using integration by parts we can now find the integral: \begin{aligned} \int x.cos(x)dx & = x.sin(x) - \int 1 \times sin(x) dx \\ & = x.sin(x) - \int sin(x) dx \\ & = x.sin(x) - \begin{pmatrix} - cos(x) \end{pmatrix} + c \\ \int x.cos(x)dx & = x.sin(x) + cos(x) + c \end{aligned}

2. We integrate $$\int \begin{pmatrix} 3x + 4 \end{pmatrix} e^x dx$$ as follows:

Let $$u'(x) = e^x$$ and $$v(x) = 3x+4$$.

Then:

$$u(x) = e^x$$ and $$v'(x) = 3$$.

Using integration by parts we now find the integral: \begin{aligned} \int \begin{pmatrix} 3x +4 \end{pmatrix} e^x dx & = e^x \begin{pmatrix} 3x + 4 \end{pmatrix} - \int 3.e^x dx \\ & = \begin{pmatrix} 3x + 4 \end{pmatrix} e^x - 3.e^x + c \end{aligned}

3. We integrate $$\int \begin{pmatrix} 2x - 1 \end{pmatrix} 2^x dx$$ as follows:

Let $$u'(x) = 2^x$$ and $$v(x)=2x-1$$.

Then:

$$u(x)=\frac{1}{ln(2)}.2^x$$ and $$v'(x) = 2$$.

Using integration by parts we then find: \begin{aligned} \int \begin{pmatrix} 2x - 1 \end{pmatrix} 2^x dx & = \frac{1}{ln(2)}.2^x. \begin{pmatrix} 2x - 1 \end{pmatrix} - \int \frac{1}{ln(2)}.2^x \times 2 dx \\ & = \frac{2x - 1}{ln(2)}.2^x - \int \frac{2}{ln(2)}.2^x dx \\ & = \frac{2x - 1}{ln(2)}.2^x - \frac{2}{\begin{pmatrix} ln(2) \end{pmatrix}^2}.2^x + c \\ \int \begin{pmatrix} 2x - 1 \end{pmatrix} 2^x dx & = \frac{2x - 1}{ln(2)}.2^x - \frac{2}{ ln^2(2) }.2^x + c \end{aligned}

4. We integrate $$\int 4x.e^{2x+1}dx$$ as follows:

Let $$u'(x) = e^{2x+1}$$ and $$v(x)=4x$$.

Then:

$$u(x) = \frac{1}{2}.e^{2x+1}$$ and $$v'(x) = 4$$.

Using integration by parts we then find: \begin{aligned} \int 4x.e^{2x+1}dx & = \frac{1}{2}.e^{2x+1}\times 4x - \int \frac{1}{2}.e^{2x+1} \times 4 dx\\ & = \frac{4x}{2}.e^{2x+1} - \int \frac{4}{2}.e^{2x+1} dx\\ & = 2x.e^{2x+1} - \int 2.e^{2x+1}dx \\ & = 2x.e^{2x+1} - \frac{1}{2}\times 2.e^{2x+1} + c \\ \int 4x.e^{2x+1}dx & = 2x.e^{2x+1} - e^{2x+1} + c \end{aligned}

5. We integrate $$\int x^2.ln(x)dx$$ as follows:

Let $$u'(x) = x^2$$ and $$v(x) = ln(x)$$.

Then:

$$u(x) = \frac{x^3}{3}$$ and $$v'(x) = \frac{1}{x}$$.

Now, using integration by parts we find: \begin{aligned} \int x^2.ln(x)dx & = \frac{x^3}{3}.ln(x) - \int \frac{x^3}{3}\times \frac{1}{x} dx \\ & = \frac{x^3}{3}.ln(x) - \int \frac{x^3}{3x} dx \\ & = \frac{x^3}{3}.ln(x) - \int \frac{x^2}{3} dx \\ & = \frac{x^3}{3}.ln(x) - \frac{1}{3}\times \frac{x^3}{3} + c \\ \int x^2.ln(x)dx & = \frac{x^3}{3}.ln(x) - \frac{x^3}{9} + c \end{aligned}

## Exercise 2

Evaluate each of the following definite integrals:

1. Evaluate $$\int_1^e x.ln(x)dx$$

2. Evaluate $$\int_0^{\pi} 3x.sin(x) dx$$

3. Evaluate $$\int_0^2 \begin{pmatrix} 4x - 5 \end{pmatrix} e^{2x} dx$$

## Solutions Without Working

1. $$\int_1^e x.ln(x) dx = \frac{e^2 + 1}{4}$$

2. $$\int_0^{\pi} 3x.sin(x)dx = 3 \pi$$

3. $$\int_0^2 \begin{pmatrix} 4x - 5 \end{pmatrix} e^{2x} dx = \frac{e^4+7}{2}$$

## Solutions With Working

1. We integrate $$\int_1^e x.ln(x) dx$$ as follows:

Let $$u'(x) = x$$ and $$v(x)=ln(x)$$.
Then $$u(x) = \frac{x^2}{2}$$ and $$v'(x) = \frac{1}{x}$$.

We now integrate by parts: \begin{aligned} \int_1^e x.ln(x) dx & = \begin{bmatrix} \frac{x^2}{2}.ln(x) \end{bmatrix}_1^e - \int_1^e \frac{x^2}{2}.\frac{1}{x}dx \\ & = \begin{bmatrix} \frac{x^2}{2}.ln(x) \end{bmatrix}_1^e - \int_1^e \frac{x^2}{2x}dx \\ & = \begin{bmatrix} \frac{x^2}{2}.ln(x) \end{bmatrix}_1^e - \int_1^e \frac{x}{2}dx \\ & = \begin{bmatrix} \frac{x^2}{2}.ln(x) \end{bmatrix}_1^e - \begin{bmatrix} \frac{x^2}{4} \end{bmatrix}_1^e \\ & = \begin{bmatrix} \frac{x^2}{2}.ln(x) - \frac{x^2}{4} \end{bmatrix}_1^e \\ & = \begin{bmatrix} \frac{x^2}{4} \begin{pmatrix} 2.ln(x) - 1 \end{pmatrix} \end{bmatrix}_1^e \\ & = \frac{e^2}{4} \begin{pmatrix} 2.ln(e) - 1 \end{pmatrix} - \frac{1^2}{4}.\begin{pmatrix} 2. ln(1) - 1 \end{pmatrix} \\ & = \frac{e^2}{4} \begin{pmatrix}2\times 1 - 1 \end{pmatrix} - \frac{1}{4} \begin{pmatrix} 2\times 0 - 1 \end{pmatrix} \\ & = \frac{e^2}{4}\times 1 - \frac{1}{4} (-1) \\ & = \frac{e^2}{4} + \frac{1}{4} \\ \int_1^e x.ln(x) dx & = \frac{e^2 + 1}{4} \end{aligned}

2. We integrate $$\int_0^{\pi} 3x.sin(x)dx$$ as follows:

Let $$u'(x) = sin(x)$$ and $$v(x) = 3x$$.
Then $$u(x) = -cos(x)$$ and $$v'(x) = 3$$.

We now integrate by parts:
\begin{aligned} \int_0^{\pi} 3x.sin(x)dx & = \begin{bmatrix} -3x.cos(x) \end{bmatrix}_0^{\pi} - \int_0^{\pi} -3.cos(x) dx \\ & = \begin{bmatrix} -3x.cos(x) \end{bmatrix}_0^{\pi} + \int_0^{\pi} 3.cos(x) dx \\ & = \begin{bmatrix} -3x.cos(x) \end{bmatrix}_0^{\pi} + \begin{bmatrix} 3.sin(x) \end{bmatrix}_0^{\pi} \\ & = \begin{bmatrix} -3x.cos(x) + 3.sin(x) \end{bmatrix}_0^{\pi}\\ & = -3\pi .cos(\pi ) + 3.sin(\pi) - \begin{bmatrix} - 3\times 0 \times cos(0) + 3.sin(0) \end{bmatrix} \\ & = -3 \pi \times (-1) + 3 \times 0 - \begin{bmatrix} 0 + 0 \end{bmatrix} \\ \int_0^{\pi} 3x.sin(x)dx & = 3 \pi \end{aligned}

3. We integrate $$\int_0^2 \begin{pmatrix} 4x - 5 \end{pmatrix} e^{2x} dx$$ as follows:

Let $$u'(x) = e^{2x}$$ and $$v(x) = 4x-5$$.
Then $$u(x) = \frac{1}{2}.e^{2x}$$ and $$v'(x) = 4$$.

We now integrate by parts:
\begin{aligned} \int_0^2 \begin{pmatrix} 4x - 5 \end{pmatrix} e^{2x} dx & = \begin{bmatrix} \frac{1}{2}.e^{2x}.\begin{pmatrix} 4x - 5 \end{pmatrix} \end{bmatrix}_0^2 - \int_0^2 \frac{1}{2}.e^{2x}\times 4 dx \\ & = \begin{bmatrix} \frac{1}{2}.e^{2x} \begin{pmatrix} 4x - 5 \end{pmatrix}\end{bmatrix}_0^2 - \int_0^2 2.e^{2x}dx \\ & = \begin{bmatrix} \frac{1}{2}.e^{2x} \begin{pmatrix} 4x - 5 \end{pmatrix} \end{bmatrix}_0^2 - \begin{bmatrix} \frac{1}{2}\times 2.e^{2x} \end{bmatrix}_0^2 \\ & = \begin{bmatrix} \frac{1}{2}.e^{2x} \begin{pmatrix} 4x - 5 \end{pmatrix} \end{bmatrix}_0^2 - \begin{bmatrix}e^{2x} \end{bmatrix}_0^2 \\ & = \begin{bmatrix} \frac{1}{2}.e^{2x} \begin{pmatrix} 4x - 5 \end{pmatrix} - e^{2x} \end{bmatrix}_0^2 \\ & = \begin{bmatrix} \frac{1}{2}.e^{2x} \begin{pmatrix} 4x - 5 -2 \end{pmatrix} \end{bmatrix}_0^2\\ & = \begin{bmatrix} \frac{1}{2}.e^{2x} \begin{pmatrix} 4x - 7 \end{pmatrix} \end{bmatrix}_0^2 \\ & = \frac{1}{2}.e^{2\times 2}\begin{pmatrix} 4\times 2 - 7 \end{pmatrix} - \frac{1}{2}.e^{2\times 0} \begin{pmatrix} 4\times 0 - 7 \end{pmatrix} \\ & = \frac{1}{2}.e^4 \begin{pmatrix} 8 - 7 \end{pmatrix} - \frac{1}{2} \times 1 \begin{pmatrix} 0 - 7 \end{pmatrix} \\ & = \frac{1}{2}.e^4 \times 1 - \frac{1}{2} (-7) \\ & = \frac{e^4}{2} + \frac{7}{2} \\ \int_0^2 \begin{pmatrix} 4x - 5 \end{pmatrix} e^{2x} dx & = \frac{e^4+7}{2} \end{aligned}

## Integrating by Parts Twice & More

Consider the following integral: $\int x^2.sin(x)dx$ We can use integration by parts, letting $$u'(x)=sin(x)$$ and $$v(x) = x^2$$, and this would simplify the integral, but "not enough". Indeed integrating by parts once leads to: $\int x^2.sin(x)dx = -x^2.cos(x) + \int 2x.cos(x)dx$ Although we can't find the integral $$\int 2x.cos(x)dx$$ directly, we can use integration by parts again.

Let $$u'(x) = cos(x)$$ and $$v(x) = 2x$$, so that $$u(x) = sin(x)$$ and $$v'(x)=2$$. Then, integrating by parts: \begin{aligned} \int 2x.cos(x)dx &= 2x.sin(x)-\int 2.sin(x)dx \\ & = 2x.sin(x) + 2cos(x) +c \end{aligned} Replacing $$\int 2x.cos(x) dx$$ in the integral $$int x^2.sin(x)dx = -x^2.cos(x) + \int 2x.cos(x)dx$$, we can no state the final result: $\int x^2.sin(x) dx = -x^2.cos(x)+ 2x.sin(x) + 2.cos(x) + c$ This is further illustrated and explained in the following tutorial.

## Exercise 3

Find each of the following:

1. $$\int x^2.sin(x) dx$$

2. $$\int \begin{pmatrix} x^2 - 2x \end{pmatrix} e^{2x}.dx$$

3. $$\int x^3 cos\begin{pmatrix} \frac{x}{2} \end{pmatrix}.dx$$

## Solution Without Working

1. $$\int x^2.sin(x)dx = -x^2.cos(x) + 2x.sin(x)+ 2.cos(x) + c$$

2. $$\int \begin{pmatrix} x^2 - 2x \end{pmatrix}e^{2x} dx = \frac{1}{4}e^{2x}\begin{pmatrix} 2x^2 - 6x + 3 \end{pmatrix} + c$$

3. $$\int x^3.cos\begin{pmatrix} \frac{x}{2} \end{pmatrix} dx = 2x^3.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 12x^2.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} - 48x.sin\begin{pmatrix} \frac{x}{2} \end{pmatrix} - 96.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} +c$$

## Solution With Working

1. We integrate $$\int x^2.sin(x)dx$$ as follows:

Let $$u'(x) = sin(x)$$ and $$v(x) = x^2$$.

Then:

$$u(x) = -cos(x)$$ and $$v'(x) = 2x$$.

Using the integration by parts formula we then find: \begin{aligned} \int x^2.sin(x)dx & = -x^2.cos(x) - \int - cos(x).2x dx \\ & = -x^2.cos(x) + \int 2x. cos(x)dx \end{aligned} We now use integration by parts again to find $$\int 2x.cos(x)dx$$.

Let $$u'(x) = cos(x)$$ and $$v(x) = 2x$$.

Then:

$$u(x) = sin(x)$$ and $$v'(x) = 2$$.

We now find the integral $$\int 2x.cos(x)dx$$: \begin{aligned} \int 2x. cos(x) dx & = 2x.sin(x) - \int 2.sin(x) dx \\ & = 2x.sin(x) - \begin{pmatrix} -2.cos(x) \end{pmatrix} + c \\ \int 2x. cos(x) dx & = 2x.sin(x) + 2.cos(x) + c \end{aligned} We now plug this result back where we left our initial integral, leading us to the final answer: $\int x^2.sin(x)dx = -x^2.cos(x)+2x.sin(x) + 2.cos(x)+ c$

2. We integrate $$\int \begin{pmatrix} x^2 - 2x \end{pmatrix}e^{2x} dx$$ as follows:

Let $$u'(x) = e^{2x}$$ and $$v(x) = x^2 - 2x$$.

Then:

$$u(x) = \frac{1}{2}e^{2x}$$ and $$v'(x) = 2x - 2$$.

So, using the integration by parts formula this integral becomes: \begin{aligned} \int \begin{pmatrix} x^2 - 2x \end{pmatrix}e^{2x} dx & = \frac{1}{2}e^{2x} \begin{pmatrix} x^2 - 2x \end{pmatrix} - \int \frac{1}{2}e^{2x} \begin{pmatrix} 2x - 2 \end{pmatrix} dx \\ & = \frac{1}{2}e^{2x} \begin{pmatrix} x^2 - 2x \end{pmatrix} - \frac{1}{2} \int e^{2x}\begin{pmatrix} 2x - 2 \end{pmatrix} dx \end{aligned} To find the integral $$\int e^{2x} \begin{pmatrix} 2x - 1 \end{pmatrix} dx$$ we integrate by parts again:

Let $$u'(x) = e^{2x}$$ and $$v(x) = 2x - 2$$.

Then:

$$u(x) = \frac{1}{2}e^{2x}$$ and $$v'(x) = 2$$.

We now find the integral $$\int e^{2x} \begin{pmatrix} 2x- 2\end{pmatrix} dx$$: \begin{aligned} \int e^{2x} \begin{pmatrix} 2x- 2\end{pmatrix} dx & = \frac{1}{2}e^{2x} \begin{pmatrix} 2x - 2 \end{pmatrix} - \int \frac{1}{2}e^{2x}\times 2 dx \\ & = \frac{1}{2}e^{2x} \begin{pmatrix} 2x - 2 \end{pmatrix} - \int e^{2x} dx \\ & = \frac{1}{2}e^{2x} \begin{pmatrix} 2x - 2 \end{pmatrix} - \frac{1}{2}e^{2x} + c \\ & = \frac{1}{2}e^{2x} \begin{pmatrix} 2x - 2 - 1 \end{pmatrix} + c \\ \int e^{2x} \begin{pmatrix} 2x- 2\end{pmatrix} dx & = \frac{1}{2}e^{2x} \begin{pmatrix} 2x - 3 \end{pmatrix} + c \end{aligned} We now plug this result back into where we left our initial integral, leading us to the final answer: \begin{aligned} \int \begin{pmatrix} x^2 - 2x \end{pmatrix}e^{2x}dx & = \frac{1}{2}e^{2x} \begin{pmatrix} x^2 - 2x \end{pmatrix} - \frac{1}{2} \begin{bmatrix} \frac{1}{2}e^{2x} \begin{pmatrix} 2x - 3 \end{pmatrix} \end{bmatrix} + c \\ & = \frac{1}{2}e^{2x} \begin{pmatrix} x^2 - 2x \end{pmatrix} - \frac{1}{4}e^{2x} \begin{pmatrix} 2x - 3 \end{pmatrix} + c \\ & = \frac{1}{4}e^{2x} \begin{pmatrix} 2x^2 - 4x - 2x + 3 \end{pmatrix} + c \\ \int \begin{pmatrix} x^2 - 2x \end{pmatrix}e^{2x}dx & = \frac{1}{4}e^{2x} \begin{pmatrix} 2x^2 - 6x + 3 \end{pmatrix} + c \end{aligned}

3. Note: we're going to have to integrate by parts three times. We therefore name each of our results to make working easier to follow.

We start by naming the initial integral $$I$$, that's: $I =\int x^3 cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx$ We integrate $$I = \int x^3 cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx$$ as follows:

Let $$u'(x) = cos\begin{pmatrix} \frac{x}{2} \end{pmatrix}$$ and $$v(x) = x^3$$.

Then:

$$u(x) = 2.sin\begin{pmatrix} \frac{x}{2} \end{pmatrix}$$ and $$v'(x) = 3x^2$$.

We now use the integration by parts formula to find:

\begin{aligned} I & =\int x^3 .cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx \\ & = 2x^3.sin\begin{pmatrix} \frac{x}{2} \end{pmatrix} - \int 2.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} \times 3x^2 dx \\ I & = 2x^3.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} - 6 \int x^2.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx \end{aligned} We now focus on the integral, we define as $$J$$, $$J = \int x^2.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx$$.

Let $$u'(x) = sin \begin{pmatrix} \frac{x}{2} \end{pmatrix}$$ and $$v(x) = x^2$$.

Then:

$$u(x) = -2.cos\begin{pmatrix} \frac{x}{2} \end{pmatrix}$$ and $$v'(x) = 2x$$.

Integrating by parts we find: \begin{aligned} J & = \int x^2.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx \\ & = -2x^2. cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} - \int - 2.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} \times 2x dx \\ J & = -2x^2. cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 4 \int x.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx \end{aligned} We now focus on the integral, we define as $$K$$, $$K = \int x.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix}dx$$.

Let $$u'(x) = cos \begin{pmatrix} \frac{x}{2} \end{pmatrix}$$ and $$v(x) = x$$.

Then:

$$u(x) = 2.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix}$$ and $$v'(x) = 1$$.

Using the integration by parts formula we find: \begin{aligned} K & = \int x.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix}dx \\ & = 2x.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} - \int 2.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx \\ & = 2x.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} - \begin{pmatrix} - 2\times 2.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} \end{pmatrix} \\ K & = 2x.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 4.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} \end{aligned} We now plug this result for $$K$$ into the expression we found for $$J$$: \begin{aligned} J& = \int x^2.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} \\ & = -2x^2.cos\begin{pmatrix} \frac{x}{2} \end{pmatrix} + 4 \begin{bmatrix} 2x.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 4.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} \end{bmatrix} \\ & = -2x^2.cos\begin{pmatrix} \frac{x}{2} \end{pmatrix} + 8x.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 16.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} \end{aligned} We now plug this result back into the expression found after our first integration by parts for $$\int x^3.cos\begin{pmatrix} \frac{x}{2} \end{pmatrix}dx$$ and state the final answer: \begin{aligned} \int x^3 .cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} dx & = 2x^3.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} - 6 \begin{bmatrix} -2x^2. cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 8x.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 16.cos\begin{pmatrix} \frac{x}{2} \end{pmatrix} \end{bmatrix} + c \\ & = 2x^3.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} + 12x^2.cos\begin{pmatrix} \frac{x}{2} \end{pmatrix} - 48x.sin \begin{pmatrix} \frac{x}{2} \end{pmatrix} - 96.cos \begin{pmatrix} \frac{x}{2} \end{pmatrix} + c \end{aligned}

## "Must-Know" Trick

Suppose we had to find either of the following: $\int ln(x) dx$ $\int sin^{-1}(x) dx$ finding the antiderivatives of such functions isn't obvious.
We can use integration by parts to find such integrals. The "trick" is to let: $u'(x) = 1$ the function whose integral is unknown, but whose derivative is well-known, is therefore defined as $$v(x)$$ and will then no longer have to be integrated.
This is further explained and illustrated in the following tutorial.

## Exercise 4

1. $$\int ln(x) dx$$

2. $$\int tan^{-1}(x)dx$$

3. $$\int sin^{-1}(x)dx$$

## Solution Without Working

1. $$\int ln(x) dx = x.ln\begin{pmatrix}x \end{pmatrix} - x + c$$

2. $$\int tan^{-1}(x)dx = x.tan^{-1}(x)- \frac{1}{2}.ln \begin{pmatrix}1+x^2 \end{pmatrix}+c$$

3. $$\int sin^{-1}(x)dx = x.sin^{-1}(x) + \sqrt{1-x^2} + c$$

## Solution With Working

1. We integrate $$\int ln(x) dx$$ as follows:

Let $$u'(x) = 1$$ and $$v(x) = ln(x)$$.

Then $$u(x) = x$$ and $$v'(x) = \frac{1}{x}$$.

Using integration by parts we can now integrate: \begin{aligned} \int ln(x) dx & = x.ln(x) - \int x.\frac{1}{x} dx \\ & = x.ln(x) - \int \frac{x}{x} dx \\ & = x.ln(x) - \int 1 .dx \\ \int ln(x) dx & = x.ln(x) - x + c \end{aligned}

2. We integrate $$\int tan^{-1}(x)dx$$ as follows:

Let $$u'(x)=1$$ and $$v(x) = tan^{-1}(x)$$.

Then $$u(x) = x$$ and $$v'(x) = \frac{1}{1+x^2}$$.

Using integration by parts we can integrate: \begin{aligned} \int tan^{-1}(x)dx & = x.tan^{-1}(x) - \int x.\frac{1}{1+x^2} dx \\ & = x.tan^{-1}(x) - \int \frac{x}{1+x^2} dx \\ & = x.tan^{-1}(x) - \frac{1}{2} \frac{2x}{1+x^2} dx \\ \int tan^{-1}(x)dx & = x.tan^{-1}(x) - \frac{1}{2}.ln \begin{vmatrix} 1 + x^2 \end{vmatrix} +c \end{aligned}

3. We integrate $$\int sin^{-1}(x)dx$$ as follows:

Let $$u'(x) = 1$$ and $$v(x) = sin^{-1}(x)$$.

Then $$u(x) = x$$ and $$v'(x) = \frac{1}{\sqrt{1 - x^2}}$$.

Using integration by parts we can integrate: \begin{aligned} \int sin^{-1}(x)dx & = x.sin^{-1}(x) - \int x. \frac{1}{\sqrt{1-x^2}}dx \\ & = x.sin^{-1}(x) - \int \frac{x}{\sqrt{1-x^2}}dx \\ \end{aligned} To integrate $$\int \frac{x}{\sqrt{1-x^2}}dx$$ we use the method of substitution:

Let $$u(x) = 1 - x^2$$, then $$\frac{du}{dx} = -2x$$ and: \begin{aligned} \int \frac{x}{\sqrt{1-x^2}} dx & = -\frac{1}{2} \int \frac{-2x}{\sqrt{1-x^2}} dx \\ & = - \frac{1}{2} \int \frac{1}{\sqrt{u}} \frac{du}{dx}.dx \\ & = - \frac{1}{2} \int \frac{1}{\sqrt{u}}du \\ & = - \frac{1}{2} \times 2\sqrt{u} + c \\ & = - \sqrt{u}+c \\ \int \frac{x}{\sqrt{1-x^2}} dx & = - \sqrt{1-x^2} + c \end{aligned} We can now complete our work: \begin{aligned} \int sin^{-1}(x)dx & = x.sin^{-1}(x) - \int \frac{x}{\sqrt{1-x^2}}dx \\ & = x.sin^{-1}(x) - \begin{pmatrix} - \sqrt{1-x^2} \end{pmatrix} + c \\ \int sin^{-1}(x)dx & = x.sin^{-1}(x) + \sqrt{1 - x^2}+c \end{aligned}

## Recursive Integration by Parts

Consider the following integral: $\int e^x.sin(x)dx$ What is apparent is that, regardless of our choice of $$u'(x)$$ and $$v(x)$$, integration by parts in no way makes the expression simple to integrate directly.

The step-by-step method for finding such integrals is described here. This is likely to be a little confusing at first.

Once you've read it, we encourage you to watch the tutorial (below) and then read this trick/method again.

## Tutorial 4

#### Trick/Method (step-by-step)

• Step 1: name the integral $$I$$, $$I = \int e^x.sin(x)dx$$ (sometimes this will already be done for us in exams).

• Step 2: integrate $$I$$ by parts, it doesn't matter which function you name $$u'(x)$$ or $$v(x)$$, but make a note of which one you name $$u'(x)$$, and name the new integral, on the right hand side, $$J$$.

• Step 3: use integration by parts to integrate $$J$$. Whichever function you had initially called $$u'(x)$$, in step 2, and which became $$u(x)$$ in the new integral you now name $$u'(x)$$. Express the result found for $$J$$ in terms of $$I$$.

• Step 4: substitute the result obtained for $$J$$, in step 3, back into the result obtained for $$I$$, in Step 2, and solve for $$I$$.
The expression found for $$I$$ is the result.

## Exercise 5

Find each of the following:

1. $$\int e^x.sin(x)dx$$

2. $$\int e^{3x} .cos(x)dx$$

3. $$\int 2^x.sin \begin{pmatrix} 2x \end{pmatrix}dx$$

## Solution Without Working

1. $$\int e^x.sin(x)dx = \frac{e^x}{2} \begin{pmatrix} sin(x) - cos(x)\end{pmatrix}+c$$

2. $$\int e^{3x}.cos(x)dx = \frac{e^{3x}}{10} \begin{pmatrix} 3.cos(x) + sin(x) \end{pmatrix} + c$$

3. $$\int 2^x.sin \begin{pmatrix} 2x \end{pmatrix} dx = \frac{2^x}{4+ln^2(2)} \begin{pmatrix} ln(2).sin\begin{pmatrix} 2x \end{pmatrix} - 2.cos\begin{pmatrix} 2x \end{pmatrix} \end{pmatrix}+c$$

## Solution With Working

1. We find the inetgral $$\int e^x.sin(x)dx$$ as follows:

• Step 1: we define the integral as $$I$$: $I = \int e^x.sin(x)dx$

• Step 2: we integrate $$I$$ by parts as follows:

Let $$u'(x) = e^x$$ and $$v(x) = sin(x)$$.

Then:

$$u(x) = e^x$$ and $$v'(x) = cos(x)$$.

So: \begin{aligned} I & = \int e^x.sin(x)dx \\ I & = e^x.sin(x) - \int e^x.cos(x)dx \end{aligned} Define $$J = \int e^x.cos(x)dx$$, so that: $I = e^x.sin(x) - J$

• Step 3: we now integrate $$J = \int e^x.cos(x) dx$$ by parts as follows:

SInce in step 2 we let $$u'(x) = e^x$$, which became $$u(x) = e^x$$, we stick with this "thread":

Let $$u'(x) = e^x$$ and $$v(x) = cos(x)$$.

Then:

$$u(x) = e^x$$ and $$v'(x) = -sin(x)$$.

So: \begin{aligned} J & = \int e^x.cos(x) dx\\ & = e^x.cos(x) - \int e^x \begin{pmatrix} - sin(x) \end{pmatrix} dx \\ J & = e^x.cos(x) + \int e^x.sin(x)dx \end{aligned} We now express this in terms of $$I$$, that's: $J = e^x.cos(x) + I$

• Step 4: we "plug" the result we found for $$J$$ back into the result we found for $$I$$, in step 2, and rearrange to state the final answer.
\begin{aligned} I & = e^x.sin(x) - J \\ I & = e^x.sin(x) - \begin{bmatrix} e^x.cos(x) + I \end{bmatrix} \\ I & = e^x.sin(x) - e^x.cos(x) - I \\ 2I & = e^x.sin(x) - e^x.cos(x) \\ 2I &= e^x \begin{pmatrix} sin(x) - cos(x) \end{pmatrix} \\ I &= \frac{e^x}{2} \begin{pmatrix} sin(x) - cos(x) \end{pmatrix} + c \end{aligned} Note: the constant of integration $$c$$ was added on the last line to avoid "useless manipulation" of a generic constant.

2. We integrate $$\int e^{3x}.cos(x)dx$$ as follows:

• Step 1: we define the integral $$I$$ as: $I = \int e^{3x}.cos(x)dx$

• Step 2: we now integrate $$I$$ by parts as follows:

Let $$u'(x) = e^{3x}$$ and $$v(x) = cos(x)$$.

Then:

$$u(x) = \frac{1}{3}e^{3x}$$ and $$v'(x) = -sin(x)$$.

So: \begin{aligned} I & = \frac{1}{3}e^{3x}.cos(x) - \int \frac{1}{3}e^{3x} \begin{pmatrix} - sin(x) \end{pmatrix} dx \\ I & = \frac{1}{3}e^{3x}.cos(x) + \frac{1}{3} \int e^{3x}.sin(x) dx \end{aligned} We define the new integral $$J$$ as: $J = \int e^{3x}.sin(x)dx$

• Step 3: we now integrate $$J$$ using integration by parts again.
Since, in step 2, we defined $$u'(x) = e^{3x}$$, which then became $$u(x) = \frac{1}{3}e^{3x}$$ we'll stick to that "thread":

Let $$u'(x) = e^{3x}$$ and $$v(x) = sin(x)$$.

Then:

$$u(x) = \frac{1}{3}e^{3x}$$ and $$v'(x) = cos(x)$$.

So that: \begin{aligned} J &= \frac{1}{3}e^{3x}.sin(x) - \int \frac{1}{3}e^{3x}.cos(x)dx \\ J & = \frac{1}{3}e^{3x}.sin(x) - \frac{1}{3} \int e^{3x}.cos(x)dx \end{aligned} We express $$J$$ in terms of $$I$$, that's: $J = \frac{1}{3}e^{3x}.sin(x) - \frac{1}{3}I$

• Step 4: we "plug" the expression we found for $$J$$, at the end of step 3, into the expression we found for $$I$$ in step 2. We then rearrange and state our final answer: \begin{aligned} & I = \frac{1}{3}e^{3x}.cos(x) + \frac{1}{3}J \\ & I = \frac{1}{3}e^{3x}.cos(x) + \frac{1}{3} \begin{bmatrix} \frac{1}{3}e^{3x}.sin(x) - \frac{1}{3}I \end{bmatrix} \\ & I = \frac{1}{3}e^{3x}.cos(x) + \frac{1}{9}e^{3x}.sin(x) - \frac{1}{9}I \\ & I + \frac{1}{9}I = \frac{3}{9}e^{3x}.cos(x) + \frac{1}{9}e^{3x}.sin(x) \\ & \frac{10}{9}I = \frac{e^{3x}}{9} \begin{pmatrix} 3.cos(x) + sin(x)\end{pmatrix} \\ & I = \frac{e^{3x}}{10} \begin{pmatrix} 3.cos(x) + sin(x) \end{pmatrix} + c \end{aligned} Note: the constant of integration $$c$$ was added on the last line to avoid "useless manipulation" of a generic constant.

• We integrate $$\int 2^x.sin \begin{pmatrix} 2x \end{pmatrix} dx$$ as follows:
• Step 1: We define the function $$I$$ as: $I = \int 2^x.sin \begin{pmatrix} 2x \end{pmatrix} dx$

• Step 2: We use integration by parts to integrate $$I$$:

Let $$u'(x) = sin\begin{pmatrix} 2x \end{pmatrix}$$ and $$v(x) = 2^x$$.

Then:

$$u(x) = - \frac{1}{2}cos\begin{pmatrix}2x\end{pmatrix}$$ and $$v'(x) = ln(2).2^x$$.

So that: \begin{aligned} I & = \int 2^x.sin \begin{pmatrix} 2x \end{pmatrix} dx \\ & = - \frac{1}{2}.cos\begin{pmatrix} 2x \end{pmatrix}.2^x - \int - \frac{1}{2} cos \begin{pmatrix} 2x \end{pmatrix}.ln(2).2^x dx \\ I & = - \frac{1}{2}.cos\begin{pmatrix} 2x \end{pmatrix}.2^x + \frac{ln(2)}{2} \int cos \begin{pmatrix} 2x \end{pmatrix} .2^x dx \end{aligned} We define the new integral, on the right hand side, as $$J$$: $J = \int cos \begin{pmatrix} 2x \end{pmatrix}.2^x dx$

• Step 3: integrate $$J$$ using integration by parts.

In step 2, we initially let $$u'(x) = sin \begin{pmatrix} 2x \end{pmatrix}$$, so carrying on with that "thread", we let $$u'(x) = cos\begin{pmatrix}2x \end{pmatrix}$$, that's:

Let $$u'(x) = cos \begin{pmatrix} 2x \end{pmatrix}$$ and $$v(x) = 2^x$$.

Then:

$$u(x) = \frac{1}{2}sin\begin{pmatrix} 2x \end{pmatrix}$$ and $$v'(x) = ln(2).2^x$$.

So that:

\begin{aligned} J & = \int cos \begin{pmatrix} 2x \end{pmatrix}.2^x dx \\ & = \frac{1}{2}.sin\begin{pmatrix} 2x \end{pmatrix}.2^x - \int \frac{1}{2}.sin \begin{pmatrix} 2x \end{pmatrix}.ln(2).2^x dx \\ J & = \frac{1}{2}.sin \begin{pmatrix} 2x \end{pmatrix}.2^x - \frac{ln(2)}{2} \int sin \begin{pmatrix} 2x \end{pmatrix}.2^x dx \end{aligned} We now express this result in terms of $$I$$, that's: $J = \frac{1}{2}.sin \begin{pmatrix}2x \end{pmatrix}.2^x - \frac{ln(2)}{2}.I$

• Step 4: "plug" the result, found for $$J$$ in step 3, into the expression found for $$I$$ in step 2. Rearrange and state the final answer: \begin{aligned} & I = - \frac{1}{2}.cos\begin{pmatrix} 2x \end{pmatrix}.2^x + \frac{ln(2)}{2}.J \\ & I = - \frac{1}{2}.cos\begin{pmatrix} 2x \end{pmatrix}.2^x + \frac{ln(2)}{2} \begin{bmatrix} \frac{1}{2}.sin \begin{pmatrix} 2x \end{pmatrix}.2^x - \frac{ln(2)}{2}.I \end{bmatrix} \\ & I = - \frac{1}{2}.cos\begin{pmatrix} 2x \end{pmatrix}.2^x + \frac{ln(2)}{4}.sin\begin{pmatrix} 2x \end{pmatrix}.2^x - \frac{ln^2(2)}{4}.I \\ & I + \frac{ln^2(2)}{4}.I = - \frac{1}{2}.cos\begin{pmatrix} 2x \end{pmatrix}.2^x + \frac{ln(2)}{4}.sin\begin{pmatrix} 2x \end{pmatrix}.2^x \\ & \frac{4I + ln^2(2).I}{4} = - \frac{2}{4}.cos \begin{pmatrix} 2x \end{pmatrix}.2^x + \frac{ln(2)}{4}.sin \begin{pmatrix} 2x \end{pmatrix}.2^x \\ & \frac{4I + ln^2(2).I}{4} = \frac{2^x}{4} \begin{pmatrix} -2.cos \begin{pmatrix} 2x \end{pmatrix} + ln(2).sin \begin{pmatrix} 2x \end{pmatrix} \end{pmatrix}\\ & 4I + ln^2(2)I = 2^x \begin{pmatrix} - 2.cos \begin{pmatrix} 2x \end{pmatrix} + ln(2).sin \begin{pmatrix} 2x \end{pmatrix} \end{pmatrix} \\ & I \begin{pmatrix} 4 + ln^2(2) \end{pmatrix} = 2^x \begin{pmatrix} ln(2).sin \begin{pmatrix} 2x \end{pmatrix} - 2.cos \begin{pmatrix}2x \end{pmatrix} \end{pmatrix} \\ & I = \frac{2^x}{4+ln^2(2)} \begin{pmatrix} ln(2).sin \begin{pmatrix}2x\end{pmatrix} - 2.cos \begin{pmatrix} 2x \end{pmatrix} \end{pmatrix} + c \end{aligned} Note: the constant of integration $$c$$ was added on the last line to avoid "useless manipulation" of a generic constant.