# What is the integral of xln^2(x+3)?

Jun 6, 2016

I got

$\frac{{x}^{2} - 9}{2} {\ln}^{2} \left(x + 3\right) - \frac{1}{2} \left(x - 9\right) \left(x + 3\right) \ln \left(x + 3\right) + \frac{1}{4} \left(x + 3\right) \left(x - 21\right) + C$

Whenever $\ln$ is in an integral, you should consider trying integration by parts to see where that gets you.

For $\int u \mathrm{dv}$, what we have is:

$\setminus m a t h b f \left(\int u \mathrm{dv} = u v - \int v \mathrm{du}\right)$

So the strategy here is to choose one term that is easier to differentiate, like ${\ln}^{2} \left(x + 3\right)$, and one term that is easier to antidifferentiate, like $x$.

FIRST INTEGRATION BY PARTS

Let:
$u = {\left(\ln \left(x + 3\right)\right)}^{2} \to \mathrm{du} = \frac{2 \ln \left(x + 3\right)}{x + 3} \mathrm{dx}$
$\mathrm{dv} = x \mathrm{dx} \to v = {x}^{2} / 2$

$\implies {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \int \frac{{x}^{2} \ln \left(x + 3\right)}{x + 3} \mathrm{dx}$

Now, you see how there's $\ln \left(x + 3\right)$ and $\frac{1}{x + 3}$? We can do another substitution. This is going to feel a bit pointless, but it'll give us a way out of this by allowing us to divide.

SOME U SUBSTITUTION

Let $u = x + 3$. Then, $\mathrm{du} = \mathrm{dx}$ and ${x}^{2} = {\left(u - 3\right)}^{2} = {u}^{2} - 6 u + 9$.

So, what we now have is:

$\implies {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \int \frac{{\left(u - 3\right)}^{2} \ln u}{u} \mathrm{du}$

$\implies {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \int \frac{\left({u}^{2} - 6 u + 9\right) \ln u}{u} \mathrm{du}$

$\implies {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \int \frac{{u}^{2} \ln u - 6 u \ln u + 9 \ln u}{u} \mathrm{du}$

$\implies {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \int u \ln u - 6 \ln u + \frac{9 \ln u}{u} \mathrm{du}$

SECOND INTEGRATION BY PARTS

The first integral is done by three different integration by parts, but fairly straightforward ones.

For $\int s \mathrm{dt}$, we have $\setminus m a t h b f \left(\int s \mathrm{dt} = s t - \int t \mathrm{ds}\right)$. So...

For $\int u \ln u \mathrm{du}$, let:
$s = \ln u \to \mathrm{ds} = \frac{1}{u} \mathrm{du}$
$\mathrm{dt} = u \mathrm{du} \to t = {u}^{2} / 2$

$\implies {u}^{2} / 2 \ln u - \int \frac{u}{2} \mathrm{du} = {u}^{2} / 2 \ln u - {u}^{2} / 4$

THIRD INTEGRATION BY PARTS

For $6 \int \ln u \mathrm{du}$, let:
$s = \ln u \to \mathrm{ds} = \frac{1}{u} \mathrm{du}$
$\mathrm{dt} = \mathrm{du} \to t = u$

$\implies u \ln u - \int \frac{u}{u} \mathrm{du} = u \ln u - u$

FOURTH INTEGRATION BY PARTS

For $9 \int \ln \frac{u}{u} \mathrm{du}$, let $s = \ln u$ and $\mathrm{ds} = \frac{1}{u} \mathrm{du}$. Then:

$\implies 9 \int s \mathrm{ds} = \frac{9}{2} {s}^{2} = \frac{9}{2} {\ln}^{2} u$

PUTTING IT ALL TOGETHER

So, for our overall integral, we currently have:

$\implies {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \left[\int u \ln u \mathrm{du} - \int 6 \ln u \mathrm{du} + \int \frac{9 \ln u}{u} \mathrm{du}\right]$

$= {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \left[\left({u}^{2} / 2 \ln u - {u}^{2} / 4\right) - 6 \left(u \ln u - u\right) + \frac{9}{2} {\ln}^{2} u\right]$

Make sure you catch those parentheses!

$= {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \left[{u}^{2} / 2 \ln u - {u}^{2} / 4 - 6 u \ln u + 6 u + \frac{9}{2} {\ln}^{2} u\right]$

$= {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - {u}^{2} / 2 \ln u + {u}^{2} / 4 + 6 u \ln u - 6 u - \frac{9}{2} {\ln}^{2} u$

But since $u = x + 3$, we now have:

$= {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - {\left(x + 3\right)}^{2} / 2 \ln \left(x + 3\right) + {\left(x + 3\right)}^{2} / 4 + 6 \left(x + 3\right) \ln \left(x + 3\right) - 6 \left(x + 3\right) - \frac{9}{2} {\ln}^{2} \left(x + 3\right)$

Regroup terms together:

$= {x}^{2} / 2 {\ln}^{2} \left(x + 3\right) - \frac{9}{2} {\ln}^{2} \left(x + 3\right) + 6 \left(x + 3\right) \ln \left(x + 3\right) - {\left(x + 3\right)}^{2} / 2 \ln \left(x + 3\right) + {\left(x + 3\right)}^{2} / 4 - 6 \left(x + 3\right)$

$= \left({x}^{2} / 2 - \frac{9}{2}\right) {\ln}^{2} \left(x + 3\right) + \left(- {\left(x + 3\right)}^{2} / 2 + 6 x + 18\right) \ln \left(x + 3\right) + {\left(x + 3\right)}^{2} / 4 - 6 \left(x + 3\right) + C$

Yeah, I think I'll stop here.

If you wanted to work to simplify this some more, you can get this eventually through some expansion and re-factoring:

$= \textcolor{b l u e}{\frac{{x}^{2} - 9}{2} {\ln}^{2} \left(x + 3\right) - \frac{1}{2} \left(x - 9\right) \left(x + 3\right) \ln \left(x + 3\right) + \frac{1}{4} \left(x + 3\right) \left(x - 21\right) + C}$

Turns out that this was right!