practicecalculus
Exponential and log integrals

Integral of ln x: Formula, Steps and Examples

The integral of ln x is x ln x − x + C. See the integration by parts steps, a check by differentiating, a graph and examples like ln(2x) and (ln x)².

Exponential and log integrals Updated 3 min read

At a glance

\int \ln x\,dx = x\ln x - x + C
Antiderivative
x\ln x - x + C
Method
Integration by parts with u = \ln x, dv = dx
From 1 to e
1
From 0 to 1
-1 (improper, converges)
Base-b log
\int \log_b x\,dx = \frac{x\ln x - x}{\ln b} + C
On this page
  1. Graph of ln x and its antiderivative
  2. How to integrate ln x step by step
  3. Check by differentiating
  4. Definite integrals
  5. Worked examples
  6. Common mistakes

The integral of \ln x is x\ln x - x + C. There is no reverse rule that undoes the log directly, so the standard method is integration by parts with a hidden factor of 1.

\int \ln x\,dx = x\ln x - x + C

Graph of ln x and its antiderivative

y = ln x and its antiderivative x ln x − x
The shaded area from 1 to e is exactly 1. The dashed antiderivative has its minimum at x = 1, where \ln x changes from negative to positive.

How to integrate ln x step by step

Use integration by parts, \int u\,dv = uv - \int v\,du.

  1. Write \ln x as a product. \int\ln x\,dx = \int \ln x\cdot 1\,dx.
  2. Choose the parts. u = \ln x and dv = dx. Then du = \frac{1}{x}\,dx and v = x.
  3. Apply the formula. \int \ln x\,dx = x\ln x - \int x\cdot\frac{1}{x}\,dx = x\ln x - \int 1\,dx
  4. Finish. \int 1\,dx = x, so the answer is x\ln x - x + C.

Why does this work? Differentiating \ln x turns it into \frac{1}{x}, which cancels the x from v. In the LIATE order, logs come first, so they almost always play the role of u. The integration by parts guide has more on choosing u.

Check by differentiating

By the product rule and the derivative of ln x:

\frac{d}{dx}\left(x\ln x - x\right) = \ln x + x\cdot\frac{1}{x} - 1 = \ln x + 1 - 1 = \ln x

Definite integrals

From 1 to e:

\int_1^e\ln x\,dx = (e\cdot 1 - e) - (1\cdot 0 - 1) = 0 + 1 = 1

From 1 to 2: (2\ln 2 - 2) - (0 - 1) = 2\ln 2 - 1 \approx 0.386.

From 0 to 1: this is an improper integral since \ln x \to -\infty near 0. Using the limit x\ln x \to 0 as x \to 0^+:

\int_0^1 \ln x\,dx = (0 - 1) - \lim_{a\to 0^+}(a\ln a - a) = -1

The answer is negative because \ln x < 0 on (0, 1), so the area lies below the axis.

Worked examples

Example 1: a constant inside. \int\ln(2x)\,dx. Let u = 2x, dx = \frac{du}{2}:

\frac{1}{2}(u\ln u - u) + C = x\ln(2x) - x + C

Example 2: a shifted log. \int\ln(x+1)\,dx. Let u = x + 1, du = dx:

(x+1)\ln(x+1) - (x+1) + C

The -1 can be absorbed into C, so (x+1)\ln(x+1) - x + C is also correct.

Example 3: a squared log. \int(\ln x)^2\,dx. Take u = (\ln x)^2, dv = dx, so du = \frac{2\ln x}{x}\,dx and v = x:

\int(\ln x)^2\,dx = x(\ln x)^2 - 2\int\ln x\,dx = x(\ln x)^2 - 2x\ln x + 2x + C

Example 4: a power of x inside. \int\ln(x^3)\,dx = 3\int\ln x\,dx = 3x\ln x - 3x + C, after the log rule \ln(x^3) = 3\ln x.

Example 5: base 10. Since \log_{10}x = \frac{\ln x}{\ln 10}, \int\log_{10}x\,dx = \frac{x\ln x - x}{\ln 10} + C.

Common mistakes

  1. Answering \frac{1}{x}. That is the derivative of \ln x. The integral of \frac{1}{x} is \ln\lvert x\rvert; see the integral of 1/x.
  2. Choosing u = 1, dv = \ln x\,dx. Then you need \int\ln x\,dx to find v, the very thing you are trying to compute.
  3. Losing the -x. x\ln x alone has derivative \ln x + 1, one too many.
  4. Confusing \ln x with \frac{\ln x}{x}. \int\frac{\ln x}{x}\,dx = \frac{(\ln x)^2}{2} + C is a u-substitution, not a parts problem.

For a log times a power of x, see the integral of x ln x. For logs in the denominator, see the integral of 1/(x ln x).

Practice it now

Integration by parts

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is the integral of ln x?

It is x\ln x - x + C, for x > 0.

What is the integral of ln(2x)?

It is x\ln(2x) - x + C. Since \ln(2x) = \ln 2 + \ln x, you can also integrate the pieces and get x\ln 2 + x\ln x - x + C, which is the same thing.

What is the integral of (ln x)²?

It is x(\ln x)^2 - 2x\ln x + 2x + C. Use parts with u = (\ln x)^2, dv = dx, then use the integral of \ln x for the leftover piece.

What is the integral of ln x from 0 to 1?

It is -1. It is improper because \ln x \to -\infty at 0, but x\ln x \to 0, so the integral is (0 - 1) - 0 = -1.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.