# Integration by Parts

Integration by Parts is a special method of integration that is often useful when two functions are multiplied together, but is also helpful in other ways.

You will see plenty of examples soon, but first let us see the rule:

∫u v dx = u∫v dx −∫u' (∫v dx) dx

**u**is the function u(x)**v**is the function v(x)

As a diagram:

And let us get straight into an example:

### Example: What is ∫x cos(x) dx ?

First choose u and v:

- u = x
- v = cos(x)

Differentiate u: u' = x' = 1

Integrate v: ∫v dx = ∫cos(x) dx = sin(x)

Now put it together:

Simplify and solve:

So we followed these steps:

- Choose u and v
- Differentiate u: u'
- Integrate v: ∫v dx
- Put u, u' and ∫v dx here:
**u∫v dx −∫u' (∫v dx) dx** - Simplify and solve

In English, to help you remember, **∫u v dx** becomes:

(u integral v) minus integral of (derivative u, integral v)

Let's try some more examples:

### Example: What is ∫ln(x)/x^{2} dx ?

First choose u and v:

- u = ln(x)
- v = 1/x
^{2}

Differentiate u: ln(x)' = 1/x

Integrate v: ∫1/x^{2} dx = ∫x^{-2} dx = −x^{-1} = -1/x (by the power rule)

Now put it together:

Simplify:

^{2}dx = −ln(x)/x − 1/x + C

### Example: What is ∫ln(x) dx ?

But there is only one function! How do we choose u and v ?

Hey! We can just choose v as being "1":

- u = ln(x)
- v = 1

Differentiate u: ln(x)' = 1/x

Integrate v: ∫1 dx = x

Now put it together:

Simplify:

^{}dx = x ln(x) − x + C

### Example: What is ∫e^{x} x dx ?

Choose u and v:

- u = e
^{x} - v = x

Differentiate u: (e^{x})' = e^{x}

Integrate v: ∫x dx = x^{2}/2

Now put it together:

Well, that was a spectacular disaster! It just got more complicated.

Maybe we could choose a different u and v?

### Example: ∫e^{x} x dx (continued)

Choose u and v differently:

- u = x
- v = e
^{x}

Differentiate u: (x^{})' = 1^{}

Integrate v: ∫e^{x} dx = e^{x}

Now put it together:

Simplify:

^{x}− e

^{x}+ C

^{x}(x−1) + C

The moral of the story: Choose **u** and **v** carefully!

Choose a **u** that gets simpler when you differentiate it and a **v** that doesn't get any more complicated when you integrate it.

But here is one last (and tricky) example:

### Example: ∫e^{x} sin(x) dx

Choose u and v:

- u = sin(x)
- v = e
^{x}

Differentiate u: sin(x^{})' = cos(x)^{}

Integrate v: ∫e^{x} dx = e^{x}

Now put it together:

^{x}sin(x) dx = sin(x) e

^{x}-∫cos(x) e

^{x}dx

Looks worse, but let us persist! We can use integration by parts **again**:

Choose u and v:

- u = cos(x)
- v = e
^{x}

Differentiate u: cos(x^{})' = -sin(x)^{}

Integrate v: ∫e^{x} dx = e^{x}

Now put it together:

^{x}sin(x) dx = sin(x) e

^{x}- (cos(x) e

^{x}−∫−sin(x) e

^{x}dx)

Simplify:

^{x}sin(x) dx = e

^{x}sin(x) - e

^{x}cos(x) −∫ e

^{x}sin(x)dx

Now we have the same integral on both sides (except one is subtracted) ...

... so bring the right hand one over to the left and we get:

^{x}sin(x) dx = e

^{x}sin(x) − e

^{x}cos(x)

Simplify:

^{x}sin(x) dx = e

^{x}(sin(x) - cos(x)) / 2 + C

## Where Did "Integration by Parts" Come From?

It is based on the Product Rule for Derivatives:

Integrate both sides and rearrange:

Some people prefer that last form, but I like to integrate v' so the left side is simple: