# Taking out exponent on logarithm in definite integral producing different answers

I was trying to find the following indefinite integral: $$\int \frac{\ln(x)^2}{x}\,dx$$ Using u-substitution, I was getting two different answers based on if I took the exponent on the natural log out of the integral:

Taking it out $$2 \int \frac{\ln(x)}{x}\,dx$$ $$u=\ln(x)$$ $$du=\frac{1}{x}\,dx$$ $$\Rightarrow 2\int u \, du=2\,\Big(\frac{u^2}{2}\Big)+c$$ $$\boldsymbol{=2\ln(x)+c}$$

Not taken out $$\int \frac{\ln(x)^2}{x}\,dx=\int u^2\,du=\frac{1}{3}\,u^3+c$$ $$=\boldsymbol{\ln(x)+c}$$

Cannot quite figure out why I'm getting two different answers. Maybe it has to do with something I haven't yet learnt in class. Any insight would be appreciated.

• please note $(\ln(x))^2$ is not the same as $\ln(x^2)=2\ln (x)$. I haven't read carefully but this could certainly be the source of your error Dec 10, 2017 at 3:01
• Ah I see. That was my mistake. Thank you for you answer! Dec 10, 2017 at 3:02
• The solution is $\dfrac{ln(x)^3}{3}$.
– QFi
Dec 10, 2017 at 3:06
• the integrals you are computing are not definite Dec 10, 2017 at 3:15

Both are wrong. The first fails because $\ln(x)^2 \neq 2 \ln(x)$. Then when you backsubstituted you lost the square on $u$. The second fails because you lost the square of the log. You put it back in in the $\int u^2$, but then when you backsubstituted you lost the cube. $u^3=(\ln (x))^3$ The correct answer is $\frac 13(\ln(x))^3+c$
$$\int \Big(\! \ln x\Big)^2 \left( \frac {dx} x \right) = \int u^2 \, du.$$ $$\text{Note that } \ln(x^2) = 2\ln x \text{ but } \left( \ln x\right)^2 \ne 2\ln x.$$