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

$\int\sqrt{x}lnxdx$

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

In this problem

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

You use $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 $u=\ln x$ and $dv=\sqrt x\,dx$ then you'll get an easy integral, otherwise by putting $u=\sqrt x$ and $dv=\ln x\,dx$ is a bad choice since you need to wonder how to integrate $\ln x.$

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

3. Can you integrate $\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:

$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 $f'(x) = \sqrt{x}$ is because differentiating:
$g(x) = \ln x$
$g'(x) = \frac{1}{x}$
Which then gives a standard integration problem later:
$\int f'(x)g(x)$
$\int \frac{\sqrt{x}}{x}$
Which cancels and is 'nice' to integrate:
$\int \frac{1}{\sqrt{x}}$

For your second problem $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 $\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 $\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 $\ln x$ or $e^x$, leave $\ln x$ and $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 $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 $\ln x$ or $e^x$, leave $\ln x$ and $e^x$ as constants?
Not quite. A basic rule would be if one of you functions contained x e.g. $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:

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

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

12. Have you been told to use $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 $f'(x)= x \mbox{and} g(x) = \ln (x^2+1)$
and $f(x) = \frac{x^2}{2} \mbox{and} g'(x) = \frac{2x}{x^2+1}$
$

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

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

$= \frac{x^2 \ln(x^2+1)}{2} - \int \frac{x^3}{x^2+1} dx$
$= \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:
$u = x^2 +1$
$\frac{du}{dx} = 2x$
$\frac {1}{2} du = x dx$
$x^2 = u-1$

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

$= \frac{x^2 \ln(x^2+1)}{2} - \int \frac{1}{2} * \frac{u-1}{u} du$
$= \frac{x^2 \ln(x^2+1)}{2} - \frac{1}{2} \int (\frac{u}{u} - \frac {1}{u}) du$
$= \frac{x^2 \ln(x^2+1)}{2} - \frac{1}{2} \int (1 - \frac {1}{u}) du$
$= \frac{x^2 \ln(x^2+1)}{2} - \frac{1}{2} (u - \ln u)$
$= \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:

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

Why is f'(x) $\frac {x^2+1} {2}$? Why is it not $\frac {x^2} {2}$?
You have seen how it's done with the latter. Here is how it's done with the first suggestion:
\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 $\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.

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

In my solution book, it says

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

$\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$

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

I have no idea how they get $\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 $=\int \frac {\ln u} {u}du$.

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