Tutorials › AP Calculus › Logarithms of Composite Arguments

Chain Rule and Nested Functions · Tutorial 172 of 999

Logarithms of Composite Arguments

Apply the chain rule to logarithms of functions, while checking that each logarithm’s argument is positive and its base is valid.

Intermediate 9 min read

What You'll Learn

  • Differentiate the natural logarithm of a function using its inner derivative.
  • Differentiate a logarithm with a base other than e.
  • State the conditions required for each logarithmic derivative formula.
  • Determine where a composite logarithm is defined before differentiating.
  • Recognize and correct the common error of omitting the inner derivative.

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.

Theorem: If \(g\) is differentiable at \(x\) and \(g(x)>0\), then $$ \frac{d}{dx}\ln(g(x))=\frac{g'(x)}{g(x)}. $$ The positivity condition ensures that the logarithm is defined at \(x\); differentiability of \(g\) supplies the inner derivative.

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.

$$ y'=\frac{g'(x)}{g(x)} =\frac{4}{4x+1},\qquad x>-\frac14. $$

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.

1
Identify the outer function.
For \(\ln(g(x))\), the outer function is \(f(u)=\ln u\).
2
Differentiate the outer function.
Its derivative is \(f'(u)=1/u\), so evaluated at the inner function it is \(1/g(x)\).
3
Multiply by the inner derivative.
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.

$$ x^2-4x+3=(x-1)(x-3). $$

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.

$$ y'=\frac{2x-4}{x^2-4x+3},\qquad x<1\ \text{or}\ x>3. $$

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\).

Derivation: Let \(y=\log_a(g(x))\), where \(a>0\), \(a\ne1\), and \(g(x)>0\). By the definition of the logarithm, \(a^y=g(x)\). Taking natural logarithms gives \(y\ln a=\ln(g(x))\). Because \(\ln a\) is a nonzero constant, differentiation and the chain rule give $$ \frac{dy}{dx}\ln a=\frac{g'(x)}{g(x)}. $$ Dividing by \(\ln a\) yields $$ \frac{d}{dx}\log_a(g(x))=\frac{g'(x)}{g(x)\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.

$$ y'=\frac{-2}{(5-2x)\ln 3},\qquad x<\frac52. $$

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,

$$ g'(x)=\frac{(1)(x+2)-(x-1)(1)}{(x+2)^2} =\frac{x+2-x+1}{(x+2)^2} =\frac{3}{(x+2)^2}. $$

Step 3: Apply the logarithm rule and simplify. Since the base is \(2\),

$$ y'=\frac{g'(x)}{g(x)\ln 2} =\frac{\frac{3}{(x+2)^2}}{\frac{x-1}{x+2}\ln 2} =\frac{3}{(x+2)(x-1)\ln 2}, \qquad x<-2\ \text{or}\ x>1. $$

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

$$ \frac{d}{dx}\ln(3x+2)=\frac{1}{3x+2}. $$

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:

$$ \frac{d}{dx}\ln(3x+2) =\frac{1}{3x+2}\cdot\frac{d}{dx}(3x+2) =\frac{3}{3x+2}, \qquad x>-\frac23. $$

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.

Takeaway: For a logarithm of a function, differentiate the outer logarithm, multiply by the derivative of the entire inner function, and state the domain where the inner function is positive. For base \(a\), also require \(a>0\) and \(a\ne1\).

Check Your Understanding

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

  1. Differentiate \(y=\ln(7x-4)\), and state its domain.
  2. Find the domain of \(y=\ln(9-x^2)\).
  3. Differentiate \(y=\log_5(x^2+1)\).
  4. For which real \(x\) is \(y=\ln((x-2)^2)\) defined? What is its derivative on that domain?
  5. A student claims \(\frac{d}{dx}\ln(6x+1)=1/(6x+1)\). Identify the missing factor and give the corrected derivative.

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: 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
Clinical Biostats