Skip to content
Glacius
CalculusConcept reference

Logarithm derivatives

A natural logarithm changes quickly near zero and more slowly at large positive inputs.

On this page 7 sections
  1. Overview
  2. A logarithm's sensitivity
  3. Divide the inner derivative by the inner value
  4. Carry the domain into the answer
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections
The natural logarithm increases on positive inputs while its slope decreases. Its derivative is 1/x; the curve is a shape illustration on a positive-input interval.The natural logarithm increases on positive inputs while its slope decreases. Its derivative is 1/x; the curve is a shape illustration on a positive-input interval.
Figure 1The natural logarithm increases on positive inputs while its slope decreases. Its derivative is 1/x; the curve is a shape illustration on a positive-input interval.
Link to this figure ↗Download SVGDownload PNG

01A logarithm's sensitivity#

A natural logarithm changes quickly near zero and more slowly at large positive inputs. In likelihood calculations, that means an already tiny probability can have a large effect on log probability when it changes.

For f(x)=ln⁡xf(x)=\ln x, the derivative is 1/x1/x on x>0x>0. One way to see the relationship is to write y=ln⁡xy=\ln x, so ey=xe^y=x. Differentiating gives eyy′=1e^y y'=1, hence y′=1/xy'=1/x.

At x=2x=2, the slope is 1/21/2. At x=0.1x=0.1, it is 1010. These are slopes of the logarithm, not its output values.

02Divide the inner derivative by the inner value#

For f(x)=ln⁡g(x)f(x)=\ln g(x), apply the chain rule where g(x)>0g(x)>0:

f′(x)=g′(x)g(x).f'(x)=\frac{g'(x)}{g(x)}.

For f(x)=ln⁡(2x+3)f(x)=\ln(2x+3), the inner derivative is 22. The derivative is 2/(2x+3)2/(2x+3) and the real domain is x>−3/2x>-3/2. At x=1x=1, the derivative is 2/52/5.

Check your reasoning

Differentiate ln⁡(3x+1)\ln(3x+1) on its real domain.

  1. A3/(3x+1)3/(3x+1)
  2. B1/(3x+1)1/(3x+1)
  3. Cln⁡3\ln3
Show answer and explanation
3/(3x+1)3/(3x+1)

The derivative of the inner expression is 3; divide by the inner value.

For h(x)=−ln⁡xh(x)=-\ln x, the minus sign scales the derivative to −1/x-1/x. At x=1/4x=1/4, this is −4-4. Increasing a positive probability decreases its negative log loss.

03Carry the domain into the answer#

The real logarithm is undefined at zero and at negative inputs. A denominator formula alone does not extend its domain. For example, 1/x1/x exists at x=−1x=-1, but it is not a derivative of the real function ln⁡x\ln x there.

Check your reasoning

A draft claims (ln⁡(5x))′=1/(5x)(\ln(5x))'=1/(5x) for x>0x>0. Repair it.

  1. A5/x5/x
  2. B1/x1/x
  3. Cln⁡5/x\ln5/x
Show answer and explanation
1/x1/x

The omitted inner derivative is 5; 5/(5x)=1/x.

Taking the logarithm of a product can simplify a later derivative, but any rewritten expression still has to respect its original domain. Check the inner value before differentiating a logarithmic expression.

Key takeaway

Differentiate a natural logarithm on its real domain.

  • Differentiate a natural logarithm on its real domain.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Logarithm derivatives.” Math behind ML. /learn/c-log