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

Dec 9, 2016

$I = c - \frac{{\left(\ln x\right)}^{2} + 2 \ln x + 2}{x}$

#### Explanation:

We have

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

If $z = \ln x$ then $\mathrm{dz} = \frac{\mathrm{dx}}{x}$ and

$z = \ln x$ so ${e}^{z} = x$

$I = \int {z}^{2} {e}^{- z} \mathrm{dz}$

Integrating by parts

$u = {z}^{2}$ so $\mathrm{du} = 2 z \mathrm{dz}$
$\mathrm{dv} = {e}^{- z} \mathrm{dz}$ so $v = - {e}^{- z}$

$I = u \cdot v - \int v \mathrm{du}$
$I = - {z}^{2} {e}^{- z} + 2 \int z {e}^{- z} \mathrm{dz}$

Integrating by parts once again

$u = z$ so $\mathrm{du} = \mathrm{dz}$
$\mathrm{dv} = {e}^{- z} \mathrm{dz}$ so $v = - {e}^{- z}$

$I = - {z}^{2} {e}^{- z} + 2 \left(- z {e}^{- z} + \int {e}^{- z} \mathrm{dz}\right)$
$I = - {z}^{2} {e}^{- z} - 2 z {e}^{- z} - 2 {e}^{- z} + c$
$I = - {e}^{- z} \left({z}^{2} + 2 z + 2\right) + c$

But we want to have an answer in terms of $x$ so if we remember that $z = \ln \left(x\right)$ we'll have

$I = - {e}^{- \ln \left(x\right)} \left({\left(\ln x\right)}^{2} + 2 \ln x + 2\right) + c$
$I = c - \frac{{\left(\ln x\right)}^{2} + 2 \ln x + 2}{x}$