Why Logarithmic Compositions Need Care
A logarithm of a function combines two tasks: the logarithm must be defined, and its changing argument must be accounted for when differentiating. The chain rule handles the second task, but it does not remove the first. Before differentiating \(\ln(g(x))\) or \(\log_a(g(x))\), we must check that \(g(x)\) is positive.
For instance, \(\ln(x^2-4)\) is not defined for every real \(x\). Its argument must be positive, so the derivative formula applies only where \(x^2-4>0\). Keeping the domain and derivative together prevents a formally correct-looking expression from being used where the original function does not exist.
The Derivative of a Natural Logarithm of a Function
The natural logarithm \(\ln u\) is defined for positive real inputs \(u>0\), and its derivative with respect to \(u\) is \(1/u\). If the input is itself a differentiable function \(g(x)\), the chain rule says to multiply the derivative of the outer function by the derivative of the inner function.
The numerator \(g'(x)\) records how quickly the argument changes, while the denominator \(g(x)\) comes from the derivative of the natural logarithm. Both factors matter: the rule is not simply \(1/g(x)\) unless \(g'(x)=1\).
Worked Example: Differentiating a Linear Argument
Differentiate \(y=\ln(4x+1)\), and state its real domain.
Step 1: Check the logarithm’s argument. We require \(4x+1>0\). Subtracting \(1\) and dividing by \(4\) gives \(x>-\frac14\). Thus the real domain is \((-\frac14,\infty)\).
Step 2: Identify the inner function and its derivative. Let \(g(x)=4x+1\). Then \(g'(x)=4\).
Step 3: Apply the formula.
Check: The derivative of the outer function \(\ln u\) is \(1/u\), and the inner derivative is \(4\). Multiplying gives \((1/(4x+1))\cdot 4=4/(4x+1)\), as found. At \(x=0\), the original function is defined and this derivative gives \(y'(0)=4\).
Why the Formula Works
This result follows directly from the chain rule. Write the outer function as \(f(u)=\ln u\), so \(f'(u)=1/u\). The composite function is \(f(g(x))\). The chain rule gives its derivative as \(f'(g(x))g'(x)\), provided \(g(x)>0\) and \(g\) is differentiable at \(x\). Substituting \(f'(g(x))=1/g(x)\) gives the stated formula.
For \(\ln(g(x))\), the outer function is \(f(u)=\ln u\).
Its derivative is \(f'(u)=1/u\), so evaluated at the inner function it is \(1/g(x)\).
The chain rule contributes \(g'(x)\), giving \(g'(x)/g(x)\).
This derivation also explains the domain condition. The outer derivative \(1/u\) requires \(u>0\) for the real natural logarithm, so we need \(g(x)>0\). A derivative expression cannot make the original logarithm meaningful at inputs where its argument is zero or negative.
Worked Example: A Quadratic Argument with a Restricted Domain
Differentiate \(y=\ln(x^2-4x+3)\), and find its real domain.
Step 1: Factor the argument.
The product is positive when both factors are negative or both are positive. Both are negative for \(x<1\), and both are positive for \(x>3\). Between \(1\) and \(3\), the factors have opposite signs. At \(x=1\) or \(x=3\), the argument is zero, which is also not allowed. Thus the domain is \(x<1\) or \(x>3\).
Step 2: Differentiate the inner function. For \(g(x)=x^2-4x+3\), we have \(g'(x)=2x-4\).
Step 3: Apply the logarithm rule on the domain.
Check: At \(x=0\), which is in the domain, \(g(0)=3\) and \(g'(0)=-4\). The formula gives \(y'(0)=-4/3\), exactly \(g'(0)/g(0)\). At \(x=2\), the argument is \(-1\), so the original real logarithm is undefined; the derivative rule does not apply there.
Logarithms with a Base Other Than \(e\)
For a fixed real base \(a\), the logarithm \(\log_a u\) is defined for \(u>0\) when \(a>0\) and \(a\ne 1\). The base must be positive, and it cannot be \(1\), because powers of \(1\) do not distinguish different logarithm values.
To obtain a derivative formula, use the change-of-base identity \(\log_a u=\ln u/\ln a\). Since \(a\) is fixed, \(\ln a\) is a nonzero constant. Differentiating therefore divides the derivative of \(\ln u\) by \(\ln a\).
Worked Example: Differentiating a Logarithm with Base 3
Differentiate \(y=\log_3(5-2x)\), and state where it is defined.
Step 1: Check the argument. The condition is \(5-2x>0\). Subtracting \(5\) gives \(-2x>-5\); dividing by the negative number \(-2\) reverses the inequality, so \(x<\frac52\).
Step 2: Differentiate the inner function. Let \(g(x)=5-2x\). Then \(g'(x)=-2\).
Step 3: Apply the base-\(a\) formula. The base is \(a=3\), which is positive and not \(1\), so the rule applies throughout the domain.
Check: Rewriting the function as \(\ln(5-2x)/\ln 3\) gives derivative \(\bigl(-2/(5-2x)\bigr)/\ln 3\), which is the same result. At \(x=0\), the derivative is \(-2/(5\ln 3)\).
Domain Checks for More Complicated Arguments
When the inner function is a quotient or another expression with its own restrictions, the logarithm adds a further condition: the complete argument must be strictly positive. It is not enough to check that the numerator is positive, or that the expression is defined. The entire value inside the logarithm must exceed zero.
Worked Example: A Logarithm of a Quotient
Differentiate \(y=\log_2\left(\frac{x-1}{x+2}\right)\), and find its real domain.
Step 1: Require a positive argument. The quotient is positive when its numerator and denominator have the same sign. Both are negative for \(x< -2\), and both are positive for \(x>1\). The quotient is negative for \(-2<x<1\). Also \(x=-2\) makes the quotient undefined, and \(x=1\) makes it zero. Therefore the domain is \(x<-2\) or \(x>1\).
Step 2: Differentiate the inner function. Set \(g(x)=(x-1)/(x+2)\). Using the quotient rule,
Step 3: Apply the logarithm rule and simplify. Since the base is \(2\),
Check: At \(x=2\), the argument is \(1/4\), which is positive. The inner derivative is \(3/16\), and the logarithm formula gives \((3/16)/((1/4)\ln2)=3/(4\ln2)\). The simplified derivative also gives \(3/((4)(1)\ln2)=3/(4\ln2)\).
A Common Chain Rule Mistake
A frequent error is to differentiate the logarithm’s outer layer but omit the derivative of its argument. For example, a student might write
This is incomplete. The derivative \(1/(3x+2)\) accounts for differentiating \(\ln u\) with respect to \(u\), but \(u=3x+2\) changes at rate \(3\). The chain rule requires multiplication by that rate:
To check the domain, \(3x+2>0\) gives \(x>-\frac23\). The correction is not just a numerical adjustment; it follows from the chain rule’s requirement to multiply by the inner derivative.
Check Your Understanding
For each question, pay attention to both the derivative and the real domain.
- Differentiate \(y=\ln(7x-4)\), and state its domain.
- Find the domain of \(y=\ln(9-x^2)\).
- Differentiate \(y=\log_5(x^2+1)\).
- For which real \(x\) is \(y=\ln((x-2)^2)\) defined? What is its derivative on that domain?
- A student claims \(\frac{d}{dx}\ln(6x+1)=1/(6x+1)\). Identify the missing factor and give the corrected derivative.