Class 12 Maths, Worked in Full Past papersGet updates
Chapter 7 · Integrals

Example 18: ∫log⁡x dx\int\log x\,dx

ExamplesIntegration by parts · Section 7.6
The question

Find

∫log⁡x dx\int\log x\,dx
Exam answer

Let I=∫log⁡x dx=∫(log⁡x)⋅1 dxI = \displaystyle\int\log x\,dx = \int(\log x)\cdot 1\,dx⁠.

Taking log⁡x\log x as the first function and 11 as the second, by parts:

I=(log⁡x)⋅x−∫1x⋅x dx=xlog⁡x−∫1 dx\begin{aligned} I &= (\log x)\cdot x - \int\frac1x\cdot x\,dx \\ &= x\log x - \int 1\,dx \end{aligned}

∴ I=xlog⁡x−x+C\therefore\ I = x\log x - x + C⁠.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

There is no "product" in sight, but we can always write log⁡x=log⁡x⋅1\log x = \log x\cdot 1⁠. We do not know a function whose derivative is log⁡x\log x⁠, but we do know the derivative of log⁡x\log x⁠: it is 1x\frac1x⁠, which is much simpler. So integration by parts with log⁡x\log x as the first function (to be differentiated) and the constant 11 as the second (to be integrated, giving xx⁠) turns the problem into ∫1x⋅x dx=∫1 dx\int\frac1x\cdot x\,dx = \int 1\,dx⁠.

Given, to find, and the plan
Given
log⁡x\log x (the natural logarithm), defined only for x>0x > 0⁠.
To find
∫log⁡x dx\int\log x\,dx⁠.
Plan
(1) Write log⁡x=log⁡x⋅1\log x = \log x\cdot 1 and choose the functions. (2) Apply integration by parts. (3) Differentiate back.

Basics you need

1Integration by parts

With ff the first function and gg the second (Section 7.6):

∫f g dx=f∫g dx−∫[f′∫g dx]dx.\begin{aligned} \int f\,g\,dx &= f\int g\,dx \\ &\quad - \int\Big[f'\int g\,dx\Big]dx. \end{aligned}

Lesson: integration by parts

2The derivative of the logarithm

ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x for x>0x > 0⁠. Here log⁡\log is the natural logarithm, base ee⁠. Basics: logarithms and 1/x

3The integral of a constant

∫1 dx=x+C\int 1\,dx = x + C (standard formula (i) with n=0n = 0⁠). Basics: powers of x

Solution

  1. Write log⁡x\log x as a product and choose the functions

    Write log⁡x=(log⁡x)⋅1\log x = (\log x)\cdot 1 and take

    f(x)=log⁡x  (first),g(x)=1  (second).f(x) = \log x \ \ (\text{first}), \qquad g(x) = 1 \ \ (\text{second}).

    Then f′(x)=1xf'(x) = \frac1x and ∫g(x) dx=∫1 dx=x\int g(x)\,dx = \int 1\,dx = x⁠.

    We cannot take log⁡x\log x as the second function, because that would require ∫log⁡x dx\int\log x\,dx⁠, which is what we are trying to find. As the first function it only needs to be differentiated, and its derivative 1x\frac1x is simple. This matches the book's Remark (iii): a logarithmic function is taken as the first function.
    ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x⁠, x>0x > 0⁠. Basics: logarithms and 1/x
  2. Apply integration by parts

    ∫(log⁡x⋅1) dx=log⁡x∫1 dx−∫[ddx(log⁡x)∫1 dx]dx=(log⁡x)⋅x−∫1x⋅x dx=xlog⁡x−∫1 dx=xlog⁡x−x+C.\begin{aligned} &\int(\log x\cdot 1)\,dx \\ &= \log x\int 1\,dx - \int\Big[\frac{d}{dx}(\log x)\int 1\,dx\Big]dx \\ &= (\log x)\cdot x - \int\frac1x\cdot x\,dx \\ &= x\log x - \int 1\,dx \\ &= x\log x - x + C. \end{aligned}
    The product 1x⋅x\frac1x\cdot x is just 1 (for x>0x > 0⁠, so x≠0x \ne 0⁠), and ∫1 dx=x\int 1\,dx = x⁠. The new integral is trivial, which is the sign of a good choice.
    1x⋅x=1\frac1x\cdot x = 1 for x≠0x \ne 0⁠; ∫dx=x+C\int dx = x + C⁠. Lesson: integration by parts
  3. Check: differentiate the answer

    By the product rule, ddx(xlog⁡x)=1⋅log⁡x+x⋅1x\frac{d}{dx}(x\log x) = 1\cdot\log x + x\cdot\frac1x⁠, which is log⁡x+1\log x + 1⁠. So

    ddx(xlog⁡x−x)=log⁡x+1−1=log⁡x.\frac{d}{dx}(x\log x - x) = \log x + 1 - 1 = \log x.
    The derivative is the integrand for every x>0x > 0⁠, so the answer is right. (The answer can also be written x(log⁡x−1)+Cx(\log x - 1) + C⁠.)
Result ∫log⁡x dx=xlog⁡x−x+C,x>0.\int\log x\,dx = x\log x - x + C, \qquad x > 0.

This is the book's answer.

Check it with numbers

At a point. At x=2x = 2⁠: the integrand is log⁡2≈0.6931472\log 2 \approx 0.6931472⁠; the derivative of our answer is log⁡2+1−1\log 2 + 1 - 1⁠, the same.

Over an interval. On [1,e][1, e]⁠:

F(e)−F(1)=(e⋅1−e)−(1⋅0−1)=1.F(e) - F(1) = (e\cdot 1 - e) - (1\cdot 0 - 1) = 1.

Numerical integration of log⁡x\log x over [1,e][1, e] gives 1.0000000000…1.0000000000\ldots⁠, the same.

Common mistakes
  1. Guessing ∫log⁡x dx=1x\int\log x\,dx = \frac1x⁠. That is the derivative, not the integral.
  2. Making log⁡x\log x the second function. That needs ∫log⁡x dx\int\log x\,dx⁠, the very thing we want.
  3. Forgetting the domain. log⁡x\log x and the answer are defined only for x>0x > 0⁠.
What to take away
  1. A single function whose derivative is simple can be integrated by parts with 1 as the second function.
  2. ∫log⁡x dx=xlog⁡x−x+C\int\log x\,dx = x\log x - x + C is worth remembering.
  3. The same trick works for ∫tan⁡−1x dx\int\tan^{-1}x\,dx (Exercise 7.6, Q13) and ∫sin⁡−1x dx\int\sin^{-1}x\,dx⁠.

Every fact used, and where it comes from

FactUsed inSource
Integration by partsSteps 1, 2Section 7.6 (Lesson: integration by parts)
Logarithmic function as the first functionStep 1Remark (iii) after Example 17, Section 7.6
ddxlog⁡x=1x\frac{d}{dx}\log x = \frac1x⁠, x>0x > 0Steps 1, 3Chapter 5, Section 5.4
∫dx=x+C\int dx = x + CStep 2Standard formula (i), Section 7.2
Product ruleStep 3Chapter 5, Section 5.3
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →