Tutorials › Calculus I › Derivatives of Natural Logs of Absolute Values

Exponential and Logarithmic Derivatives · Tutorial 537 of 1495

Derivatives of Natural Logs of Absolute Values

Learn to differentiate \(\ln|u(x)|\) wherever \(u(x)\) is nonzero, including when the inner function changes sign.

Intermediate 9 min read

What You'll Learn

  • State the domain and differentiability conditions for \(\ln|u(x)|\)
  • Derive the formula \( \frac{d}{dx}\ln|u(x)|=\frac{u'(x)}{u(x)} \)
  • Apply the formula on intervals where the inner function is positive or negative
  • Recognize why zeros of the inner function must be excluded
  • Identify and correct common sign and absolute-value errors

Why Absolute Values Appear Inside Natural Logarithms

The natural logarithm \(\ln y\) is defined for positive real inputs \(y\). That restriction can make \(\ln(u(x))\) unsuitable when \(u(x)\) is negative at some points. The expression \(\ln|u(x)|\), however, is defined at every point where \(u(x)\ne 0\), because the absolute value is then positive.

This makes \(\ln|u(x)|\) useful when an inner function can be either positive or negative. Its derivative has a compact form, but the domain condition matters: at any point where \(u(x)=0\), the logarithm is undefined, and the derivative formula cannot be used there.

Definition: If \(u\) is a real-valued function, then \(\ln|u(x)|\) is defined precisely at those \(x\) for which \(u(x)\ne 0\). If \(u\) is differentiable on an open interval and \(u(x)\ne 0\) at a point in that interval, then $$ \frac{d}{dx}\ln|u(x)|=\frac{u'(x)}{u(x)}. $$

The denominator is \(u(x)\), not \(|u(x)|\). The sign of \(u(x)\) is retained in the derivative. We will derive this carefully and see why the same formula holds on both sides of a sign change, while never applying at the zero itself.

Deriving the Formula

The key fact is that a differentiable function that is nonzero at a point keeps the same sign in a sufficiently small interval around that point. Thus, locally, there are two cases. If \(u\) is positive, then \(\ln|u|=\ln u\). If \(u\) is negative, then \(|u|=-u\), so \(\ln|u|=\ln(-u)\). The chain rule for natural logarithms gives a derivative in either case.

1
When \(u(x)>0\).
In a neighborhood where \(u\) remains positive, \(\ln|u(x)|=\ln(u(x))\). The chain rule gives derivative \(u'(x)/u(x)\).
2
When \(u(x)<0\).
In a neighborhood where \(u\) remains negative, \(\ln|u(x)|=\ln(-u(x))\). Apply the chain rule to the inner function \(-u(x)\).
3
Simplify the negative case.
The derivative is \((-u'(x))/(-u(x))\), which equals \(u'(x)/u(x)\). Therefore the same formula applies for either sign, provided \(u(x)\ne 0\).

For completeness, in the negative case the numerator and denominator both acquire a minus sign. They cancel, but the final denominator is still the signed value \(u(x)\), not its absolute value.

$$ \frac{d}{dx}\ln(-u(x)) = \frac{-u'(x)}{-u(x)} = \frac{u'(x)}{u(x)} \qquad\text{when }u(x)<0. $$
Theorem: Suppose \(u\) is differentiable on an open interval \(I\). At every \(x\in I\) for which \(u(x)\ne 0\), the function \(\ln|u(x)|\) is differentiable and $$ \frac{d}{dx}\ln|u(x)|=\frac{u'(x)}{u(x)}. $$ The formula applies separately at all such points, including points in different sign regions. It makes no claim at points where \(u(x)=0\), since the logarithm is not defined there.

Worked Examples

Worked Example: A Sign-Changing Quadratic

Differentiate \(f(x)=\ln|x^2-4|\), and state where the result is valid.

Set \(u(x)=x^2-4\). Then \(u'(x)=2x\). The logarithm is defined when \(x^2-4\ne 0\), which means \(x\ne -2\) and \(x\ne 2\). Apply the formula on this domain:

$$ f'(x)=\frac{u'(x)}{u(x)} =\frac{2x}{x^2-4}, \qquad x\ne -2,\,2. $$

The inner function is negative for \(-2<x<2\) and positive for \(x<-2\) or \(x>2\). The formula holds on all three intervals; the two roots are excluded because \(f\) is undefined there.

Check the negative-input region at \(x=0\). Here \(u(0)=-4\), so \(f(0)=\ln 4\), and the formula gives \(f'(0)=0/(-4)=0\). Locally, \(|x^2-4|=4-x^2\), whose logarithm has derivative \((-2x)/(4-x^2)\), also \(0\) at \(x=0\). The two computations agree.

Worked Example: A Linear Inner Function That Changes Sign

Differentiate \(g(x)=\ln|3-2x|\), and check the derivative on both sides of its zero.

Let \(u(x)=3-2x\), so \(u'(x)=-2\). The inner function is zero at \(x=3/2\), so \(g\) is defined only when \(x\ne 3/2\). Therefore

$$ g'(x)=\frac{-2}{3-2x}, \qquad x\ne \frac{3}{2}. $$

For \(x=1/2\), the inner value is \(3-2(1/2)=2\), and the formula gives \(-2/2=-1\). On this positive-input region, \(g(x)=\ln(3-2x)\), whose chain-rule derivative is also \(-2/(3-2x)=-1\) at \(x=1/2\).

For \(x=2\), the inner value is \(3-4=-1\), and the formula gives \(-2/(-1)=2\). Here the inner function is negative. Locally, \(|3-2x|=2x-3\), so \(g(x)=\ln(2x-3)\) and its derivative at \(x=2\) is \(2/(4-3)=2\). The check confirms the formula on both sides, while \(x=3/2\) remains excluded.

Worked Example: A Trigonometric Inner Function

Differentiate \(h(x)=\ln|\sin x|\), and evaluate the derivative at \(x=-\pi/6\).

Take \(u(x)=\sin x\), so \(u'(x)=\cos x\). The expression is defined wherever \(\sin x\ne 0\), or equivalently wherever \(x\) is not an integer multiple of \(\pi\). Thus

$$ h'(x)=\frac{\cos x}{\sin x}=\cot x, \qquad \sin x\ne 0. $$

At \(x=-\pi/6\), \(\sin(-\pi/6)=-1/2\) and \(\cos(-\pi/6)=\sqrt{3}/2\). The inner function is negative, but it is nonzero, so the formula applies:

$$ h'\left(-\frac{\pi}{6}\right) = \frac{\sqrt{3}/2}{-1/2} = -\sqrt{3}. $$

As a direct check, near \(-\pi/6\) the sine remains negative, so \(h(x)=\ln(-\sin x)\). Differentiating locally gives \((-\cos x)/(-\sin x)=\cos x/\sin x\), which has the same value \(-\sqrt{3}\).

Sign Changes and the Domain

A continuous inner function can change sign only by passing through zero. For \(\ln|u(x)|\), each such zero is a point where the function is undefined. The domain is therefore split into intervals on which \(u\) has a fixed sign, and the derivative formula applies on each interval. The formula does not fill in the missing points or make the logarithm differentiable there.

For example, \(\ln|x|\) has domain \(x\ne 0\). Its derivative is \(1/x\) on the two intervals \(x<0\) and \(x>0\). Although the same formula works on both intervals, there is no value or derivative at \(x=0\). When differentiating a specific expression, first identify where its inner function is zero, then state the derivative only on the remaining domain.

Practical rule: For \(f(x)=\ln|u(x)|\), find \(u'(x)\), exclude every point where \(u(x)=0\), and then use \(f'(x)=u'(x)/u(x)\) at every remaining point where \(u\) is differentiable.

A Common Sign Error

A frequent mistake is to replace the signed denominator by its absolute value. For instance, an incorrect calculation for \(q(x)=\ln|x|\) is

$$ q'(x)\overset{\text{wrong}}{=}\frac{1}{|x|}. $$

This fails at negative inputs. At \(x=-2\), the incorrect expression gives \(1/|-2|=1/2\). But near \(-2\), \(q(x)=\ln(-x)\), so its derivative is \(1/(-x)\), which equals \(-1/2\) at \(x=-2\). The correct general formula is

$$ q'(x)=\frac{1}{x},\qquad x\ne 0. $$

The absolute value belongs inside the logarithm to make its input positive. It does not replace the signed inner function in the derivative's denominator. A second error is to apply the formula at a zero of \(u\); at such a point \(\ln|u(x)|\) is undefined, so there is no derivative to calculate.

Why This Formula Is Useful

The formula extends the chain rule for natural logarithms to inner functions that may take negative values. It lets us differentiate one expression across every part of its domain without writing a separate final formula for each sign interval. The sign cases still explain why the formula works, and the domain restriction still has to be stated.

When checking work, ask three questions: Is the inner function differentiable at the point? Is it nonzero there? Did the final denominator retain its sign? If all three conditions are handled, \(\ln|u(x)|\) can be differentiated directly as \(u'(x)/u(x)\).

Check Your Understanding

For each question, pay attention to both the derivative and its domain.

  1. Differentiate \(\ln|x^2-9|\) and state the excluded inputs.
  2. On what domain is \(\ln|1-4x|\) defined, and what is its derivative there?
  3. Explain why the derivative of \(\ln|u(x)|\) has the same formula when \(u(x)<0\) as when \(u(x)>0\).
  4. What is the derivative of \(\ln|x|\) at \(x=-3\)? Why would \(1/|x|\) give an incorrect result?
  5. Can the formula \(u'(x)/u(x)\) be used where \(u(x)=0\)? Explain.

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon