AP Calculus BC
Integral of (ln x)^2: Integration by Parts Twice
The integral of ln x squared, meaning ln x all squared, is x times ln x squared, minus 2x ln x, plus 2x, plus C. Integration by parts runs twice: u is (ln x) squared on the first pass and ln x on the second, and each pass removes one power of the logarithm.
Parts, then parts again
There is no second factor to hand, so take . With that gives and .
What is left is the standard logarithm integral, and it is a parts problem in its own right with and .
One power per pass
The structure generalises. Parts on with leaves , so the exponent drops by one every time and the process ends after passes. Knowing that in advance tells you how long the problem will take before you start it.
(ln x)^2 is not ln(x^2)
ln(x^2) equals 2 ln|x| by the power law for logarithms, so its integral is 2x ln|x| - 2x + C in a single line. The bars matter: ln(x^2) is defined for every x other than 0, while (ln x)^2 needs x > 0, and that wider domain is the deeper reason the two problems differ. The squared logarithm also needs two passes. One pair of brackets decides which problem you are solving.
The mistakes students make
Each of these ends in a clean looking expression, so checking by differentiation matters more than usual on this one.
- Reading as and answering , which is the integral of a different function.
- Reaching for the power rule and writing . Differentiating that gives , not .
- Multiplying the second term by but keeping its minus sign, finishing with . The multiplies both parts of , so the sign on the last term flips to positive.
Every answer on this page is machine checked
An automated test differentiates the antiderivative above and confirms it returns the integrand. A wrong sign or a missing factor fails the build, so it cannot reach you.
Frequently asked questions
What is the integral of ln^2 x?
It is , for .
Why does this need integration by parts twice?
The first pass converts into , and that integral is itself a parts problem. Each pass strips one power off the logarithm.
Is the integral of (ln x)^2 the same as the integral of ln(x^2)?
No. , whose integral is . The squared logarithm gives , and it is defined only for while is defined for every .