# How do you integrate int (lnx)^2 by integration by parts method?

Oct 10, 2016

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

#### Explanation:

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

Integration by parts takes the form: $\int u \mathrm{dv} = u v - \int v \mathrm{du}$

So, for the given integral, let:

$\left\{\begin{matrix}u = {\left(\ln x\right)}^{2} \text{ "=>" "du=(2lnx)/xdx \\ dv=dx" "=>" } v = x\end{matrix}\right.$

Plugging these into the integration by parts formula, this becomes:

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

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

To solve this integral, we will reapply integration by parts:

$\left\{\begin{matrix}u = \ln x \text{ "=>" "du=1/xdx \\ dv=dx" "=>" } v = x\end{matrix}\right.$

Thus, this becomes:

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

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

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

Oct 10, 2016

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

#### Explanation:

Remember the formula for IBP: $\int u \frac{\mathrm{dv}}{\mathrm{dx}} \mathrm{dx} = u v - \int v \frac{\mathrm{du}}{\mathrm{dx}} \mathrm{dx}$

Let $u = \ln x \implies \frac{\mathrm{du}}{\mathrm{dx}} = \frac{1}{x}$
Let $\frac{\mathrm{dv}}{\mathrm{dx}} = \ln x \implies v = \int \ln \mathrm{dx} = x \ln x - x$ (see additional notes)

Substitute into the IBP equation:
$\int \left(\ln x\right) \left(\ln x\right) \mathrm{dx} = \left(\ln x\right) \left(x \ln x - x\right) - \int \left(x \ln x - x\right) \frac{1}{x} \mathrm{dx}$
$\therefore \int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - x \ln x - \int \left(\ln x - 1\right) \mathrm{dx}$
$\therefore \int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - x \ln x - \left(x \ln x - x - x\right) + c$
$\therefore \int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - x \ln x - x \ln x + 2 x + c$
$\therefore \int {\left(\ln x\right)}^{2} \mathrm{dx} = x {\left(\ln x\right)}^{2} - 2 x \ln x + 2 x + c$

How do you find $\int \ln \mathrm{dx} = x \ln x - x$. Firstly its is extremely helpful to learn this result, but if you can't or you need to prove it then you need to use IBP again:
Let $u = \ln x \implies \frac{\mathrm{du}}{\mathrm{dx}} = \frac{1}{x}$
Let $\frac{\mathrm{dv}}{\mathrm{dx}} = 1 \implies v = x$
$\int \left(\ln x\right) \left(1\right) \mathrm{dx} = \left(\ln x\right) \left(x\right) - \int \left(x \cdot \frac{1}{x}\right) \mathrm{dx}$
$\therefore \int \ln x \mathrm{dx} = x \ln x - \int \left(1\right) \mathrm{dx}$
$\therefore \int \ln x \mathrm{dx} = x \ln x - x$ $\left(+ c\right)$