# How do you find the integral (ln x)^2?

Jun 17, 2015

I found:
$\int {\left[\ln \left(x\right)\right]}^{2} \mathrm{dx} = x {\ln}^{2} \left(x\right) - 2 x \ln \left(x\right) + 2 x + c$

#### Explanation:

I would try using Substitution and By Parts (twice):

Jun 17, 2015

I get the same answer as Gio,
$\int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - 2 x \ln x + 2 x + C$

But the details of my solution are different.

#### Explanation:

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

Let $u = {\left(\ln x\right)}^{2}$ and $\mathrm{dv} = \mathrm{dx}$, so we have

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

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

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

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

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

Note
If you don't know $\int \ln x \mathrm{dx}$, use integration by parts with

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

General note
In general to integrate: $\int {x}^{r} \ln x \mathrm{dx}$ use $u = {x}^{r}$ and $\mathrm{dv} = \ln x$ -- unless $r = - 1$ in which case substitution $u = \ln x$ is easier.

Jun 18, 2015

$= \int \ln x \ln x \mathrm{dx}$

As funny as it sounds, I'm just going to do it like this. It's how I did it the first time I've seen this one. Let:
$u = \ln x$
$\mathrm{du} = \frac{1}{x} \mathrm{dx}$
$\mathrm{dv} = \ln x \mathrm{dx}$
$v = x \ln x - x$

To do $\int \ln x$:
Let:
$u = \ln x$
$\mathrm{dv} = 1 \mathrm{dx}$
$\mathrm{du} = \frac{1}{x} \mathrm{dx}$
$v = x$

$x \ln x - \int \frac{x}{x} \mathrm{dx} = x \ln x - x + C$

Anyways, continuing on:

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

$= x {\ln}^{2} x - x \ln x - \int \ln x - 1 \mathrm{dx}$

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

$= x {\ln}^{2} x - x \ln x - x \ln x + x + x + C$

$= x {\ln}^{2} x - 2 x \ln x + 2 x + C$

Cool, still got the same answer.