## Integration by parts? What parts?

Integration by parts comes from rewriting the product rule for derivatives and then integrating. So the “parts” are the fact that we’re going to work with two functions and treat them separately.

Let’s remember the product rule:

$$\frac{d}{dx}\left(f(x)g(x)\right) = f'(x)g(x)+f(x)g'(x).$$

Once we rearrange and take integrals we can see that we get

$$\int f(x)g'(x) dx = \int \frac{d}{dx}\left(f(x)g(x)\right)dx -\int f'(x)g(x) dx \tag{1}$$

or for definite integrals

$$\begin{eqnarray}\int_a^b f(x)g'(x) dx &=& \int_a^b \frac{d}{dx}\left(f(x)g(x)\right)dx -\int_a^b f'(x)g(x) dx\\ &=& \bigg[f(x)g(x) \bigg]_a^b – \int_a^b f'(x)g(x) dx. \tag{2} \end{eqnarray}$$

This is all very well and good, but it can feel like we’re just pushing symbols around. Let’s look at what would happen if we did this with a real function…

#### Example

Let $h(x) = x \sin x,$ take the derivative and then integrate in order to find $\int x \cos x \, dx$.

#### Solution

To start we observe that

$$h'(x) = \sin x + x\cos x.$$

We can integrate this equation on both sides to get:

$$\begin{eqnarray} \int h'(x) dx &=& \int \sin x \, dx + \int x \cos x\, dx\\ h(x) + C &=& – \cos x + \int x\cos x\, dx\\ x\sin x + C &=& – \cos x + \int x\cos x\, dx. \end{eqnarray}$$

Notice that we only need the $+C$ on one term because they could be combined. With a bit of rearranging we find

$$\int x \cos x \, dx = x\sin x + \cos x + C.$$

We obviously won’t always know the magic function $h(x)$ that we should take the derivative of so we need to use either equation (1) or (2) and make a guess about what $f(x)$ and $g(x)$ should be. Let’s look at two examples where $f$ and $g$ are decided for us.

#### Example

Use integration by parts (1) to evaluate the integral $\int x\sin x\, dx$ with $f(x) =x$ and $g'(x) = \sin x$.

#### Solution

We start by computing $f'(x)$ and $g(x).$ For these we get $f'(x) =1$ and by taking the antiderivative of $\\sin x$ we find that $g(x)= -\cos x + C.$ In fact we can leave off the $+C$ in this application $g(x)$ because the integrals on either side of the inequality implicitly contain a constant of integration.

Plugging this in we get

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

#### Example

Use integration by parts (2) to evaluate the integral $\int_0^2 xe^{3x} dx$ with $f(x) =x$ and $g'(x) = e^{3x}$.

#### Solution

We start by computing $f'(x)$ and $g(x).$ For these we get $f'(x) =1$ and by taking the antiderivative of $e^{3x}$ we find that $g(x)=\frac{1}{3}e^{3x} + C.$ As for indefinite integrals we can leave off the $+C$ because once we look at the evaluation we get $C-C=0,$ so the $C’s$ cancel.

(If finding $g(x)$ was hard for you, make sure to review the method of substitution.)

Plugging this in we get

$$\int_0^2 x e^{3x}, dx = \left(2 e^6 – 0 e^0\right) – \int_0^2 \frac{1}{3}e^{3x} dx = 2e^6 -\left( \frac{1}{9}e^{3x}\right)\Big|_0^2 = 2e^6- \frac{1}{9}e^6 + \frac{1}{9}. $$

Now you try it!

Like learning by solving problems? Try this and more in the Dogl Calculus app ðŸ˜ƒ

## Yet another notation...

Maybe this looks different then what your teacher does in class or how your book writes integration by parts. That’s because there is another really common notation involving $u$ and $v$. In this notation the integration by parts equation looks like:

$$\int u dv = uv\ – \int v du \tag{3}$$

where we’re using the shorthand $u = u(x), v=v(x), du = u'(x)dx, dv = v'(x)dx$. This of course make the equation much shorter to write, but it can also be hard to remember what it means.

Let’s look at an example of how we use this notation:

#### Example

Use integration by parts (3) to evaluate the integral $\int x \ln x\, dx$ with $u = \ln x$ and $dv = x\, dx$.

#### Solution

We can compute directly that $du = \frac{1}{x} dx$ and $v = \frac{x^2}{2}$. Using this in equation (3)$ we get:

$$\begin{eqnarray} \int x\ln x\, dx & = & \int u\, dv \\ & = & uv – \int v\, du\\ & = & \frac{x^2}{2}\ln x\ – \int \frac{x^2}{2} \frac{1}{x} dx\\ & =&\frac{x^2}{2}\ln x\ – \int \frac{x}{2}dx\\ &=&\frac{x^2}{2}\ln x\ -\ \frac{x^2}{4}\ + C.\end{eqnarray}$$

## Choose your weapons! What the $f$ is $g$?

We’ve done a few examples at this point, but when we have to use integration by parts in the wild (e.g. on a quiz) we won’t usually be told what to use as $f$ and $g’$. How do we pick? Here are a few things to keep in mind:

#### Tips

1) Whatever function you choose as your $g'(x)$ (or $dv$) needs to be something you can integrate.

2) The function $h'(x)g(x)$ should be easier to work with (i.e. integrate) then the function you started with.

You might notice that these tips aren’t super specific. It’s common to try and learn many different ‘types’ of integration by parts and memorize the best choices for $f$ and $g’$. This can work, but it means if you hit a question that isn’t one of the types you’ve memorized then you can get stuck. Let’s look at a flow chart we can use to help work through some examples.

#### Example

Suppose you want to integrate $\int x^2 \ln x\, dx.$

This is a product of functions.

Let’s say we choose $f(x) = x^2$ and $g'(x) = \ln x$.

We notice that $\ln x$ isn’t easily integrable, but $x^2$ is, so we swap our choices.

Now we have $f(x) = \ln x$ and $g'(x) = x^2$. Then $g(x) = \frac{1}{3}x^3$ and $f'(x) = \frac{1}{x}.$

$g’$ is easily integrable, and $f’$ is certainly nice enough.

Lastly we get $$\int f'(x)g(x)dx =\int \frac{x^2}{3}dx.$$ We can compute that this is $\frac{x^3}{9} + C$ so we can just plug everything in and we’re done!

Let’s check out a few more examples

#### Example

Compute the integral $\int \arctan x\, dx$ using integration by parts.

(Try this with $\int \ln x\, dx$ if you aren’t using inverse trig functions)

#### Solution

We start by noticing that $h(x) = \arctan x$ isn’t really a product of functions. Our first instinct might be that we can’t use integration by parts, but let’s check the flow chart. Is $h'(x)$ simpler than $h(x)?$

Yes! $h'(x) = \frac{1}{1+x^2}$ which is a rational function and generally easier to work with.

Let’s take $f(x)= \arctan x$ and $g'(x) = 1,$ then $f'(x) = \frac{1}{1+x^2}$ and $g(x) = x$.

Then $$\int f(x)g(x) dxÂ = \int \frac{x}{1+x^2}dx.$$ This isn’t immediately integrable, but notice that if we perform a u-substitution with $u = 1+x^2,$ then $du = 2x\, dx$ or $\frac{1}{2} du = x\, dx$. This give us $$\begin{eqnarray}\int \frac{x}{1+x^2}dx &=& \frac{1}{2} \int \frac{1}{u} du\\ & =& \frac{1}{2} \ln u + C\\ & =& \frac{1}{2} \ln(1+x^2) + C \end{eqnarray}$$

To finish it off we just need to plug everything into the integration by parts formula $$\int \arctan x\, dx = x\arctan x – \frac{1}{2}\ln(1+x^2) + C.$$

#### Example

Determine if Integration by Parts is a good strategy to compute the integral $\int x\sqrt{1+x} dx$.

#### Solution

We see that $h(x) = x\sqrt{1+x}$ is a product, and there are two natural ways to split it. Let’s look at what happens if we take $f(x) = \sqrt{1+x}$ and $g'(x) = x$ first. We notice that $g’$ is easily integrable, but $$f'(x) = \frac{1}{2\sqrt{1+x}}$$ which is definitely harder to work with than $f$.

Let’s look at the other choice: $f(x) = x$ and $g'(x) = \sqrt{1+x}$.

In this case $g’$ is integrable but requires a u-substitution. Using the substitution $u = 1+x$ on $\int \sqrt{1+x}dx$ gives us $$\int \sqrt{u}du = \frac{2 u^{3/2}}{3} +C= \frac{2 (1+x)^{3/2}}{3}+C.$$

Putting this together we have $$\int f'(x)g(x)dx =\frac{2}{3} \int (1+x)^{3/2}dx$$ which can be computed with the same u-substitution as before. This gives $$\begin{eqnarray}\int x\sqrt{1+x}dx &=& \frac{2}{3}x(1+x)^{3/2} – \frac{2}{3} \int (1+x)^{3/2}dx\\ &=& \frac{2}{3}x(1+x)^{3/2} – \frac{2}{5}Â (1+x)^{5/2} + C \end{eqnarray}$$

From this we see that we can compute this integral via integration by parts, but it doesn’t follow that this is the easiest solution. If we took the u-substitution $u=1+x$ on the original integral we would find $du =dx$ and $$\begin{eqnarray} \int x\sqrt{1+x}dx &=& \int (u-1)\sqrt{u} du\\ & = & \int u^{3/2} – \sqrt{u} du \\ & = & \frac{2}{5} u^{5/2} – \frac{2}{3} u^{3/2} + C\\ &=& \frac{2}{5}(1+x)^{5/2} – \frac{2}{3}(1+u)^{3/2}.\end{eqnarray}$$

It’s up to you which of these methods you find easier. The substitution required to do it directly is a bit more complicated, but needs to be done only once.

## When once isn't enough

All of the examples we have considered up to this point could be computed using only one iteration of integration by parts, but sometimes this isn’t enough. Let’s consider a couple of examples.

#### Example – eliminating $x^n$ by applying IBP $n$ times

Compute $\int x^3 e^x dx$

#### Solution

We start by noting that $h(x) = x^3e^x$ is a product of functions. Since $e^x$ is the same both integrated and differentiated we should choose $f(x) = x^3$ because it will get simpler when we take the derivative.

Take $f(x) = x^3$ and $g'(x) = e^x$, then $f'(x) = 3x^2$ and $g(x) = e^x.$ Applying the integration by parts formula we find $$\int x^3 e^x dx = x^3e^x – 3\int x^2 e^xdx.$$

We now can use integration by parts on $\int x^2 e^x dx.$ As before we take $g'(x) = e^x$, and this time $f(x) = x^2,$ then $g(x) = e^x$ and $f'(x) = 2x.$ Applying the integration by parts formula we have $$\int x^2 e^x dx = x^2e^x – 2\int x e^xdx.$$

Putting these together we get $$\int x^3 e^x = x^3e^x – 3x^2 e^x + 6\int x e^x dx.$$

Lastly we apply integration by parts one more time to $\int x e^x$. Take $g'(x) = e^x$ and $f(x) =x$, then $f'(x) =1$ and $g(x) = e^x.$ Applying IBP again we get $$\int xe^x dx = xe^x – \int e^x = x e^x – e^x + C.$$

Putting everything together we get $$\int x^3 e^x = x^3e^x – 3x^2 e^x + 6xe^x -6e^x + C.$$

#### Example – mixing trig functions and exponentials

Compute $\int e^{2x} \sin x\, dx$

#### Solution

If we have a product of an exponential with $\sin x$ or $\cos x$, then we can compute the integral by applying Integration by Parts twice and grouping like terms. The important thing is to be consistant about choosing $f$ and $g$. This means that if you choose $f$ to be the exponential in the first application of Integration by Parts, then you should make the same choice in the second application.

We have $h(x) = e^{2x} \sin x$, let’s choose $f(x) = e^{2x}$ and $g'(x) = \sin x$, then $f'(x) = 2e^{2x}$ and $g(x) = -\cos x$. This gives us $$\int e^{2x} \sin x \, dx = -e^{2x}\cos x + 2\int e^{2x} \cos x\, dx.$$

Now we apply IBP again to $\int e^{2x} \cos x$ and we again take the exponential as $f(x)$. In this case we have $f(x) = e^{2x}$ and $g'(x) = \cos x$. This gives us $f'(x) = 2e^{2x}$ and $g(x) = \sin x$. Using IBP we get: $$\int e^{2x} \cos x \, dx = e^{2x}\sin x – 2\int e^{2x}\sin x \, dx.$$

Putting this together we get: $$\int e^{2x} \sin x \, dx = -e^{2x}\cos x + 2 e^{2x}\sin x – 4\int e^{2x}\sin x \, dx.$$ Combining the $\int e^{2x} \sin x \,dx$ terms together we get: $$5 \int e^{2x}\sin x \, dx = -e^{2x}\cos x + 2 e^{2x}\sin x + C$$ (We need to add the $+C$ back in here because we’ve combined the two integrals)

Dividing by $5$ gives us the final answer: $$\int e^{2x}\sin x \, dx = -\frac{1}{5}e^{2x}\cos x + \frac{2}{5} e^{2x}\sin x + C.$$

- The integral you need to compute gets simpler in some way with every application.
- After the first application of integration by parts your integrand looks basically the same except with $\sin x$ instead of $\cos x$ or vice-versa.