Home » Blog » Find the integral of (log x)2

Find the integral of (log x)2

Evaluate the following integral:

    \[ \int (\log x)^2 \, dx. \]


We use integration by parts, defining

    \begin{align*}  u &= (\log |x|)^2 & du &= \frac{2 \log x}{x} \, dx \\  dv &= dx & v &= x. \end{align*}

First, we recall that \int \log x \, dx was computed in Example 2 on p. 235 of Apostol which gave

    \[ \int \log x \, dx = x \log |x| - x + C. \]

Then we have,

    \begin{align*}  \int (\log x)^2 \, dx &= \int u \, dv \\  &= uv - \int v \, du \\  &= x (\log |x|)^2 - \int 2 \log x \, dx \\  &= x (\log |x|)^2 - 2(x \log |x| - x) + C \\  &= x (\log |x|)^2 - 2x \log |x| + 2x + C. \end{align*}

7 comments

  1. Artem says:

    Why does the answer put an absolute sign in the answer? I think there is a mistake in Apostol answers – the answer should be clearly in terms of log(x) instead of log|x|, since x>0 due to the way the problem is defined. \log^2(x) cannot accept negative x by default, only \log(|x|) can. Thus, the integration bounds have to be strictly positive. Also the derivation of Apostol on page 235 is in terms of x, not |x|.

  2. Nitesh Pandey says:

    Not satisfied by this solution please solve it in easy way that can be understood easily using formula
    ( “|” it willl be the sign of integration because there is no actual sign of integratio in mobile phones so please be understood)
    Formula:-
    u|vdx-(|du/dx |vdx) dx
    This formula is given in elements maths of 12th class.
    Thank You
    Nitesh Pandey

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):