# How do you evaluate the integral of (ln x)^2 dx?

May 21, 2015

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

To integrate ${\left(\ln x\right)}^{2}$, let $x = {e}^{y}$ so that $\mathrm{dx} = {e}^{y} \mathrm{dy}$

$\int {\left(\ln x\right)}^{2} \mathrm{dx} = \int {y}^{2} {e}^{y} \mathrm{dy}$. Now integrate by parts,

${y}^{2} {e}^{y} - \int 2 y {e}^{y} \mathrm{dy}$. Now again integrate by parts,

${y}^{2} {e}^{y} - 2 \left[y {e}^{y} - \int {e}^{y} \mathrm{dy}\right]$

${y}^{2} {e}^{y} - 2 y {e}^{y} + 2 {e}^{y}$ +C

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

May 21, 2015

bp has one great solution Method 1. There are other solutions:

Both of the solution presented below use Integration by Parts.
I use the form:

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

Both of the solution presented below use $\int \ln x \mathrm{dx} = x \ln x - x + C$, which can be done by integration by parts. (And, of course, verified by differentiating the answer.)

Method 2

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

Let $u = {\left(\ln x\right)}^{2}$ and $\mathrm{dv} = \mathrm{dx}$.

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

Integration by parts gives us:

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

$\textcolor{w h i t e}{\text{sssssss}}$ $= x {\left(\ln x\right)}^{2} - 2 \left(x \ln x - x\right) + C$

$\textcolor{w h i t e}{\text{sssssss}}$ $= x {\left(\ln x\right)}^{2} - 2 x \ln x + 2 x + C$

Method 3

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

Let $u = \ln x$ and $\mathrm{dv} = \ln x \mathrm{dx}$

So, $\mathrm{du} = \frac{1}{x} \mathrm{dx}$ and $v = x \ln x - x$

The parts formula gives us:

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

$\textcolor{w h i t e}{\text{sssssss}}$ $= x {\left(\ln x\right)}^{2} - x \ln x - \int \left(\textcolor{red}{\ln x} - \textcolor{g r e e n}{1}\right) \mathrm{dx}$

$\textcolor{w h i t e}{\text{sssssss}}$ $= x {\left(\ln x\right)}^{2} - x \ln x - \left(\textcolor{red}{x \ln x - x} - \textcolor{g r e e n}{x}\right) + C$

$\textcolor{w h i t e}{\text{sssssss}}$ $= x {\left(\ln x\right)}^{2} - 2 x \ln x + 2 x + C$