Integration by Parts

Related Calculator: Integral (Antiderivative) Calculator with Steps

It is easy to compute the integral `int e^xdx`, but how to handle integrals like `int xe^xdx`?
In general, if you have under the integral sign a product of functions that can be easily integrated separately, you should use integration by parts.

Formula for integration by parts: `int udv=uv-int vdu`.


Using the product rule, we have that `(f(x)g(x))'=f'(x)g(x)+f(x)g'(x)`.

Integrating both sides gives: `int (f(x)g(x))'dx=int (f'(x)g(x)+f(x)g'(x))dx`.

This can be rewritten as `f(x)g(x)=int f'(x)g(x)dx+int f(x)g'(x)dx` or `int f(x)g'(x)dx=f(x)g(x)-int f'(x)g(x)dx`.

If we take `u=f(x)` and `v=g(x)`, we have that `du=f'(x)dx` and `dv=g'(x)dx`, and the above formula can be rewritten using the substitution rule as `int udv=uv-int vdu`.

As can be seen, integration by parts corresponds to the product rule (just like the substitution rule corresponds to the chain rule).

In fact, every differentiation rule has a corresponding integration rule, because these processes are the inverse of each other.

Example 1 . Evaluate `int xe^xdx`.

Let `u=x` and `dv=e^xdx`. Then, `du=(x)'dx=dx`, and `v=int e^xdx=e^x`.

So, `int xe^xdx=int overbrace (x)^u overbrace (e^xdx)^(dv)=overbrace (x)^u overbrace (e^x)^v-int overbrace (e^x)^v overbrace(dx)^(du)=xe^x-e^x+C`.

Note that it is very important to choose appropriate `u` and `v`, because a wrong choice will only complicate the integral.

For example, assume that, instead of choosing `u=x` and `dv=e^xdx` in the above example, we choose `u=e^x` and `v=xdx`. Then, `du=(e^x)'dx=e^xdx`, and `v=int xdx=x^2/2`.

So, `int xe^xdx=int overbrace (e^x)^u overbrace (xdx)^(dv)=overbrace (e^x)^u overbrace (1/2 x^2)^v-int overbrace (1/2 x^2)^v overbrace(e^xdx)^(du)`.

Although this equation is true, the integral `int 1/2 x^2 e^xdx` is more difficult to evaluate than the integral we started with.

Example 2 . Evaluate `int x^2 cos(x)dx`.

Notice that `x^2` becomes simpler when differentiated. Therefore, let `u=x^2` and `dv=cos(x)dx`. Then, `du=(x^2)'dx=2xdx`, and `v=int cos(x)dx=sin(x)`.

So, `int x^2cos(x)dx=x^2sin(x)-int 2xsin(x)dx=x^2sin(x)-2int xsin(x)dx`.

We've obtained a simpler integral, but still it is not obvious. Therefore, we apply integration by parts once more to the integral `int xsin(x)dx`:

let `u=x` and `dv=sin(x)dx`; then, `du=(x)'dx=dx`, and `v=int sin(x)dx=-cos(x)`.

So, `int overbrace (x)^u overbrace (sin(x)dx)^(dv)=overbrace (x)^u overbrace (-cos(x))^v-int overbrace (-cos(x))^(v) overbrace (dx)^(du)=-xcos(x)+int cos(x)dx=`


Finally, `int x^2 cos(x)dx=x^2sin(x)-2int xsin(x)dx=x^2sin(x)-2(-xcos(x)+sin(x)+C)=`

`=x^2sin(x)+2xcos(x)-2sin(x)+C_1` where `C_1=-2C`.

Example 2 shows that in some cases we need to apply integration by parts more than once.

Example 3 . Evaluate `int ln(x)dx`.

Here, there is only one choice for `u` and `v`, namely `u=ln(x)` and `dv=dx`; so,`du=(ln(x))'dx=1/x dx`, and `v=int dx=x`.

Therefore, `int overbrace (ln(x))^u overbrace (dx)^(dv)=overbrace (ln(x))^u overbrace (x)^v-int overbrace (x)^v overbrace (1/xdx)^(du)=`

`=xln(x)-int dx=xln(x)-x+C`.

Example 4. Evaluate `int e^xsin(x)dx`.

Neither `e^x` nor `sin(x)` become simpler when differentiated, but we try choosing `u=e^x` and `v=sin(x)dx`.

Then, `du=(e^x)'dx=e^xdx`, and `v=int sin(x)dx=-cos(x)dx`.

Therefore, `int e^x sin(x)dx=-e^xcos(x)-int -cos(x)e^xdx=-e^xcos(x)+int e^xcos(x)dx`.

The integral obtained is not simpler than the original one, but it is not more difficult either. So, we apply integration by parts once more: let `u=e^x` and `dv=cos(x)dx`; then, `du=(e^x)'dx=e^xdx`, and `v=int cos(x)dx=sin(x)`.

So, `int e^xcos(x)dx=e^xsin(x)-int e^xsin(x)dx`.

We've obtained the initial integral! It seems that we obtained nothing because we've arrived at `int e^xsin(x)dx`, which is where we had started.

However, since `int e^x sin(x)dx=-e^xcos(x)+int e^xcos(x)dx`, it can be stated that

`int e^x sin(x)dx=-e^xcos(x)+(e^x sin(x)-int e^xsin(x)dx)`.

This can be regarded as an equation with the unknown variable `int e^x sin(x)dx`.

This equation can be rewritten as `2int e^xsin(x)dx=e^x(sin(x)-cos(x))`.

Dividing by 2 and adding the constant of integration yields the final answer: `int e^xsin(x)dx=1/2 e^x(sin(x)-cos(x))+C`.

Example 5. Prove the reduction formula.`int sin^n(x)dx=-1/n cos(x)sin^(n-1)(x)+(n-1)/n int sin^(n-2)(x)dx`, where `n>=2` is an integer.

Let `u=sin^(n-1)(x)` and `dv=sin(x)dx`; then,`du=(sin^(n-1))'dx=(n-1)sin^(n-2)(x)(sin(x))'dx=(n-1)sin^(n-2)(x)cos(x)dx`, and `v=int sin(x)dx=-cos(x)`.

So, `int sin^n(x)dx=int sin^(n-1)sin(x)dx=-cos(x)sin^(n-1)(x)-int cos(x)(n-1)sin^(n-2)(x)cos(x)dx=`

`=-cos(x)sin^(n-1)(x)+(n-1) int sin^(n-2)(x) cos^2(x)dx`.

Since `cos^2(x)=1-sin^2(x)`, it can be stated that`(n-1)int sin^(n-2)(x)cos^2(x)dx=(n-1)int sin^(n-2)(x)(1-sin^2(x))dx=`

`=(n-1)int sin^(n-2)(x)dx-(n-1)int sin^(n-2)sin^2(x)dx=`

`=(n-1)int sin^(n-2)(x)dx-(n-1)int sin^n(x)dx`.


`int sin^n(x)dx=-cos(x)sin^(n-1)(x)+(n-1)int sin^(n-2)(x)dx-(n-1) int sin^n(x)dx`.

This is an equation with an unknown variable `int sin^n(x)dx`.

It can be rewritten as `n int sin^n(x)dx=-cos(x)sin^(n-1)(x)+(n-1)int sin^(n-2)(x)dx`.

So, finally, we have that `int sin^n(x)dx=-1/n cos(x)sin^(n-1)(x)+(n-1)/n int sin^(n-2)(x)dx`.

The last question in this section is how to calculate definite integrals with the help of integration by parts. In fact, it is very easy: just combine integration by parts with the Newton-Leibniz formula: `int_a^b udv=uv|_a^b-int_a^b vdu`.

Example 6. Calculate `int_0^1 tan^(-1)(x)dx`.

Let `u=tan^(-1)(x)` and `dv=dx`; then, `du=(tan^(-1)(x))'dx=1/(x^2+1)dx`, and `v=int dx=x`.

So, `int_0^1 tan^(-1)(x)dx=xtan^(-1)(x)|_0^1-int_0^1 x/(x^2+1)dx=`

`=(1*tan^(-1)(1)-0*tan^(-1)(0))-int_0^1 x/(x^2+1)dx=pi/4-int_0^1 x/(x^2+1)dx`.

To calculate `int_0^1 x/(x^2+1)dx`, we use the substitution rule: let `t=x^2+1`; then,`dt=(x^2+1)'dx=2xdx`, or `xdx=1/2 dt`.

Since `x` is changing from 0 to 1, it can be stated that `t` is changing from `2*0=0` to `2*1=2`.

So, `int_0^1 x/(x^2+1)dx=int_1^2 1/t 1/2 dt=1/2 [ln|t|]_1^2=1/2(ln(2)-ln(1))=`

`=1/2(ln(2)-0)=1/2 ln(2)`.

Finally, we can see that `int_0^1 tan^(-1)(x)=pi/4-int_0^1 x/(x^2+1)dx=pi/4-1/2ln(2)`.