Derivatives of Logarithmic Functions

The derivative of a logarithmic function starts with one rule: the derivative of ln x is \frac{1}{x}, for x \gt 0. For another base, \frac{d}{dx}\log_a x = \frac{1}{x \ln a}. With an inside function u, the chain rule gives \frac{d}{dx}\ln u = \frac{u'}{u}: the derivative of the inside divided by the inside.

Before this lesson: Derivatives of Exponential Functions, Derivatives of Inverse Functions and Properties of Logarithms

Why the derivative of ln x is 1/x

The natural log is the inverse of e^x. If y = \ln x, then e^y = x. Differentiate both sides with respect to x, using implicit differentiation:

e^y \cdot \frac{dy}{dx} = 1 \quad \Rightarrow \quad \frac{dy}{dx} = \frac{1}{e^y} = \frac{1}{x}

You can see it on the graph. Near x = 0 the curve y = \ln x is very steep, and as x grows it flattens out. At x = ½ the slope is 2, at x = 1 it is 1, and at x = 4 it is only ¼.

Graph of y = ln x for x from 0 to 6. Dashed tangent lines are drawn at (1/2, ln 1/2) with slope 2, at (1, 0) with slope 1, and at (4, ln 4) with slope 1/4. The curve gets flatter as x increases.
The slope of ln x at any x is 1/x, so the curve flattens as x grows.

Logarithmic derivative rules

FunctionDerivativeWith an inside function u
\ln x\frac{1}{x}\frac{u'}{u}
\ln|x|\frac{1}{x}\frac{u'}{u}
\log_a x\frac{1}{x\ln a}\frac{u'}{u\ln a}

The rule for \log_a x follows from the change-of-base formula: \log_a x = \frac{\ln x}{\ln a}, and \frac{1}{\ln a} is just a constant.

Use log properties first. Rewriting a log of a product, quotient or power as a sum of simpler logs often makes the derivative much easier (see properties of logarithms).

Derivatives of logarithmic functions examples

Example 1: A sum with ln x

Differentiate y = 3\ln x + x^2.

y' = 3 \cdot \frac{1}{x} + 2x

The derivative of ln x is 1/x; power rule on x².

y' = \frac{3}{x} + 2x

Multiply.

Answer: y' = \frac{3}{x} + 2x.

Example 2: Chain rule with ln

Differentiate y = \ln(x^2 + 1).

u = x^2 + 1, \; u' = 2x

The inside function is x² + 1.

y' = \frac{u'}{u} = \frac{2x}{x^2 + 1}

Derivative of the inside over the inside (see chain rule).

Answer: y' = \frac{2x}{x^2 + 1}.

Example 3: Product rule with ln x

Differentiate y = x\ln x.

y' = (1)(\ln x) + (x)\left(\frac{1}{x}\right)

Product rule (see product rule).

y' = \ln x + 1

Simplify: x · 1/x = 1.

Answer: y' = \ln x + 1.

Example 4: Use log properties first

Differentiate y = \ln\left(x^3\sqrt{x + 1}\right).

y = \ln\left(x^3\right) + \ln\left((x + 1)^{1/2}\right)

The log of a product is the sum of the logs.

y = 3\ln x + \frac{1}{2}\ln(x + 1)

Bring each exponent down in front (power property).

y' = \frac{3}{x} + \frac{1}{2} \cdot \frac{1}{x + 1}

Differentiate each term. The inside x + 1 has derivative 1.

y' = \frac{3}{x} + \frac{1}{2(x + 1)}

Multiply.

Answer: y' = \frac{3}{x} + \frac{1}{2(x + 1)}. Without the log properties, you would need the chain rule and the product rule together.

Example 5: Word problem with a growing tree

A young tree’s height is modeled by h(t) = 20\ln(t + 1) feet, t years after planting. How fast is it growing at t = 4 years? At t = 19 years?

h'(t) = 20 \cdot \frac{1}{t + 1} = \frac{20}{t + 1}

Chain rule: the inside t + 1 has derivative 1.

h'(4) = \frac{20}{5} = 4

Substitute t = 4.

h'(19) = \frac{20}{20} = 1

Substitute t = 19.

Answer: the tree grows about 4 feet per year at 4 years and about 1 foot per year at 19 years. A log model always keeps growing, but more and more slowly.

Common mistakes

MistakeExample of the errorFix
Forgetting the chain rule\frac{d}{dx}\ln(x^2 + 1) = \frac{1}{x^2 + 1}Multiply by u′: \frac{2x}{x^2 + 1}.
Using 1/x for any log base\frac{d}{dx}\log_2 x = \frac{1}{x}Divide by ln a too: \frac{1}{x\ln 2}.
Splitting a log of a sum\ln(x^2 + 1) = \ln x^2 + \ln 1Log properties work on products, quotients and powers, not sums.
Treating (ln x)² like ln(x²)\frac{d}{dx}(\ln x)^2 = \frac{2}{x}Chain rule: 2\ln x \cdot \frac{1}{x}.
Differentiating a log constant\frac{d}{dx}\ln 5 = \frac{1}{5}ln 5 is a constant, so its derivative is 0.

Related methods

The derivative of ln|x|

The function \ln|x| is defined for negative x too, and its derivative is still \frac{1}{x}. This version matters later, because it is why the antiderivative of \frac{1}{x} is \ln|x| + C.

Logarithmic differentiation

You can also take the natural log of both sides of an equation before you differentiate. That trick handles messy products and powers like x^x, and it is the next lesson, Logarithmic Differentiation.

Practice problems

  1. Differentiate y = \ln(5x).
  2. Differentiate y = \ln(x^2 - 3x).
  3. Differentiate y = x^2\ln x.
  4. Differentiate y = (\ln x)^2.
  5. Differentiate y = \log_{10} x.
  6. Differentiate y = \ln\sqrt{x}.
  7. Differentiate y = \ln\left(\frac{x + 1}{x - 1}\right).
  8. Find the tangent line to y = \ln x at x = 1.
  9. Find where y = \frac{\ln x}{x} has a horizontal tangent line.
  10. Find the slope of y = \log_3(x^2 + 2) at x = 1.
Show answers

1.

y' = \frac{5}{5x}

Derivative of the inside over the inside.

y' = \frac{1}{x}

Simplify. (Or: ln 5x = ln 5 + ln x, and ln 5 is a constant.)

Answer: y' = \frac{1}{x}

2.

y' = \frac{2x - 3}{x^2 - 3x}

The inside has derivative 2x − 3.

Answer: y' = \frac{2x - 3}{x^2 - 3x}

3.

y' = 2x\ln x + x^2 \cdot \frac{1}{x}

Product rule.

y' = 2x\ln x + x

Simplify x²/x = x.

Answer: y' = 2x\ln x + x

4.

y' = 2\ln x \cdot \frac{1}{x}

General power rule: the inside ln x has derivative 1/x.

y' = \frac{2\ln x}{x}

Multiply.

Answer: y' = \frac{2\ln x}{x}

5.

y' = \frac{1}{x\ln 10}

Rule for log base a with a = 10.

Answer: y' = \frac{1}{x\ln 10}

6.

y = \frac{1}{2}\ln x

Power property: √x = x^(1/2).

y' = \frac{1}{2x}

Differentiate.

Answer: y' = \frac{1}{2x}

7.

y = \ln(x + 1) - \ln(x - 1)

Quotient property.

y' = \frac{1}{x + 1} - \frac{1}{x - 1}

Differentiate each term.

y' = \frac{(x - 1) - (x + 1)}{(x + 1)(x - 1)}

Use a common denominator (see adding and subtracting rational expressions).

y' = \frac{-2}{x^2 - 1}

Simplify the numerator and multiply out the denominator.

Answer: y' = -\frac{2}{x^2 - 1}

8.

y(1) = \ln 1 = 0

Find the point (1, 0).

y'(1) = \frac{1}{1} = 1

The slope is 1/x at x = 1.

y - 0 = 1(x - 1)

Point-slope form (see point-slope form).

Answer: y = x - 1

9.

y' = \frac{\frac{1}{x} \cdot x - \ln x \cdot 1}{x^2}

Quotient rule (see quotient rule).

y' = \frac{1 - \ln x}{x^2}

Simplify the numerator.

1 - \ln x = 0 \Rightarrow \ln x = 1

Set the numerator equal to 0.

x = e

Rewrite in exponential form.

Answer: x = e, at the point (e, 1/e)

10.

y' = \frac{2x}{(x^2 + 2)\ln 3}

Rule for log base 3 with the chain rule.

y'(1) = \frac{2}{3\ln 3}

Substitute x = 1.

\frac{2}{3\ln 3} \approx 0.607

Use ln 3 ≈ 1.0986.

Answer: about 0.607

Derivatives of logarithmic functions FAQ

What is the derivative of ln x?

\frac{d}{dx}\ln x = \frac{1}{x} for x \gt 0. The same formula holds for ln|x| when x is negative.

What is the derivative of ln(u)?

By the chain rule, \frac{d}{dx}\ln u = \frac{u'}{u}. For example, the derivative of ln(3x + 2) is \frac{3}{3x + 2}.

What is the derivative of log base a of x?

\frac{d}{dx}\log_a x = \frac{1}{x\ln a}. For base 10, that is \frac{1}{x\ln 10} \approx \frac{0.434}{x}.

Why is the derivative of ln(5x) the same as that of ln x?

Because ln 5x = ln 5 + ln x, and ln 5 is a constant with derivative 0. Multiplying the inside by a constant only shifts the log graph up or down.

Summary

  • \frac{d}{dx}\ln x = \frac{1}{x} and \frac{d}{dx}\log_a x = \frac{1}{x\ln a}.
  • Chain rule: \frac{d}{dx}\ln u = \frac{u'}{u}.
  • Simplify with log properties before you differentiate.
  • Log properties don’t split a log of a sum.
  • The rule comes from ln x being the inverse of eˣ.

Previous lesson: Derivatives of Exponential Functions

Next lesson: Logarithmic Differentiation

Back to the Calculus 1 Index