Integration of lnx Squared

In this tutorial we shall find integral of {\left( {\ln x} \right)^2} function, it is also an important integration, to evaluate this integral first use method of substitution then 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)

Put 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} as first and second functions and integration by parts, we have.

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

Using 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} } }

Equation (ii) becomes using above formula, we have

\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, we get

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