# How do I find the integral int(ln(x))^2dx ?

Jul 31, 2014

Our objective is to reduce the power of $\ln x$ so that the integral is easier to evaluate.

We can accomplish this by using integration by parts. Keep in mind the IBP formula:

$\int u \mathrm{dv} = u v - \int v \mathrm{du}$

Now, we will let $u = {\left(\ln x\right)}^{2}$, and $\mathrm{dv} = \mathrm{dx}$.

Therefore,

$\mathrm{du} = \frac{2 \ln x}{x} \mathrm{dx}$

and

$v = x$.

Now, assembling the pieces together, we get:

$\int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - \int \frac{2 x \ln x}{x} \mathrm{dx}$

This new integral looks a lot better! Simplifying a bit, and bringing the constant out front, yields:

$\int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - 2 \int \ln x \mathrm{dx}$

Now, to get rid of this next integral, we will do a second integration by parts, letting $u = \ln x$ and $\mathrm{dv} = \mathrm{dx}$.

Thus, $\mathrm{du} = \frac{1}{x} \mathrm{dx}$ and $v = x$.

Assembling gives us:

$\int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - 2 \left(x \ln x - \int \frac{x}{x} \mathrm{dx}\right)$

Now, all that's left to do is simplify, keeping in mind to add the constant of integration:

$\int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - 2 x \ln x + 2 x + C$

And there we have it. Remember, integration by parts is all about picking $u$ so that messy things get eliminated from the integrand. In this case we brought ${\left(\ln x\right)}^{2}$ down to $\ln x$, and then down to $\frac{1}{x}$. In the end, some $x$'s canceled off, and it became easier to integrate.