# Integration by parts

If $$u(x)$$ and $$v(x)$$ are two functions, thanks to the derivation rules, we know that$$d(u \cdot v) = u \cdot dv + v \cdot du$$$antiderivative $$u \cdot v=\displaystyle \int u \cdot dv + \int v \cdot du$$$

and, therefore, $$\displaystyle \int u \cdot dv = u \cdot v - \int v \cdot du$$\$

This is the integration by parts formula and it will be useful to us to compute many integrals and, although it may seem difficult, it is such a useful fromula that it is woth memorizing it.

To be able to choose, decide what $$u(x)$$ is and what $$v(x)$$ is in a given integral; we always have to bear in mind that the integral that we will have to find when using the integration by parts is $$v (x) \cdot u' (x)$$. That is, the term that we take as the derivative will then be integrated, while we will take the derivative of the other term. Sometimes we will not write the variable $$x,$$ although we will always bear it in mind. We must remember that $$dv=v' (x)\cdot dx$$and that $$du=u' (x) \cdot dx$$.

The procedure to follow is:

1. Choose the functions $$u$$ and $$dv$$.
2. Compute $$du$$ and $$v$$.
3. Use the formula and find the value of the integral.

$$\displaystyle \int x \cdot e^x \ dx$$

In this case,

$$\begin{array}{ll} u= x & du=1\cdot dx \\ dv=e^x \ dx &v=\displaystyle \int e^x \ dx = e^x\end{array}$$

sot that:

$$\displaystyle \int x \cdot e^x \ dx = x \cdot e^x - \int e^x \ dx = xe^x-e^x+C$$

As we can see, when trying to do an integral by parts, we will always have to solve another integral. The essence of the integrals by parts is that this new integral is easier than the previous one. However, we may have to do several steps before we are actually able to solve the integral.

It can also be the case that, after several steps, we obtain the same initial integral. In such case, we will call the initial integral $$I$$ and we will solve the obtained equation in terms of $$I$$.

Integral by parts in 2 steps. $$\displaystyle \int x^2 e^x \ dx$$

We take, in this case

$$\begin{array}{ll} u= x^2 & du=2x\cdot dx \\ dv=e^x \ dx &v=\displaystyle \int e^x \ dx = e^x\end{array}$$

so that:

$$\displaystyle \int x^2 e^x \ dx=x^2 e^x-2 \int x \cdot e^x dx$$ with the new integral already calculated in the example $$1$$.

Taking the same functions $$\displaystyle \int x \cdot e^x dx= x \cdot e^x-\int e^x \ dx = x \cdot e^x- e^x$$, and we can replace the value of this integral to obtain:

$$\displaystyle \int x^2 e^x dx = x^2e^x-2 \int x e^x dx = x^2e-2\Big(x e^x-e^x\Big) +C = e^x\Big(x^2-2x+2\Big)+C$$

$$\displaystyle \int \sin ^2 x \ dx$$

This integral can be calculated in several ways (it is not a direct integral. The derivative is missing!).

To solve it by parts, we will take

$$\begin{array}{ll} u= \sin x & du=\cos x \cdot dx \\ dv=\sin x \ dx &v=\displaystyle \int \sin x \ dx = -\cos x \end{array}$$

We then have:

$$\displaystyle \int \sin^2 x \ dx= -\sin x \cos x - \int \cos ^2 x \ dx =- \sin x \cdot cos x + \int \cos ^2 x \ dx= \\\displaystyle =-\sin x \cos x+ \int 1-sin^2 x \ dx = - \sin x \cos x +x - \int \sin ^2 x \ dx$$

Where we have used $$\cos^2 x= 1-\sin^2 x$$.

And so, we have the same integral as the one we had at the beginning.

$$\displaystyle \sin^2 x dx =-\sin x \cos x +x- \int \sin^2 x \ dx$$

If we isolate$$\int sin^2 x \ dx$$ we have:

$$2 \displaystyle \int sin^2 x \ dx =- \sin x \cos x +x \Rightarrow \int \sin^2 x \ dx = - \frac{1}{2}\sin x \cos x +\frac{x}{2}+ C$$

$$\displaystyle \int \arctan x \ dx$$

This integral may look difficult, but we can take $$u=arctg (x)$$ and $$dv=1$$ (often it is a very useful trick to take $$dv=1$$).

We have then:

$$\begin{array} {ll} u= \arctan x & du= \dfrac{1}{1+x^2}dx \\ dv=1 \ dx & v=x\end{array}$$

and thus:

$$\displaystyle \int \arctan c \ dx = x \arctan x - \int \frac{x}{1+x^2} \ dx = x \arctan x - \frac{1}{2} \ln|1+x^2|$$

where $$\displaystyle\int \frac{x}{1+x^2} \ dx$$ is an almost direct integral.