1. ## Integration by parts

How do I know which variable to use as f(x) first when I use the method of integration by parts? For example, in questions like

$\displaystyle \int\sqrt{x}lnxdx$

In this equation you use $\displaystyle \sqrt(x)$ as f prime of x

In this problem

$\displaystyle \int(x^3e^x)dx$

You use $\displaystyle e^x$ as the f prime of x

How do I know which one to use as f prime of x?

2. Originally Posted by chengbin

How do I know which variable to use as f(x) first when I use the method of integration by parts?
Because you always gotta get in your mind that you need an easy integral.

If you pick $\displaystyle u=\ln x$ and $\displaystyle dv=\sqrt x\,dx$ then you'll get an easy integral, otherwise by putting $\displaystyle u=\sqrt x$ and $\displaystyle dv=\ln x\,dx$ is a bad choice since you need to wonder how to integrate $\displaystyle \ln x.$

As for your second question, you obviously need to put $\displaystyle u=x^3$ since $\displaystyle du=3x^2\,dx,$ but you'll end up with another integral but this time with a low degree in the $\displaystyle x.$ If you put $\displaystyle u=e^x$ that won't work because you're gonna have $\displaystyle dv=x^3\,dx,$ so the degree of $\displaystyle x$ is gonna increase, no advantage then.

3. Can you integrate $\displaystyle \ln x$?

4. When choosing which of the two should be f'(x) you need to think about what outcome would be possible to integrate when it is used in the formula:

$\displaystyle f'(x)g(x)= f(x)g(x) - \int f(x)g'(x)$

Think about the possibilities and what would give you a single function which you can integrate in the final part of the equation.

*However it's not always possible to reach a fuction which can be easily integrated at this stage sometimes by parts needs to be applied more than once.*

Applying this to your first problem the reason for $\displaystyle f'(x) = \sqrt{x}$ is because differentiating:
$\displaystyle g(x) = \ln x$
$\displaystyle g'(x) = \frac{1}{x}$
Which then gives a standard integration problem later:
$\displaystyle \int f'(x)g(x)$
$\displaystyle \int \frac{\sqrt{x}}{x}$
Which cancels and is 'nice' to integrate:
$\displaystyle \int \frac{1}{\sqrt{x}}$

For your second problem $\displaystyle g(x) = x^3$ because if you apply parts more than once always using the same functions for g(x) and f(x) then your x in you g(x) will eventually disappear again leaving a standard problem.

Often the key to these questions is to look at which function should be g(x) rather than what should be f'(x) as ideally you want your g(x) to be left as a constant.

If you need further explanation just ask.

5. Originally Posted by chengbin

Can you integrate $\displaystyle \ln x$?
Yes, you can, but read my post carefully, besides, I edited it.

6. Originally Posted by chengbin
Can you integrate lnx?
Yes you can but when you are using by parts and there are two different functions where one is $\displaystyle \ln x$ integrating ln x will not help you find the answer.

7. Sorry for this stupid question, I just learned integration by parts yesterday. So basic rule, if a problem has $\displaystyle \ln x$ or $\displaystyle e^x$, leave $\displaystyle \ln x$ and $\displaystyle e^x$ as constants?

8. You can't leave them as constants, those are variables you are integrating on.

9. Originally Posted by Krizalid
You can't leave them as constants, those are variables you are integrating on.
No like leave them as $\displaystyle g(x)$

10. Originally Posted by chengbin
Sorry for this stupid question, I just learned integration by parts yesterday. So basic rule, if a problem has $\displaystyle \ln x$ or $\displaystyle e^x$, leave $\displaystyle \ln x$ and $\displaystyle e^x$ as constants?
Not quite. A basic rule would be if one of you functions contained x e.g. $\displaystyle x^2, 3x^5, x, etc$ that would be the one you differentiate. ln x would always be differentiated as it needs parts just to integrate itself.

It's not a stupid question it can be hard to recognise at first which function should be which but it's easy to spot with practice of different functions.

11. Another problem:

$\displaystyle \int x \ln (x^2+1)dx$

Why is f'(x) $\displaystyle \frac {x^2+1} {2}$? Why is it not $\displaystyle \frac {x^2} {2}$?

12. Have you been told to use $\displaystyle f'(x) = \frac{x^2+1}{2}$? I can't think of how that's possible I might be wrong but I don't think so.

I solved it by using parts then substitution.

Parts: using $\displaystyle f'(x)= x \mbox{and} g(x) = \ln (x^2+1)$
and $\displaystyle f(x) = \frac{x^2}{2} \mbox{and} g'(x) = \frac{2x}{x^2+1}$
$\displaystyle f'(x)g(x) = f(x)g(x) - \int g'(x)f(x) dx$
$\displaystyle = \ln(x^2+1) * \frac{x^2}{2} - \int \frac{2x}{x^2+1}* \frac{x^2}{2} dx$

$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \int \frac{x^3}{x^2+1} dx$
$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \int (\frac{x^2}{x^2+1} *x) dx$

I've split the fraction so I can now use substitution using:
$\displaystyle u = x^2 +1$
$\displaystyle \frac{du}{dx} = 2x$
$\displaystyle \frac {1}{2} du = x dx$
$\displaystyle x^2 = u-1$

$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \int (\frac{x^2}{x^2+1} *x) dx$
$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \int \frac{1}{2} * \frac{u-1}{u} du$
$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \frac{1}{2} \int (\frac{u}{u} - \frac {1}{u}) du$
$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \frac{1}{2} \int (1 - \frac {1}{u}) du$
$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \frac{1}{2} (u - \ln u)$
$\displaystyle = \frac{x^2 \ln(x^2+1)}{2} - \frac{1}{2} [x^2 +1 - \ln (x^2+1)] + c$

Hope this helps. It's a lot to take in.

13. Originally Posted by chengbin
Another problem:

$\displaystyle \int x \ln (x^2+1)dx$

Why is f'(x) $\displaystyle \frac {x^2+1} {2}$? Why is it not $\displaystyle \frac {x^2} {2}$?
You have seen how it's done with the latter. Here is how it's done with the first suggestion:
\displaystyle \begin{aligned} \int x \ln{(x^2+1)}~dx &= \int \left(\frac{x^2+1}{2}\right)' \ln{(x^2+1)}~dx \\ &= \frac{(x^2+1)\ln{(x^2+1)}}{2} - \frac{1}{2} \int \frac{2x(\rlap{///////}x^2+1)}{\rlap{//////}x^2+1}~dx \end{aligned}

Do you see why now?

Note that it's perfectly fine to use $\displaystyle \frac{x^2}{2}$ as f prime, but sometimes there are better and neater ways to approach an integral.

14. Thanks. I can't believe I didn't see that.

15. Sorry, another problem.

$\displaystyle \int\frac {x} {1+x^2} \ln \sqrt(1+x^2)dx$

In my solution book, it says

Letting $\displaystyle u=\sqrt(1+x^2)$, $\displaystyle du=\frac {x} {\sqrt(1+x^2)}dx$

$\displaystyle \int\frac {x} {1+x^2} \ln \sqrt(1+x^2)dx=\int \frac {1} {\sqrt(1+x^2)}*\frac {x} {\sqrt (1+x^2)} \ln \sqrt(1+x^2)dx$

$\displaystyle =\int \frac {\ln u} {u}du$

I have no idea how they get $\displaystyle \int\frac {x} {1+x^2} \ln \sqrt(1+x^2)dx=\int \frac {1} {\sqrt(1+x^2)}*\frac {x} {\sqrt (1+x^2)} \ln \sqrt(1+x^2)dx$ and $\displaystyle =\int \frac {\ln u} {u}du$.

EDIT: Oops, I forgot this is an integration by parts thread.