Why Nested Logarithms Need Care
A logarithm can itself be the input to another logarithm. For example, in \(\ln(\ln x)\), the outer natural logarithm acts on the value of the inner natural logarithm. Differentiating such an expression means following that chain of dependence from the outside inward.
The chain rule gives the method, but it is not enough to write down a derivative mechanically. Each logarithm has a domain restriction, and the expression must satisfy all of them. For \(\ln(\ln x)\), for instance, it is not sufficient that \(x\) be positive: the inner value \(\ln x\) must also be positive so that it can serve as the input to the outer logarithm.
The Logarithm Rule at Each Layer
For a differentiable function \(u(x)\) with \(u(x)>0\), the derivative of its natural logarithm is
For a logarithm in base \(b\), where \(b>0\) and \(b\ne 1\), the corresponding rule is
In both formulas, the denominator contains the current logarithm's input, and the numerator contains the derivative of that input. If the input is itself a logarithm, its derivative must still be included. The formulas apply on intervals where the input is differentiable and positive.
Worked Example: The Derivative of \(\ln(\ln x)\)
Worked Example: Differentiating \(\ln(\ln x)\)
Find the domain and derivative of \(f(x)=\ln(\ln x)\).
Step 1: Find the domain. The inner logarithm \(\ln x\) is defined when \(x>0\). It is then the input to the outer logarithm, so we also require \(\ln x>0\). Since the natural logarithm is increasing and \(\ln 1=0\), this second condition is equivalent to \(x>1\). Thus the domain is \(x>1\).
Step 2: Differentiate the outer layer. Its input is \(u(x)=\ln x\), so \(u'(x)=1/x\). The natural-log rule gives
Step 3: Check the result at a point in the domain. At \(x=e^2\), the derivative formula gives \(1/(e^2\cdot 2)=1/(2e^2)\). Applying the layers directly gives \((1/\ln(e^2))(1/e^2)=(1/2)(1/e^2)=1/(2e^2)\), as required.
Why the Nested Rule Works
The derivative formula for \(\ln(\ln x)\) is not a separate rule that must be memorized. It follows directly from the ordinary natural-log derivative and the chain rule. The same reasoning works when the inner logarithm has a more complicated input.
Here is a derivation. Let \(u(x)=\ln(g(x))\). Since \(g(x)>1\), \(u(x)>0\), so the outer logarithm is defined. Apply the chain rule to \(\ln(u(x))\), then apply it again to \(u(x)=\ln(g(x))\):
Each factor has a distinct role: \(1/\ln(g(x))\) comes from differentiating the outer logarithm, while \(g'(x)/g(x)\) comes from differentiating the inner one. Omitting either factor fails to account for one of the layers.
Worked Example: A Common Logarithm Outside a Natural Logarithm
Worked Example: Differentiating \(\log_2(\ln(x^2+1))\)
Find the domain and derivative of \(f(x)=\log_2(\ln(x^2+1))\).
Step 1: Enforce the outer logarithm's condition. The input to \(\log_2\) must be positive, so \(\ln(x^2+1)>0\). This is equivalent to \(x^2+1>1\), or \(x^2>0\). Therefore \(x\ne 0\). The inner logarithm is defined for every real \(x\), because \(x^2+1\ge 1>0\). Thus the domain is all real \(x\) except \(0\).
Step 2: Differentiate the outer layer. The input is \(u(x)=\ln(x^2+1)\). For a base-2 logarithm, the derivative is \(u'(x)/(u(x)\ln 2)\).
Step 3: Differentiate the input. By the chain rule, \(u'(x)=2x/(x^2+1)\). Substituting this value gives
Step 4: Check at \(x=1\). The formula gives \(2/(2\ln 2\cdot\ln 2)=1/(\ln 2)^2\). Directly applying the outer derivative rule at \(x=1\), the input value is \(\ln 2\), and its derivative is \(2/(1+1)=1\). Thus the derivative is \(1/(\ln 2\cdot\ln 2)=1/(\ln 2)^2\), matching the formula.
Track the Domain from Outside In
For a nested expression, check each logarithm's input in turn. The outermost logarithm must receive a positive value. If that value is another logarithm, the inner logarithm must be positive; that requirement may be stricter than merely asking that its own input be positive.
For example, in \(\ln(\ln(3x-2))\), the inner logarithm requires \(3x-2>0\). The outer logarithm additionally requires \(\ln(3x-2)>0\), which is equivalent to \(3x-2>1\), or \(x>1\). The stronger condition \(x>1\) automatically satisfies the inner logarithm's condition as well.
Once the domain is established, the chain rule can be organized as a sequence of layers. In this example, the innermost expression is \(3x-2\), the middle layer is its natural logarithm, and the outer layer is the natural logarithm of that result.
For \(\ln(v)\), use \(v'/v\), where \(v=\ln(3x-2)\).
The derivative of \(\ln(3x-2)\) is \(3/(3x-2)\).
The result is \(3/((3x-2)\ln(3x-2))\), valid for \(x>1\).
Worked Example: A Logarithm of a Logarithm in Another Base
Worked Example: Differentiating \(\ln(\log_3(2x-1))\)
Find the domain and derivative of \(f(x)=\ln(\log_3(2x-1))\).
Step 1: Find the domain. The inner logarithm requires \(2x-1>0\). Its value is then the input to the outer natural logarithm, so we also need \(\log_3(2x-1)>0\). Since the base \(3\) is greater than \(1\), this inequality is equivalent to \(2x-1>1\). Hence \(x>1\), which also guarantees \(2x-1>0\).
Step 2: Differentiate each layer. Set \(u(x)=\log_3(2x-1)\). The base-3 logarithm rule gives
Now differentiate the outer natural logarithm:
The final equality uses \(\log_3(2x-1)=\ln(2x-1)/\ln 3\), so the factors \(\ln 3\) cancel.
Step 3: Check at \(x=2\). Here \(2x-1=3\), so \(\log_3(3)=1\), and \(u'(2)=2/(3\ln 3)\). The outer derivative is \(u'(2)/u(2)=(2/(3\ln 3))/1=2/(3\ln 3)\). The simplified formula also gives \(2/(3\ln 3)\).
A Common Mistake: Dropping an Inner Derivative
A frequent error is to differentiate the outer logarithm but then stop, as if its input were simply \(x\). For instance, an incorrect calculation for \(\ln(\ln x)\) is
This omits the derivative of the inner input \(\ln x\). The correction is to apply the chain rule: the outer derivative contributes \(1/\ln x\), and the inner derivative contributes \(1/x\). Therefore
A related domain error is to assume that \(x>0\) alone is enough for \(\ln(\ln x)\). For \(0<x\le 1\), the value \(\ln x\) is nonpositive, so it cannot be the input to the outer natural logarithm. The actual domain is \(x>1\).
A Reliable Procedure
For a nested logarithmic expression, a careful solution separates domain analysis from differentiation. This prevents a formally correct chain-rule expression from being used at points where the original function does not exist.
- Identify every logarithm and require its input to be positive.
- Combine those requirements to state the domain of the original function.
- Differentiate the outermost logarithm using the appropriate base rule.
- Continue inward, multiplying by the derivative of each input.
- Simplify only after all layer derivatives have been included, and state where the derivative is valid.
The order of differentiation is from outside to inside, while the domain conditions must be checked at every level. In particular, an outer natural logarithm whose input is another logarithm requires that inner logarithm to be positive, not merely defined.
Check Your Understanding
For each question, give a derivative and state the domain on which the original function is defined.
- Differentiate \(\ln(\ln(x+2))\). Which condition is stronger: the domain condition for the inner logarithm or the one imposed by the outer logarithm?
- Differentiate \(\log_5(\ln x)\). Why must \(x\) be greater than \(1\), rather than merely positive?
- Find the domain of \(\ln(\log_2(x-1))\).
- In differentiating \(\ln(\ln(x^2+4))\), what derivative factor is contributed by the innermost expression \(x^2+4\)?
- Explain why \(\frac{d}{dx}\ln(\ln x)=1/\ln x\) is incomplete.