# Find the integral $\int \frac{(\ln(x))^2}{x^3}$

$$\int \frac{(\ln(x))^2}{x^3}$$

Starting off with Integration by Parts \begin{align} u = \ln(x)^2 &~~~ dv = x^{-3} \\\\ du = 2\ln(x)dx &~~~ v = \frac{x^{-2}}{-2} \end{align}

\begin{align} \int \frac{(\ln(x))^2}{x^3} &= (\ln(x))^2 \left( \frac{-x^{-2}}{2} \right) -\frac{2}{2} \int \frac{\ln(x)}{x^2} \end{align}

Integration by parts again... \begin{align} u = \ln(x) & dv = \frac{1}{x^2} \\\\ du = \frac{1}{x}dx & v = -\frac{1}{x} \\\\ -\frac{2}{2} \int \frac{\ln(x)}{x^2} &= -\ln(x) \left(\frac{1}{x} \right) + \int \frac{1}{x^2}dx \\\\ \end{align}

Integration by parts several times $$\int \frac{1}{x^2}dx \rightarrow \int \frac{1}{x} \rightarrow \ln(x) + C$$

Combining everything together, I get

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

Is there a shorter way I could have done this? I think I got the right answer, but I am not really sure either. Checking my answer via differentiate doesn't seem like a feasible test strategy and even without time constraints still seems too complex for my level right now (but then maybe this is why I need the practice)

• I don't think it's too complex for your level based on your work. You will sometimes have to do repeated integration by parts. – User203940 Feb 26 at 21:58

Starting off with Integration by Parts \begin{align} u = \ln(x)^2 &~~~ dv = x^{-3} \\\\ \color{red}{du = \frac{2\ln(x)}{x}dx} &~~~ v = -\frac{x^{-2}}{2} \end{align}

(Don't forget chain rule!)

\begin{align} \int \frac{(\ln(x))^2}{x^3} &= (\ln(x))^2 \left( \frac{-x^{-2}}{2} \right) \color{red}{+\int \frac{\ln(x)}{x^3}dx} \end{align}

(Notice that integration by parts is $$uv - \int vdu$$)

Now we want to figure out $$\int \frac{\ln(x)}{x^3}dx$$ Let $$u = \ln(x), \ \ dv = \frac{dx}{x^3},$$ $$du = \frac{1}{x}dx, \ \ v = -\frac{x^{-2}}{2}.$$ Then we have

$$\int \frac{\ln(x)}{x^3}dx = -\frac{x^{-2}}{2} \ln(x) + \frac{1}{2}\int\frac{1}{x^3}dx.$$

Now $$\int \frac{1}{x^3}dx = -\frac{x^{-2}}{2} + C,$$ so putting it all back together we have $$-\frac{\ln(x)^2}{2x^2} - \frac{\ln(x)}{2x^2} - \frac{1}{4x^2} + C.$$

• Maple confirms this answer as well. – User203940 Feb 26 at 21:57
• ah, ALL of my work was messed up because I didn't take the chain rule properly of $\ln(x)^2$ :( That is a painful mistake – Evan Kim Feb 27 at 14:51

Let's prove by induction $$\displaystyle I_p(n)=\int\dfrac{\ln(x)^n}{x^p}\mathop{dx}=\dfrac{P_n(\ln(x))}{x^{p-1}}$$ where $$P_n$$ is a polynomial of degree $$n$$.

We will assume in the following $$p>1$$, so we can carry on integration by parts.

$$\displaystyle I_p(0)=\int \dfrac{\mathop{dx}}{x^p}=\dfrac{1-p}{x^{p-1}}$$ thus $$P_0(x)=1-p$$ is a polynomial of degree $$0$$

$$\displaystyle I_p(n+1)=\int\dfrac{\ln(x)^{n+1}}{x^p}\mathop{dx}=\left[\ln(x)^{n+1}\times\dfrac{1-p}{x^{p-1}}\right]-\int \dfrac{(n+1)\ln(x)^n}{x}\dfrac {1-p}{x^{p-1}}\mathop{dx}=\alpha\dfrac{\ln(x)^{n+1}}{x^{p-1}}+\beta I_p(n)$$

By induction hypothesis $$P_{n+1}(x)=\alpha x^{n+1}+\beta P_n(x)$$ is a polynomial of degree $$n+1$$ and the induction is verified.

Of course we could have calculated the exact coefficients, but it makes it harder to remember the formula. In fact we were just interested in the general form of the result.

In our case we have $$\displaystyle I_3(2)=\int\dfrac{\ln(x)^2}{x^3}\mathop{dx}=\dfrac{a\ln(x)^2+b\ln(x)+c}{x^2}$$

Derivate it and identify the coefficients : $$x^3\times {I_3}'(2)=-2a\ln(x)^2-(2b-2a)\ln(x)-(2c-b)\iff\begin{cases}-2a=1\\2b-2a=0\\2c-b=0\end{cases}\iff \begin{cases}a=-\frac 12\\b=-\frac 12\\c=-\frac 14\end{cases}$$

\begin{align} \int \frac{(\ln(x))^2}{x^3}dx & = \bigg((\ln(x))^2\times \frac{x^{-2}}{-2}\bigg)-\int\frac{2\ln(x)}{x}\times \frac{x^{-2}}{-2}dx \\ & =\bigg((\ln(x))^2\times \frac{x^{-2}}{-2}\bigg)+\int \ln(x)\times x^{-3}dx \\ & =\bigg((\ln(x))^2\times \frac{x^{-2}}{-2}\bigg)+\bigg(\ln(x)\times \frac{x^{-2}}{-2}\bigg)-\int\frac{1}{x}\times\frac{x^{-2}}{-2}dx \\ & =\bigg((\ln(x))^2\times \frac{x^{-2}}{-2}\bigg)+\bigg(\ln(x)\times \frac{x^{-2}}{-2}\bigg)+\frac{1}{2}\bigg(\frac{x^{-2}}{-2}\bigg)+C \\ & =\bigg(\frac{x^{-2}}{-2}\bigg)\bigg((\ln(x))^2+\ln(x)+\frac{1}{2}\bigg)+C \end{align}

• Of the many other answers showing the same method, I find yours pretty and clean showing essential steps while not being too verbose. +1. – zwim Feb 26 at 22:48

When doing integration by parts, I recommend using this little, trusty formula (the order whether $$f(x)$$ or $$g(x)$$ comes first does not matter):

$$\int f(x)g'(x)\,dx=f(x)g(x)-\int f'(x)g(x)\,dx.$$

\begin{align} \int\frac{\ln^2{x}}{x^3}\,dx &=-\frac{1}{2}\int\ln^2{x}\left(\frac{1}{x^2}\right)'\,dx\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}}{x^2}-\int\frac{1}{x^2}(\ln^2{x})'\,dx\right)\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}}{x^2}-2\int\frac{\ln{x}}{x^3}\,dx\right)\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}}{x^2}-\frac{2}{-2}\int\ln{x}\left(\frac{1}{x^2}\right)'\,dx\right)\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}}{x^2}+\frac{\ln{x}}{x^2}-\int\frac{1}{x^2}(\ln{x})'\,dx\right)\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}+\ln{x}}{x^2}-\int\frac{1}{x^3}\,dx\right)\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}+\ln{x}}{x^2}-\int x^{-3}\,dx\right)\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}+\ln{x}}{x^2}-\frac{1}{-3+1}x^{-3+1}\right)\\ &=-\frac{1}{2}\left(\frac{\ln^2{x}+\ln{x}}{x^2}+\frac{1}{2x^2}\right)\\ &=-\frac{1}{2}\left(\frac{2\ln^2{x}+2\ln{x}}{2x^2}+\frac{1}{2x^2}\right)\\ &=-\frac{2\ln^2{x}+2\ln{x}+1}{4x^2}+C. \end{align}

Wolfram Alpha check

$$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$$ $$\left\{\begin{array}{rcl} \ds{\int{x^{\nu} \over x^{3}}\,\dd x} & \ds{=} & \ds{x^{\nu - 2} \over \nu - 2} \\[3mm] \ds{\int{x^{\nu}\ln\pars{x} \over x^{3}}\,\dd x} & \ds{=} & \ds{-\,{x^{\nu - 2} \over \pars{\nu - 2}^{2}} + {x^{\nu - 2}\ln\pars{x} \over \nu - 2}} \\[3mm] \ds{\int{x^{\nu}\ln^{2}\pars{x} \over x^{3}}\,\dd x} & \ds{=} & \ds{{2x^{\nu - 2} \over \pars{\nu - 2}^{3}} - {2x^{\nu - 2}\ln\pars{x} \over \pars{\nu - 2}^{2}} + {x^{\nu - 2}\ln^{2}\pars{x} \over \nu - 2}} \end{array}\right.$$

$$\ds{\nu \to 0 \implies \int{\ln^{2}\pars{x} \over x^{3}}\,\dd x = \bbx{-\,{1 + 2\ln\pars{x} + 2\ln^{2}\pars{x} \over 4x^{2}} + \mbox{a constant}}}$$