Integration of lnx Squared

In this tutorial we shall find the integral of {\left( {\ln x} \right)^2} function, and it is another important integration. To evaluate this integral first we use the method of substitution and then we use integration by parts.

The integral of \ln x squared is of the form

I = \int {{{\left( {\ln x} \right)}^2}dx} \,\,\,\,{\text{ - - - }}\left( {\text{i}} \right)

But z = \ln x implies that {e^z} = x, by differentiation {e^z}dz = dx, so the given integral (i) takes the form

I = \int {{{\left( {\ln x} \right)}^2}dx} = \int {{z^2}{e^z}dz}

Considering {z^2} and {e^z} are the first and second functions and using integration by parts, we have

I = \int {{z^2}{e^z}dz} \,\,\,\,{\text{ - - - }}\left( {{\text{ii}}} \right)

Using the formula for integration by parts, we have

\int {\left[ {f\left( x \right)g\left( x \right)} \right]dx = f\left( x \right)\int {g\left( x \right)dx - \int {\left[ {\frac{d}{{dx}}f\left( x \right)\int {g\left( x \right)dx} } \right]dx} } }

Using the formula above, equation (ii) becomes

\begin{gathered} I = {z^2}\int {{e^z}dz - \int {\left[ {\frac{d}{{dz}}{z^2}\left( {\int {{e^z}dz} } \right)} \right]} dz} \\ \Rightarrow I = {z^2}{e^z} - \int {\left[ {2z{e^z}} \right]} dz \\ \Rightarrow I = {z^2}{e^z} - 2\int {z{e^z}} dz \\ \end{gathered}

Now again using integration by parts, we have

\begin{gathered} I = {z^2}{e^z} - 2\left[ {z\int {{e^z}dz - \int {\left( {\frac{d}{{dz}}z\left( {\int {{e^z}dz} } \right)} \right)dz} } } \right] \\ \Rightarrow I = {z^2}{e^z} - 2z{e^z} + 2\int {{e^z}dz} \\ \Rightarrow I = {z^2}{e^z} - 2z{e^z} + 2{e^z} + c \\ \end{gathered}

From the above substitution it can be written in the form

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