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.