Integration By Parts

Related Calculator: Integral (Antiderivative) Calculator with Steps

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

Formula for Integration by Parts. `int udv=uv-int vdu`.


Using 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`.

Which 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)` then `du=f'(x)dx` and `dv=g'(x)dx`, and above formula can be rewritten using Substitution Rule as `int udv=uv-int vdu` .

As can be seen Integration by Parts corresponds to the Product Rule (just like Substitution Rule corresponds to the Chain Rule).

In fact every differentiation rule has a corresponding integration rule, because these processes are 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 wrong choice will only complicate 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, but 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 obtained simpler integral, but still it is not obvious. Therefore, we apply integration by parts once more to 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=`

`=-xcos(x)+sin(x)+C` .

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 showed 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`.

Obtained integral is not simpler than original, 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 obtained initial integral! It seems that we obtained nothing because we arrived at `int e^xsin(x)dx` , which is where we started.

However, since `int e^x sin(x)dx=-e^xcos(x)+int e^xcos(x)dx` then

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

This can be regarded as 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 constant of integration yields final answer: `int e^xsin(x)dx=1/2 e^x(sin(x)-cos(x))+C`.

Example 5. Prove 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 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)` then `(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 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`.

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 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 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 then `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 have that `int_0^1 tan^(-1)(x)=pi/4-int_0^1 x/(x^2+1)dx=pi/4-1/2ln(2)`.