# Find the following integral: $\int {{{(\ln x)}^2}} dx$ by using the method of integration by parts

Find $\int {{{(\ln x)}^2}} dx$ by using the method of integration by parts.

My attempt:

\eqalign{ & \int {{{(\ln x)}^2}} dx = \int {2\ln x} dx \cr & u = \ln x,{\rm{ }}{{du} \over {dx}} = {1 \over x} \cr & {{dv} \over {dx}} = 2,{\rm{ }}v = 2x \cr & so: \cr & \int {{{(\ln x)}^2}} dx = 2x\ln x - \int {2x \times {1 \over x}} dx \cr & = 2x\ln x - 2x + C \cr}

This is the wrong answer, the right answer is: $$x{(\ln x)^2} - 2x\ln x + 2x + C$$

What have I missed?

-
$(\ln x)^{2} \neq 2 \ln x$. $\ln(x^{2}) = 2\ln x$ – Alex Wertheim May 10 '13 at 21:19
Oh.. I didn't realise this.. Thank you! – seeker May 10 '13 at 21:24

By integration by parts, $$\int (\ln(x))^2 dx = x (\ln(x))^2 - \int x d \left((\ln(x))^2\right)$$ $$\int x d \left((\ln(x))^2\right) = \int x \cdot 2 \ln(x) \dfrac{dx}x = 2\int \ln(x)dx$$ Now again by integration by parts, we have $$\int \ln(x)dx = \ln(x) \cdot x - \int x \cdot \dfrac{dx}x = x \ln(x) - x$$ Putting all this together, we get $$\int (\ln(x))^2 dx = x (\ln(x))^2-2x\ln(x) + 2x + \text{constant}$$

-

Hint: try $u = \ln x$ and $\frac{dv}{dx} = \ln x$. Then solve $dv = \ln x dx$ by integration by parts exactly as you have it above.

-
15 seconds separate the first three answers :-) – robjohn May 10 '13 at 21:25

\begin{align} \int\log(x)^2\,\mathrm{d}x &=x\log(x)^2-\int 2\log(x)\,\mathrm{d}x\tag{x and \log(x)^2}\\ &=x\log(x)^2-2x\log(x)+\int2\,\mathrm{d}x\tag{x and \log(x)}\\ &=x\log(x)^2-2x\log(x)+2x+C \end{align}

-

Hint: Apply partial integration (viz $\displaystyle u(x) v(x) = \int u(x) v'(x)\, \mathrm dx + \int u'(x) v(x) \,\mathrm dx$) to $u = \log x, v' = \log x$.

-

$$\int {{{(\log x)}^2}} dx$$ (To remind that $(\log x)^2\ne \log x^2; (\log x)^2=(\log x)\cdot(\log x)$ while $\log x^2=2\log x$) $$\int {{{(\log x)}.(\log x)}} dx$$ $$(\log x)\cdot\int {{(\log x)}} dx -\int [{d/dx(\log x)}{\int {\log x}dx} ]dx$$ since $$\int {\log x}dx=x\log x-x$$

so $$(\log x)\cdot(x\log x - x) -\int [\frac {1}{x}(x\log x - x)]dx$$ $$(\log x)\cdot(x\log x - x) -\int {(\log x - 1)} dx$$ $$x(\log x)^2 - x\log x -(x\log x - x)+x$$ $$x(\log x)^2 - 2x\log x +2x+C$$

-