Introduction
A logarithm can have a function, rather than just a variable, as its argument. For example, \(\log_2(x^2+1)\) changes as \(x\) changes both because the inside function changes and because the logarithm measures that change on a particular base scale.
The derivative must account for both effects. The inner function contributes its derivative, while the logarithm’s base contributes a constant factor. Keeping these contributions separate makes the rule straightforward to use and helps prevent sign and domain errors.
The derivative rule
Let \(a\) be a fixed real number satisfying \(a>0\) and \(a\ne 1\). Let \(u\) be differentiable on an open interval \(I\), and suppose \(u(x)>0\) for every \(x\in I\). These conditions ensure that the logarithm is defined throughout the interval and that the derivative can be evaluated there.
Here \(a\) is constant, \(\ln(a)\) is therefore a nonzero constant, and \(u'(x)\) is the derivative of the argument. The denominator includes both \(u(x)\) and \(\ln(a)\). A useful way to remember the structure is: differentiate the inside, divide by the inside, then divide by the natural logarithm of the base.
The positivity condition applies to the argument \(u(x)\), not necessarily to \(x\) itself. The formula is used on intervals where \(u\) is positive. If the domain has separate intervals, the same rule applies on each interval on which the stated conditions hold.
Why the rule works
The change-of-base identity expresses a logarithm in base \(a\) using natural logarithms. Because \(a\) is fixed and positive, and \(a\ne1\), its natural logarithm is defined and nonzero:
Since \(u(x)>0\), the derivative rule for the natural logarithm of a differentiable positive function gives \(\frac{d}{dx}\ln(u(x))=\frac{u'(x)}{u(x)}\). The denominator \(\ln(a)\) is constant, so it remains as a factor when differentiating. Thus
This derivation uses two ingredients: the change-of-base identity and the chain rule for the natural logarithm. It also shows why the formula cannot be applied where \(u(x)\le 0\): the real-valued logarithm \(\ln(u(x))\) is not defined there.
The base determines a constant factor
The base affects the derivative through \(1/\ln(a)\). This factor is constant with respect to \(x\), but its sign depends on the base.
| Base condition | Sign of \(\ln(a)\) | Effect to keep in mind |
|---|---|---|
| \(a>1\) | Positive | The base factor \(1/\ln(a)\) is positive. |
| \(0<a<1\) | Negative | The base factor \(1/\ln(a)\) is negative. |
The sign of the full derivative also depends on \(u'(x)\), since \(u(x)>0\). In particular, a base between zero and one does not mean that the derivative is always negative: the sign of \(u'(x)\) matters too. Keep \(\ln(a)\) in the expression until its sign has been handled carefully.
Worked examples
Worked Example: A quadratic argument with base 2
Differentiate \(f(x)=\log_2(x^2+1)\), and check the result.
First, \(x^2+1\ge1>0\) for every real \(x\), so the logarithm is defined on all of \(\mathbb R\). Set \(u(x)=x^2+1\). Then
Apply the rule:
To check, rewrite the original function using change of base and differentiate:
This matches the result. At \(x=0\), the derivative is \(0\), consistent with the fact that the inner function \(x^2+1\) has derivative \(0\) there.
Worked Example: A decreasing inner function and a base below 1
Differentiate \(g(x)=\log_{1/3}(5-2x)\) on its domain.
The argument must be positive:
Thus the domain is the open interval \((-\infty,5/2)\). Set \(u(x)=5-2x\). Then \(u'(x)=-2\), and
Substitution into the derivative rule gives
For a check, use change of base, then differentiate on the domain \(x<5/2\):
The result is positive on the domain. Both the negative derivative of the argument and the negative value of \(\ln(1/3)\) contribute to that sign.
Worked Example: A polynomial argument on two intervals
Differentiate \(h(x)=\log_3(x^2-4)\) wherever it is defined.
The argument must be positive. Factor and solve the inequality:
The product is positive when both factors are positive or both are negative. Hence \(x>2\) or \(x<-2\); the domain is \((-\infty,-2)\cup(2,\infty)\). On either interval, let \(u(x)=x^2-4\), so \(u'(x)=2x\). Therefore
To check, differentiate the change-of-base expression on either domain interval:
This is the same derivative. Notice that \(x^2-4\) is positive on both intervals, so the formula is valid on each one. At \(x<-2\), the derivative is negative; at \(x>2\), it is positive.
A common mistake: omitting the argument in the denominator
A frequent error is to differentiate the inside and divide only by the natural logarithm of the base. For instance, for \(p(x)=\log_3(2x+1)\), an incorrect calculation is
This omits the factor \(2x+1\). The logarithm’s derivative rule requires division by the entire positive argument as well as by \(\ln(3)\). The domain condition is \(2x+1>0\), or \(x>-1/2\), and the correct calculation is
For a direct check at \(x=1\), the correct derivative is \(2/(3\ln(3))\), whereas the incorrect expression gives \(2/\ln(3)\). They differ by a factor of \(3\). Differentiating \(\ln(2x+1)/\ln(3)\) gives \(2/((2x+1)\ln(3))\), confirming the correction.
A second sign-related pitfall is to replace \(\ln(a)\) by a positive quantity without checking the base. If \(0<a<1\), then \(\ln(a)<0\). Replacing it by \(\ln(1/a)\) requires also accounting for the negative sign, since \(\ln(a)=-\ln(1/a)\).
A reliable procedure
For a composite logarithm \(\log_a(u(x))\), organize the calculation in this order:
Confirm that \(a>0\) and \(a\ne1\). These conditions make the real logarithm valid and ensure \(\ln(a)\ne0\).
Solve \(u(x)>0\), and identify the interval or intervals where the logarithm is defined.
Compute \(u'(x)\) separately so it is clear which factor comes from the chain rule.
Use \(u'(x)/(u(x)\ln(a))\), preserving the sign of \(\ln(a)\), especially when \(0<a<1\).
Differentiate \(\ln(u(x))/\ln(a)\) and compare, while ensuring the answer is stated only on the logarithm’s domain.
Why the domain and base conditions matter
The formula contains \(u(x)\) in the denominator, and the real logarithm also requires \(u(x)>0\). The positivity condition therefore has both a meaning in the original function and a role in the derivative calculation. Points where \(u(x)=0\) are not included in the real domain, so the derivative formula does not extend through them as a derivative of the original function.
The restrictions on \(a\) are equally essential. A real logarithm base must be positive, and base \(1\) is excluded because \(\log_1(y)\) does not define a logarithm function: \(1^z=1\) for every real \(z\), so it cannot produce general positive values \(y\). In the derivative formula this exclusion appears as \(\ln(1)=0\), which would make the denominator zero.
These checks are not optional details after the differentiation. They determine where the original function exists and whether the derivative rule applies. State the domain first when the inside function can be zero or negative, and retain the base factor until the final simplification.
Check Your Understanding
For each question, account for the domain as well as the derivative.
- Differentiate \(\log_5(3x+4)\) and state its domain.
- Differentiate \(\log_{1/2}(x^2+2)\). What sign does the base factor \(1/\ln(1/2)\) have?
- On which intervals is \(\log_7(9-x^2)\) defined? Write its derivative on those intervals.
- Explain why the derivative rule requires both \(u(x)>0\) and \(a>0,\ a\ne1\).
- Identify the missing factor in the incorrect claim \(\frac{d}{dx}\log_4(x+6)=1/\ln(4)\), then give the corrected derivative and domain.