Integrals

Integral of ln(x): x ln x − x + C (Integration by Parts)

Integral of ln(x): x ln x − x + C (Integration by Parts)

The integral of ln(x) is x ln x − x + C. You can evaluate it using integration by parts. Set u = ln x and dv = dx. Differentiating u gives du = (1/x) dx. Also, integrating dv gives v = x. This transforms the original integral into x ln x − ∫ 1 dx.

The natural logarithm function does not appear on basic antiderivative tables. Therefore, finding its antiderivative requires a standard technique. Below, you will find the full step-by-step derivation. Also, it includes proof by differentiation and geometric interpretation. You will also see definite integral evaluations, common variant formulas, and practice problems with full solutions.

How do you derive the integral of ln(x) step by step?

You cannot directly integrate ln x using a standard power rule or basic table entry. However, its derivative, 1/x, is an algebraic term. This term is easy to simplify. That property makes it an ideal candidate for integration by parts. This technique uses the following formula:

∫ u dv = u v − ∫ v du

You can rewrite ln x as the product ln x · 1. This is the key step. Next, set up the parts as follows:

  • Set u = ln x, which gives du = (1/x) dx by differentiation.
  • Set dv = 1 dx, or simply dx. As a result, v = x by integration.

Substitute these expressions into the integration by parts formula:

∫ ln x dx = (ln x)(x) − ∫ x · (1/x) dx

Simplify the integrand in the remaining integral. Since x · (1/x) = 1 for all x > 0, the equation reduces to:

∫ ln x dx = x ln x − ∫ 1 dx

Evaluating ∫ 1 dx gives x, so adding the constant of integration yields the final result:

∫ ln x dx = x ln x − x + C

This derivation relies on the standard LIATE guideline. You use LIATE (Logarithmic, Inverse trigonometric, Algebraic, Trigonometric, Exponential) to choose u in integration by parts. Logarithmic functions have the top priority for u. This is because differentiating a logarithm converts it into a simple algebraic fraction. As a result, it eliminates the logarithm completely.

How to verify the antiderivative by differentiation

You can confirm that x ln x − x + C is correct by taking its derivative with respect to x. Apply the product rule to the first term, x ln x:

Integral of ln x: Handwritten math calculations on paper with a calculator and pencil

d/dx [x ln x] = (d/dx [x]) · ln x + x · (d/dx [ln x]). This equals 1 · ln x + x · (1/x). So, the result is ln x + 1.

Next, differentiate the remaining terms. The derivative of −x is −1. Also, the derivative of the constant C is 0. Combining these results yields:

d/dx [x ln x − x + C] = (ln x + 1) − 1 + 0 = ln x

The result matches the original integrand. The antiderivative has a -x term. This term is essential. It cancels out the +1 produced when you apply the product rule to x ln x.

Comparing integration methods for log functions

Different logarithmic integrals need different calculus strategies. Selecting the right method upfront saves time. Also, it prevents algebraic errors.

Method Best Used For Setup Choice Primary Advantage Key Limitation
Integration by Parts ∫ ln x dx and polynomial products like ∫ xⁿ ln x dx u = ln x and dv = xⁿ dx (or dv = dx) Eliminates the logarithm by converting it into 1/x Requires evaluating a second integral after substitution
u-substitution Integrals containing 1/x explicitly, like ∫ (ln x)/x dx u = ln x and du = (1/x) dx Converts the integral into a basic polynomial power rule Fails if 1/x is missing from the integrand
Inverse Function Method Geometric proofs and visual derivations for inverse functions ∫ f(x) dx = x f(x) − ∫ f⁻¹(y) dy with f⁻¹(y) = eʸ Provides clear visual intuition of bounded region areas Less direct for routine symbolic computation

Why does the formula work geometrically?

The natural log function is y = ln x. Also, the exponential function is x = eʸ. These functions represent the same curve in the coordinate plane. Consider an upper bound b > 1. Now, visualize the rectangle bounded by (0, 0), (b, 0), (b, ln b), and (0, ln b). This bounding rectangle has a total area. You can calculate it as base × height = b ln b.

The curve splits this rectangle into two distinct regions:

  • Next, the area under y = ln x from x = 1 to x = b, which is the integral ∫₁ᵇ ln x dx.
  • The area to the curve’s left runs from y = 0 to y = ln b. You can calculate this as ∫₀ˡⁿ ᵇ eʸ dy. This equals [eʸ]₀ˡⁿ ᵇ. Therefore, the result is eˡⁿ ᵇ − e⁰, which simplifies to b − 1.

Subtracting the left-side area from the total rectangle area isolates the area under the natural log curve:

∫₁ᵇ ln x dx = b ln b − (b − 1) = b ln b − b + 1

You can evaluate the antiderivative expression [x ln x − x]₁ᵇ. This calculation gives (b ln b − b) − (1 ln 1 − 1). As a result, you get b ln b − b + 1. This result matches the geometric calculation. This inverse relationship explains the strategy. You use the same dv = dx integration by parts strategy to solve functions like arctan x and arcsin x.

Step-by-step definite integrals with ln(x)

1. Definite integral from 1 to e

Evaluate the antiderivative between the bounds 1 and e:

∫₁ᵉ ln x dx = [x ln x − x]₁ᵉ. Therefore, you get (e ln e − e) − (1 ln 1 − 1).

Since ln e = 1 and ln 1 = 0:

∫₁ᵉ ln x dx = (e(1) − e) − (0 − 1) = (e − e) − (−1) = 1

2. Definite integral from 0 to 1

The integral ∫₀¹ ln x dx is an improper integral. This is because ln x approaches negative infinity. It does this as x approaches 0 from the right. So, express the lower bound as a limit.

\(∫₀¹ \ln x dx = \lim_{a → 0⁺} [x \ln x − x]ₐ¹ = (1 \ln 1 − 1) − \lim_{a → 0⁺} (a \ln a − a)\)

You can evaluate lim_{a → 0⁺} a ln a. First, rewrite it as lim_{a → 0⁺} (ln a) / (1/a). Then, apply L’Hôpital’s rule.

\(\lim_{a → 0⁺} (1/a) / (−1/a²) = \lim_{a → 0⁺} (−a) = 0\)

Substituting 0 back into the limit gives (0 − 1) − (0 − 0). This equals −1. So, the area equals 1 square unit. It lies entirely beneath the x-axis.

3. Definite integral from 1 to 2

Evaluate the antiderivative between 1 and 2:

∫₁² ln x dx = [x ln x − x]₁² = (2 ln 2 − 2) − (1 ln 1 − 1) = 2 ln 2 − 2 − (−1) = 2 ln 2 − 1

Decimal value: 2(0.6931) − 1 ≈ 0.3863.

4. Average value on [1, e]

The average value of ln x over the interval [1, e] is the definite integral divided by the interval length (e − 1):

Average value = (1 / (e − 1)) ∫₁ᵉ ln x dx = 1 / (e − 1) ≈ 0.582

Common variations of log integrals and how to solve them

Constant factor inside the log: ∫ ln(ax) dx

You can use logarithm rules to split ln(2x). This gives you ln 2 + ln x. Then you can integrate. Alternatively, apply integration by parts directly. Set u = ln(2x) and dv = dx. This makes du = (2/2x) dx = (1/x) dx, and v = x.

Constant factor inside the log: ∫ ln(ax) dx

∫ ln(2x) dx = x ln(2x) − x + C

Shifted log argument: ∫ ln(x + 1) dx

First, set u = ln(x + 1) and dv = dx. You can choose v = x + 1. You do not have to use v = x. Remember, you can add constants to v in integration by parts. Then, du = (1/(x + 1)) dx. This yields the following:

∫ ln(x + 1) dx = (x + 1) ln(x + 1) − ∫ (x + 1) · (1/(x + 1)) dx = (x + 1) ln(x + 1) − x + C

Polynomial times logarithm: ∫ xⁿ ln x dx

For ∫ x ln x dx, choose u = ln x and dv = x dx. Differentiating gives du = (1/x) dx and integrating gives v = x²/2:

∫ x ln x dx = (x²/2) ln x − ∫ (x²/2)(1/x) dx = (x²/2) ln x − x²/4 + C

In general, for any power n ≠ −1:

∫ xⁿ ln x dx = (xⁿ⁺¹ / (n + 1)) ln x − (xⁿ⁺¹ / (n + 1)²) + C

Logarithm squared: ∫ (ln x)² dx

Evaluating ∫ (ln x)² dx requires integration by parts twice. For the first pass, set u = (ln x)² and dv = dx. By the chain rule, du = 2 ln x · (1/x) dx, and v = x:

∫ (ln x)² dx = x (ln x)² − ∫ x · (2 ln x / x) dx. As a result, this becomes x (ln x)² − 2 ∫ ln x dx.

Substitute the known integral of ln x into the remaining term:

∫ (ln x)² dx = x (ln x)² − 2 (x ln x − x) + C. Therefore, the final result is x (ln x)² − 2x ln x + 2x + C.

Each additional power of the logarithm adds another round of integration by parts, creating an alternating sign pattern. For cubed logarithms:

∫ (ln x)³ dx = x (ln x)³ − 3x (ln x)² + 6x ln x − 6x + C

Logarithm divided by x²: ∫ (ln x) / x² dx

First, set u = ln x and dv = x⁻² dx. This gives you du = (1/x) dx. Also, you get v = −1/x.

∫ (ln x) / x² dx = − (ln x) / x − ∫ (−1/x)(1/x) dx. This simplifies to − (ln x) / x + ∫ x⁻² dx. So, you get − (ln x) / x − 1/x + C.

Logarithm divided by x: ∫ (ln x) / x dx

Do not use integration by parts for this problem. Because 1/x is the derivative of ln x, use u-substitution with u = ln x and du = (1/x) dx:

∫ (ln x) / x dx = ∫ u du = u² / 2 + C = (ln x)² / 2 + C

Domain restrictions, negative values, and change of base

The natural logarithm function ln x is defined only for real numbers x > 0. However, calculus uses absolute value notation. This happens when you evaluate logarithmic expressions over negative domains. Therefore, you write it as ln|x|.

For any non-zero x, the general antiderivative is:

∫ ln|x| dx = x ln|x| − x + C

To verify this for negative values (x < 0), note that |x| = −x. Differentiating x ln(−x) − x gives (1 · ln(−x) + x · (−1/−x)) − 1 = ln(−x) + 1 − 1 = ln(−x) = ln|x|.

For logarithmic functions with base a (where a > 0 and a ≠ 1), use the change-of-base identity logₐ x = (ln x) / (ln a):

∫ logₐ x dx = (1 / ln a) ∫ ln x dx = (x ln x − x) / ln a + C

For common logarithms (base 10), divide the natural log result by ln 10:

∫ log₁₀ x dx = (x ln x − x) / ln 10 + C

Common mistakes and how to fix them

  • Writing 1/x as the answer: 1/x is the derivative of ln x, not its integral. Remind yourself that integration increases functional complexity for logarithms.
  • Forgetting the −x term: Writing only x ln x is incomplete because d/dx [x ln x] = ln x + 1. The −x term is mandatory to cancel the extra +1.
  • Choosing u = 1 and dv = ln x dx: Setting up parts this way is circular. Finding v requires you to already know the antiderivative of ln x. Therefore, always set u = ln x and dv = dx.
  • Plugging in x = 0 directly: Because ln(0) is undefined, you must take a limit. Evaluating definite integrals with a bound at 0 requires taking a limit. For example, lim_{a → 0⁺} a ln a = 0.
  • Using integration by parts on (ln x)/x: Attempting parts when 1/x is present adds unnecessary steps. Use substitution when 1/x is a factor, and save parts for (ln x)/x² or standalone ln x.

Practical applications of log integration

Logarithmic integration is used in mathematics, physical sciences, and data theory:

Green illuminated audio power level meters displaying logarithmic decibel scales
  • Stirling’s approximation for factorials: The sum ln(n!) = ln 1 + ln 2 + … + ln n. You can approximate this sum with a continuous Riemann sum integral. This integral is ∫₁ⁿ ln x dx = n ln n − n + 1. For large n, this yields Stirling’s formula: ln(n!) ≈ n ln n − n.
  • Entropy calculations: Continuous entropy models use this integral. They appear in thermodynamics and information theory. These models integrate probability densities against their logarithms. They use expressions like −∫ p(x) ln p(x) dx.
  • Calculus relationships: This integral connects directly with the derivative of ln x. Also, it relates to the integral of 1/x. These connections span multi-variable and differential calculus.

Try it yourself

Step-by-step solverExact symbolic engine

Interactive Calculus Problem Solver

Derivatives, antiderivatives, definite and improper integrals, and limits. Every answer comes with the rules used, and antiderivatives are verified by differentiating them back.

Try:
Input syntax
  • Powers x^2, roots sqrt(x), cbrt(x), absolute value |x|
  • Implicit multiplication works: 3x sin(2x)
  • sin cos tan sec csc cot, asin acos atan, sinh cosh tanh
  • e^x or exp(x); ln(x) is the natural log. In this solver log(x) also means the natural log (the usual calculus convention); type log10(x) for base 10
  • Constants pi and e; bounds accept inf and -inf
Enter a function and press Solve to see a full worked solution.

The integral calculator shows the integration by parts steps for any of the variations above.

Practice problems with step-by-step solutions

Work through these problems to test your understanding, then check the complete solutions below.

A calculator and pen on grid paper
  1. Evaluate ∫ ln(3x) dx
  2. Also, Evaluate ∫₁ᵉ² ln x dx
  3. Evaluate ∫ x² ln x dx
  4. Then, Evaluate ∫ x³ ln x dx
  5. Evaluate ∫ (ln x) / x² dx
  6. Similarly, Evaluate ∫₁ᵉ x ln x dx

Solutions

1. ∫ ln(3x) dx
You can rewrite this as ∫ (ln 3 + ln x) dx. This equals (ln 3)x + (x ln x − x) + C. So, you get x(ln 3 + ln x) − x + C. Therefore, the result is x ln(3x) − x + C.

2. ∫₁ᵉ² ln x dx

[x ln x − x]₁ᵉ² = (e² ln(e²) − e²) − (1 ln 1 − 1) = (2e² − e²) − (0 − 1) = e² + 1.

3. ∫ x² ln x dx
First, set u = ln x and dv = x² dx. Therefore, du = (1/x) dx and v = x³/3.
So, ∫ x² ln x dx = (x³/3) ln x − ∫ (x³/3)(1/x) dx. This simplifies to (x³ ln x) / 3 − x³ / 9 + C.

4. ∫ x³ ln x dx
Set u = ln x and dv = x³ dx. As a result, du = (1/x) dx and v = x⁴/4.
Thus, ∫ x³ ln x dx = (x⁴/4) ln x − ∫ (x⁴/4)(1/x) dx. This simplifies to (x⁴ ln x) / 4 − x⁴ / 16 + C.

5. ∫ (ln x) / x² dx
Set u = ln x and dv = x⁻² dx. Therefore, du = (1/x) dx and v = −1/x.
So, ∫ (ln x) / x² dx = −(ln x)/x − ∫ (−1/x)(1/x) dx. This equals −(ln x)/x − 1/x + C. Consequently, the final answer is −(ln x + 1)/x + C.

6. ∫₁ᵉ x ln x dx

Antiderivative is (x²/2) ln x − x²/4.

Evaluated from 1 to e: ((e²/2)(1) − e²/4) − ((1/2)(0) − 1/4) = (e²/4) − (−1/4) = (e² + 1) / 4.

Frequently asked questions

Why isn’t the integral of ln x equal to 1/x?

The expression 1/x is the derivative of ln x, not its integral. Integration requires finding a function whose derivative equals ln x, which is x ln x − x + C.

Is the integral of ln x the same as x ln x?

No, you must subtract x. Differentiating x ln x using the product rule gives ln x + 1. So, the -x term is necessary. It cancels the extra +1.

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

The definite integral from 0 to 1 equals -1. Even though ln x approaches negative infinity at 0, taking the limit shows convergence. The total area bounded beneath the x-axis converges to 1 unit.

Can you integrate ln x without integration by parts?

Yes, you can integrate ln x geometrically using inverse functions by subtracting areas bounded by eʸ. However, that approach is mathematically identical to integration by parts written in alternative notation.

Why is there a + C in the indefinite integral?

The constant of integration + C accounts for all vertical shifts of the antiderivative. Because the derivative of any constant is zero, adding C covers every valid antiderivative function.

What is the integral of log base 10 of x?

The integral of log₁₀ x is (x ln x − x) / ln 10 + C. This formula comes from rewriting log₁₀ x as (ln x) / (ln 10) using the change-of-base rule before integrating.

Further reading

Related topics: derivative of ln x, integral of 1/x.

Calculators for this topic

Get new calculus guides by email

Free worked examples and new calculators, at most once a day. Unsubscribe with one click.

Leave a comment

Your email address will not be published. Required fields are marked *