manyspikes

Integration by parts

Initialising environment...

In the previous section we saw how integration can be understood as the inverse of differentiation. In this and the next sections, we will learn about the most important rules of integration, which happen to be closely related to the rules of differentiation we learned in the differential calculus course.

In this section we will cover integration by parts, which can be defined as follows. If f(x)f(x) and g(x)g(x) are differentiable functions with primitives F(x)F(x) and G(x)G(x), respectively, then

f(x)g(x)dx=F(x)g(x)F(x)g(x)dx\begin{equation} \int f(x) g(x) \,\textrm{d}x = F(x)g(x) - \int F(x)g'(x) \,\textrm{d}x \end{equation}

where g(x)g'(x) denotes the first derivative of g(x)g(x). Equivalently, denoting the first derivative of f(x)f(x) by f(x)f'(x), the rule can be written as:

f(x)g(x)dx=f(x)G(x)f(x)G(x)dx.\begin{equation} \int f(x) g(x) \,\textrm{d}x = f(x)G(x) - \int f'(x)G(x) \,\textrm{d}x . \end{equation}

One thing to keep in mind is that integration by parts needs to be applied wisely: integration by parts replaces the integral f(x)g(x)dx\int f(x) g(x) \,\textrm{d}x by the integral F(x)g(x)dx\int F(x)g'(x) \,\textrm{d}x, so when integrating by parts we want to make sure that the latter is simpler to solve than the former.

In other words, to use integration by parts, we need to be able to integrate ff and differentiate gg, or vice-versa, to get to an expression that is easier to work with.

Example

Let's say we would like to calculate the following integral:

xexdx\begin{equation} \int x e^x \,\textrm{d}x \end{equation}

Now we have a choice to make: do we integrate f(x)=xf(x)=x and differentiate g(x)=exg(x)=e^x, or vice-versa? Integrating f(x)=x2f(x)=x^2 introduces a quadratic term, so it looks more complicated. Conversely, differentiating f(x)=xf(x)=x removes xx from the second term of the integral, so that looks promising.

Let's work through the calculation. We start by looking at the derivatives and primitives involved:

f(x)=x    f(x)=1g(x)=ex    G(x)=exlne=ex.\begin{align} f(x)=x &\implies f'(x)=1 \\[3 ex] g(x)=e^x &\implies G(x)=\frac{e^x}{\ln e} = e^x. \end{align}

Applying equation (2), we can then write:

xexdx=xex1exdx=xexex+C=(x1)ex+C\begin{equation} \int x e^x \,\textrm{d}x = xe^x - \int 1e^x \,\textrm{d}x = xe^x - e^x + C = (x-1)e^x + C \end{equation}

And that's it! Now let's confirm this is actually correct by approximating the integral over the interval [0,4][0, 4] and comparing it with what we obtained analytically. To compute the definite integral based on the analytical solution, we need to apply the formula for the definite integral (which we covered earlier in this module), i.e.

abf(x)dx=F(b)F(a)\begin{equation} \int_a^b f(x)\,\textrm{d}x = F(b) - F(a) \end{equation}

As we can see, our analytical solution is pretty close to the approximation we get for small values of epsilon.