Integrals That Give Natural Logarithms

Integrals that give natural logarithms have a numerator that is the derivative of the denominator: \int \dfrac{g'(x)}{g(x)}\,dx = \ln|g(x)| + C. The simplest case is \int \dfrac{1}{x}\,dx = \ln|x| + C. The same rule gives the integrals of tan x, cot x, sec x and csc x.

Before this lesson: U-Substitution, Derivatives of Logarithmic Functions and Properties of Logarithms

Why the answer is a logarithm

The power rule \int x^n\,dx = \dfrac{x^{n+1}}{n + 1} + C fails when n = −1, because you would divide by 0. Yet 1/x clearly has an antiderivative. You already know a function whose derivative is 1/x: the natural log, since (ln x)′ = 1/x.

The absolute value lets the rule work for negative x too. For x less than 0, the chain rule gives (ln(−x))′ = (−1)/(−x) = 1/x. So ln|x| is an antiderivative of 1/x on both sides of 0.

Graph of y = 1/x for x from about 0.25 to 4.5. The region under the curve from x = 1 to x = e, about 2.72, is shaded and labeled area = ln e − ln 1 = 1.
The area under y = 1/x from 1 to e is ln e − ln 1 = 1. That is one way to define the number e.

Natural log integral formulas

\int \dfrac{1}{x}\,dx = \ln|x| + C
\int \dfrac{g'(x)}{g(x)}\,dx = \ln|g(x)| + C

The second rule is u-substitution with u = g(x): the integral becomes \int \dfrac{1}{u}\,du. Four trig integrals follow from it:

IntegralResultHow to get it
\int \tan x\,dx-\ln|\cos x| + C = \ln|\sec x| + Ctan x = sin x / cos x; let u = cos x
\int \cot x\,dx\ln|\sin x| + Ccot x = cos x / sin x; let u = sin x
\int \sec x\,dx\ln|\sec x + \tan x| + CMultiply by (sec x + tan x)/(sec x + tan x); let u = sec x + tan x
\int \csc x\,dx-\ln|\csc x + \cot x| + CMultiply by (csc x + cot x)/(csc x + cot x); let u = csc x + cot x

How to spot a log integral:

  1. Look at the denominator. Find its derivative.
  2. If the numerator is that derivative, or a constant times it, let u be the denominator.
  3. Rewrite as a constant times \int \dfrac{1}{u}\,du.
  4. Integrate to ln|u|, substitute back and add + C. Drop the absolute value only if the inside is always positive.

Natural log integral examples

Example 1: The numerator is the derivative

Find \int \dfrac{2x}{x^2 + 1}\,dx.

u = x^2 + 1

Let u be the denominator.

du = 2x\,dx

The numerator 2x dx is exactly du.

\int \dfrac{2x}{x^2 + 1}\,dx = \int \dfrac{1}{u}\,du

Rewrite in u (see u-substitution).

= \ln|u| + C

Integrate 1/u.

= \ln(x^2 + 1) + C

Substitute back. x² + 1 is always positive, so no absolute value is needed.

Answer: \ln(x^2 + 1) + C

Example 2: A linear denominator

Find \int \dfrac{1}{4x + 3}\,dx.

u = 4x + 3

Let u be the denominator.

du = 4\,dx

Differentiate u, so dx = du/4.

\int \dfrac{1}{4x + 3}\,dx = \int \dfrac{1}{4}\cdot\dfrac{1}{u}\,du

Rewrite in u.

= \dfrac{1}{4}\ln|u| + C

Integrate 1/u.

= \dfrac{1}{4}\ln|4x + 3| + C

Substitute back.

Answer: \dfrac{1}{4}\ln|4x + 3| + C. Keep the absolute value, because 4x + 3 is negative when x is less than −3/4.

Example 3: The integral of tan x

Find \int \tan x\,dx.

\int \tan x\,dx = \int \dfrac{\sin x}{\cos x}\,dx

Write tan x as sin x over cos x (see fundamental trig identities).

u = \cos x

Let u be the denominator.

du = -\sin x\,dx

Differentiate u, so sin x dx = −du.

\int \dfrac{\sin x}{\cos x}\,dx = \int -\dfrac{1}{u}\,du

Rewrite in u.

= -\ln|u| + C

Integrate 1/u.

= -\ln|\cos x| + C

Substitute back.

= \ln|\sec x| + C

−ln a = ln(1/a), and 1/cos x = sec x.

Answer: -\ln|\cos x| + C, which is the same as \ln|\sec x| + C.

Example 4: A definite log integral

Evaluate \int_0^2 \dfrac{x^2}{x^3 + 1}\,dx.

u = x^3 + 1

Let u be the denominator.

du = 3x^2\,dx

Differentiate u, so x² dx = du/3.

x = 0 \to u = 1, \quad x = 2 \to u = 9

Change the limits (see u-substitution with definite integrals).

\int_0^2 \dfrac{x^2}{x^3 + 1}\,dx = \int_1^9 \dfrac{1}{3u}\,du

Rewrite in u.

= \Big[\dfrac{1}{3}\ln u\Big]_1^9

Integrate. u is positive from 1 to 9.

= \dfrac{1}{3}\ln 9 - \dfrac{1}{3}\ln 1 = \dfrac{1}{3}\ln 9

Plug in the limits; ln 1 = 0.

= \dfrac{2}{3}\ln 3

ln 9 = ln 3² = 2 ln 3.

\approx 0.732

Use ln 3 ≈ 1.0986.

Answer: \dfrac{2}{3}\ln 3 \approx 0.732

Example 5: New users of an app

A new app gains users at a rate of r(t) = \dfrac{600}{t + 2} users per day, t days after launch. How many users does it gain in the first 10 days?

\int_0^{10} \dfrac{600}{t + 2}\,dt = \Big[600\ln(t + 2)\Big]_0^{10}

Let u = t + 2, so du = dt; t + 2 is positive here.

= 600\ln 12 - 600\ln 2

Plug in the limits and subtract.

= 600\ln 6

ln 12 − ln 2 = ln(12/2) by the quotient rule for logs.

\approx 1075

Use ln 6 ≈ 1.7918.

Answer: about 1,075 new users in the first 10 days.

Common mistakes

MistakeExample of the errorFix
Dropping the absolute value\int \dfrac{1}{x}\,dx = \ln x + C for all xUse \ln|x| + C. Drop the bars only when the inside is always positive.
Using ln for other powers\int \dfrac{1}{x^2}\,dx = \ln(x^2) + COnly the power −1 gives a log. Here use the power rule: -\dfrac{1}{x} + C.
Using ln when the top is not the derivative\int \dfrac{1}{x^2 + 1}\,dx = \ln(x^2 + 1) + CThe derivative of x² + 1 is 2x, not 1. This integral is arctan x + C (next lesson).
Forgetting the constant factor\int \dfrac{1}{4x + 3}\,dx = \ln|4x + 3| + Cdu = 4 dx, so multiply by 1/4.
Integrating across 0\int_{-1}^{1} \dfrac{1}{x}\,dx = \ln 1 - \ln 1 = 01/x is not continuous at 0, so the rule doesn’t apply. This is an improper integral (Calculus 2).

Related methods

Divide first when the top is too big

If the degree of the numerator is at least the degree of the denominator, divide first (see polynomial long division). For example, \dfrac{x}{x + 1} = 1 - \dfrac{1}{x + 1}, so \int \dfrac{x}{x + 1}\,dx = x - \ln|x + 1| + C.

Logs of other bases

Because \dfrac{d}{dx}a^x = a^x\ln a, you get \int a^x\,dx = \dfrac{a^x}{\ln a} + C. This is the exponential version of the same idea (see derivatives of exponential functions).

Arctangent instead of ln

A denominator like x² + 1 with a constant numerator gives an inverse trig function, not a log. That is the next lesson, Integrals That Give Inverse Trig Functions.

Practice problems

  1. Find \int \dfrac{5}{x}\,dx.
  2. Find \int \dfrac{1}{2x + 7}\,dx.
  3. Find \int \dfrac{6x^2}{x^3 - 4}\,dx.
  4. Find \int \dfrac{\cos x}{\sin x + 3}\,dx.
  5. Find \int \cot x\,dx.
  6. Find \int \dfrac{e^x}{e^x + 1}\,dx.
  7. Evaluate \int_1^e \dfrac{3}{x}\,dx.
  8. Evaluate \int_0^1 \dfrac{2x + 1}{x^2 + x + 1}\,dx.
  9. Find \int \dfrac{x^2 + 3x + 1}{x}\,dx.
  10. A tank drains at a rate of r(t) = \dfrac{40}{t + 4} liters per minute. How much water drains out from t = 0 to t = 8 minutes?
Show answers

1.

\int \dfrac{5}{x}\,dx = 5\int \dfrac{1}{x}\,dx = 5\ln|x| + C

Factor out 5, then integrate 1/x.

Answer: 5\ln|x| + C

2.

u = 2x + 7

Let u be the denominator.

du = 2\,dx

Differentiate u, so dx = du/2.

\int \dfrac{1}{2x + 7}\,dx = \int \dfrac{1}{2u}\,du = \dfrac{1}{2}\ln|u| + C

Rewrite and integrate.

= \dfrac{1}{2}\ln|2x + 7| + C

Substitute back.

Answer: \dfrac{1}{2}\ln|2x + 7| + C

3.

u = x^3 - 4

Let u be the denominator.

du = 3x^2\,dx

Differentiate u, so 6x² dx = 2 du.

\int \dfrac{6x^2}{x^3 - 4}\,dx = \int \dfrac{2}{u}\,du = 2\ln|u| + C

Rewrite and integrate.

= 2\ln|x^3 - 4| + C

Substitute back.

Answer: 2\ln|x^3 - 4| + C

4.

u = \sin x + 3

Let u be the denominator.

du = \cos x\,dx

The numerator is du.

\int \dfrac{\cos x}{\sin x + 3}\,dx = \int \dfrac{1}{u}\,du = \ln|u| + C

Rewrite and integrate.

= \ln(\sin x + 3) + C

Substitute back; sin x + 3 is at least 2, so it is always positive.

Answer: \ln(\sin x + 3) + C

5.

\int \cot x\,dx = \int \dfrac{\cos x}{\sin x}\,dx

Write cot x as cos x over sin x.

u = \sin x

Let u be the denominator.

du = \cos x\,dx

The numerator is du.

\int \dfrac{\cos x}{\sin x}\,dx = \int \dfrac{1}{u}\,du = \ln|u| + C = \ln|\sin x| + C

Integrate and substitute back.

Answer: \ln|\sin x| + C

6.

u = e^x + 1

Let u be the denominator.

du = e^x\,dx

The numerator is du.

\int \dfrac{e^x}{e^x + 1}\,dx = \int \dfrac{1}{u}\,du = \ln(e^x + 1) + C

Integrate and substitute back; eˣ + 1 is positive.

Answer: \ln(e^x + 1) + C

7.

\int_1^e \dfrac{3}{x}\,dx = \Big[3\ln x\Big]_1^e

Integrate; x is positive on [1, e].

= 3\ln e - 3\ln 1 = 3(1) - 0 = 3

ln e = 1 and ln 1 = 0.

Answer: 3

8.

u = x^2 + x + 1

Let u be the denominator.

du = (2x + 1)\,dx

The numerator is du.

x = 0 \to u = 1, \quad x = 1 \to u = 3

Change the limits.

\int_1^3 \dfrac{1}{u}\,du = \Big[\ln u\Big]_1^3 = \ln 3 - \ln 1 = \ln 3

Integrate and evaluate.

Answer: \ln 3 \approx 1.099

9.

\dfrac{x^2 + 3x + 1}{x} = x + 3 + \dfrac{1}{x}

Divide each term by x.

\int \left(x + 3 + \dfrac{1}{x}\right)dx = \dfrac{x^2}{2} + 3x + \ln|x| + C

Integrate each term.

Answer: \dfrac{x^2}{2} + 3x + \ln|x| + C

10.

\int_0^8 \dfrac{40}{t + 4}\,dt = \Big[40\ln(t + 4)\Big]_0^8

Let u = t + 4, so du = dt; t + 4 is positive here.

= 40\ln 12 - 40\ln 4 = 40\ln 3

ln 12 − ln 4 = ln 3.

\approx 43.9

Use ln 3 ≈ 1.0986.

Answer: about 43.9 liters

Natural log integrals FAQ

What is the integral of 1/x?

The integral of 1/x is ln|x| + C. The absolute value makes the answer work for negative x as well as positive x.

What is the integral of tan x?

The integral of tan x is −ln|cos x| + C, which can also be written ln|sec x| + C.

When do you use ln in integration?

Use ln when the integrand is a fraction whose numerator is the derivative of its denominator, up to a constant. Then the integral is that constant times ln|denominator| + C.

Why is there an absolute value in ln|x|?

ln x is only defined for positive x, but 1/x is also defined for negative x. ln|x| has derivative 1/x on both sides of 0.

Summary

  • \int \dfrac{1}{x}\,dx = \ln|x| + C, the case the power rule misses.
  • \int \dfrac{g'(x)}{g(x)}\,dx = \ln|g(x)| + C: let u be the denominator.
  • tan x, cot x, sec x and csc x all integrate to logs.
  • Keep the absolute value unless the inside is always positive.
  • If the top’s degree is too big, divide first.

Previous lesson: U-Substitution with Definite Integrals

Next lesson: Integrals That Give Inverse Trig Functions

Back to the Calculus 1 Index