# How do you integrate (ln x)^2 dx?

May 22, 2016

Use integration by parts twice to find that

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

#### Explanation:

We will proceed using integration by parts :

Integration by parts (i):

Let $u = {\ln}^{2} \left(x\right)$ and $\mathrm{dv} = \mathrm{dx}$
Then $\mathrm{du} = 2 \ln \frac{x}{x} \mathrm{dx}$ and $v = x$

Applying the integration by parts formula $\int u \mathrm{dv} = u v - \int v \mathrm{du}$

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

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

Integration by parts (ii):

Focusing on the remaining integral, let $u = \ln \left(x\right)$ and $\mathrm{dv} = \mathrm{dx}$
Then $\mathrm{du} = \frac{1}{x} \mathrm{dx}$ and $v = x$

Applying the formula:

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

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

$= x \ln \left(x\right) - x + C$

Substituting this back into $\text{(1)}$:

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

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