# When and how do I use integration by parts?

Integration by parts is used when you would like to find the integral of a composite function made up of two functions of the same variable as which you're integrating with respect to.

The formula for this technique is:

(Integral of f(x)g'(x)) = f(x)g(x) - (Integral of f'(x)g(x))

You will notice that we have labelled one of our functions in the expression that we want to integrate as f(x) and one as g'(x). Once we have decided which is which (more on that later) we differentiate f(x) to get f"(x) and integrate g'(x) to get g(x). We then have every component of the above formula and can plug in our values to get the answer.

There are a few things to note, however. The first thing to note is that we can make life much easier for ourselves by deciding carefully which function to label as f(x) and which to label as g'(x).

The thing to keep in mind here is that, if you look at the formula, the solution involves another integration: the integral of f'(x)g(x), so ideally we want this to be a simple integral that can be solved without the need for integration by parts. So, for example, if we have a composite function of xe^{-2x}, it is in our best interest to pick f(x)=x and g'(x)=e^{-2x}, this is because when we differentiate f(x) in this case we are left with f"(x)=1 simplifying our integral of f"(x)g(x) to just the integral of g(x). Note that it is never a good idea to make an exponential of euler's number f(x) because it will never disappear under differentiation.

Sadly it is not always possible to integrate a composite function using only one iteration of integration by parts. For example if we had a composite function of x^{2}e^{-2x} we would be left with the integral of f"(x)g(x) being equal to 2xe^{-2x }which would need to be integrated by parts again.