# How do you integrate (lnx)^2?

First, note that $\setminus \int \ln \left(x\right) \mathrm{dx}$ can be done by parts by letting $u = \ln \left(x\right) , \mathrm{dv} = \mathrm{dx}$ so that $\mathrm{du} = \frac{\mathrm{dx}}{x}$ and $v = x$, leading to $\setminus \int \ln \left(x\right) \mathrm{dx} = x \ln \left(x\right) - \setminus \int \mathrm{dx} = x \ln \left(x\right) - x + C$.
Now, for $\setminus \int {\left(\ln \left(x\right)\right)}^{2} \mathrm{dx}$, use integration-by-parts again with $u = \ln \left(x\right)$ and $\mathrm{dv} = \ln \left(x\right) \mathrm{dx}$ so that $\mathrm{du} = \frac{\mathrm{dx}}{x}$ and $v = x \ln \left(x\right) - x$. Then \int(\ln(x))^2 dx=x(ln(x))^2-x ln(x)-\int (ln(x)-1)dx= x(ln(x))^2-x ln(x)+x-(x ln(x)-x)
$= x {\left(\ln \left(x\right)\right)}^{2} - 2 x \ln \left(x\right) + 2 x + C$.