Why Domain Checks Come Before Differentiation
A chain-rule calculation can produce a plausible-looking formula even at an input where the original function is not defined. It can also leave out points where the composite itself is differentiable, because an outer derivative formula may fail even though the composite has a derivative there.
The reliable order is to identify where the original function exists, then apply the derivative rules where their hypotheses hold. Logarithms, square roots, and denominators each impose different restrictions, so the expression and its derivative need not have identical domains.
Three Restrictions to Check
For real-valued functions, the outer functions in these common compositions have the following domains:
- \(\ln(u)\) is defined only when \(u>0\).
- \(\sqrt{u}\) is defined when \(u\geq 0\).
- \(\frac{1}{u}\) is defined only when \(u\neq 0\).
Here \(u\) stands for the inner expression, which may depend on \(x\). For a nested expression, each condition must hold at the same input. For example, the argument of a logarithm must be positive even if that argument contains a square root, and any denominator must also be nonzero.
The standard derivative formulas add their own conditions. If \(g\) is differentiable, then the chain rule gives
and
For a reciprocal,
These conditions are essential. In particular, the square-root function is defined at zero, but its usual derivative formula has \(\sqrt{g(x)}\) in the denominator and is therefore not available when \(g(x)=0\).
Why the Logarithm Condition Matters
The logarithm rule follows from the chain rule only at inputs where the outer function \(\ln(u)\) is defined and differentiable. The real logarithm has domain \(u>0\), and its derivative \(1/u\) is valid on that domain. Thus, if \(f(x)=\ln(g(x))\), an input with \(g(x)\leq 0\) is not merely a point where the derivative formula fails: it is outside the original function’s real domain.
At any input where \(g(x)>0\) and \(g\) is differentiable, the chain rule gives the formula. Indeed, the derivative of the outer function at \(u=g(x)\) is \(1/g(x)\), so multiplying by the inner derivative \(g'(x)\) gives \(g'(x)/g(x)\). This explains both the formula and its required condition.
Worked Example: A Logarithm of a Linear Expression
Find the domain and derivative of \(f(x)=\ln(5-2x)\).
Step 1: Find the original domain. The logarithm’s argument must be positive:
Thus the domain of \(f\) is \((-\infty,\frac{5}{2})\).
Step 2: Differentiate where the condition holds. Let \(g(x)=5-2x\), so \(g'(x)=-2\). For every \(x<\frac{5}{2}\), \(g(x)>0\), and therefore
Check: At \(x=1\), the original argument is \(5-2(1)=3>0\). The chain-rule calculation gives \(f'(1)=-2/3\), matching \(g'(1)/g(1)=-2/3\). At \(x=5/2\), the original argument is zero, so neither \(f(5/2)\) nor its derivative exists as a real-valued logarithmic composite.
Square Roots: The Function Domain and Formula Domain Differ
If \(f(x)=\sqrt{g(x)}\), its real domain requires \(g(x)\geq 0\). The usual chain-rule formula, however, requires \(g(x)>0\). This distinction matters at boundary inputs where \(g(x)=0\): the function may be defined there, although the formula cannot be used there.
At an endpoint of the function’s domain, the ordinary two-sided derivative is not defined unless the function also exists on an open interval around that input. Even when the domain contains points on both sides, a zero radicand still requires a separate differentiability check; the chain-rule formula alone does not decide the issue.
Worked Example: A Square Root with Finite Domain Endpoints
Find the domain and derivative of \(f(x)=\sqrt{9-x^2}\), and check what happens at its endpoints.
Step 1: Find the original domain. The radicand must be nonnegative:
The function’s domain is \([-3,3]\).
Step 2: Apply the square-root formula where its condition holds. In the interior \(-3<x<3\), the radicand is positive. With \(g(x)=9-x^2\) and \(g'(x)=-2x\),
Step 3: Check an endpoint. The function is defined at \(x=3\), with \(f(3)=0\). For inputs from the domain approaching 3, write \(x=3-h\), where \(h>0\). Then
For \(0<h<6\), the numerator is at least \(\sqrt{5h}\) when \(0<h\leq 1\), so the quotient is at most \(-\sqrt{5}/\sqrt{h}\), which decreases without bound as \(h\) approaches zero. There is no finite left-hand derivative at \(3\). The ordinary two-sided derivative is also unavailable because the function is not defined to the right of \(3\).
Check: At \(x=0\), the radicand is \(9>0\), and the formula gives \(f'(0)=0\), consistent with the outer derivative \(1/(2\sqrt{9})\) multiplied by the inner derivative \(-2(0)=0\). The endpoints belong to the function domain but not to the domain of the displayed derivative formula.
Denominators: Exclude Zeros Before Using the Quotient
If a composite contains \(1/g(x)\), its original domain excludes every input where \(g(x)=0\). The reciprocal derivative formula has a squared \(g(x)\) in its denominator, so it is valid at precisely the inputs where \(g(x)\neq 0\), assuming \(g\) is differentiable there.
Worked Example: A Reciprocal of a Quadratic
Find the domain and derivative of \(f(x)=\frac{1}{x^2-4}\).
Step 1: Exclude zeros of the denominator.
The domain is \(\mathbb{R}\setminus\{-2,2\}\).
Step 2: Differentiate on that domain. Put \(g(x)=x^2-4\), so \(g'(x)=2x\). Then
Check: At \(x=3\), \(g(3)=9-4=5\) and \(g'(3)=6\), so the reciprocal rule gives \(f'(3)=-6/25\). Substituting into the derivative formula also gives \(-2(3)/(9-4)^2=-6/25\). At \(x=2\) and \(x=-2\), the original function is undefined, so the derivative does not exist there.
Nested Restrictions Must Hold Together
When one restricted function is inside another, combine all the conditions instead of checking only the outermost operation. The logarithm condition is strict: its entire argument must be positive. A square root inside that argument may be defined when its radicand is zero, but the resulting logarithm still requires a positive value.
Worked Example: A Logarithm Containing a Quotient and a Square Root
Find the domain and derivative of
Step 1: Combine the original-function restrictions. The square root requires \(x-1\geq 0\), so \(x\geq 1\). The denominator requires \(x\neq 3\). The logarithm requires the quotient to be positive. Since \(\sqrt{x-1}=0\) at \(x=1\), the logarithm’s argument is not positive there. For \(x>1\), the square root is positive, so the quotient is positive exactly when \(x-3>0\). Combining the conditions gives \(x>3\). Thus the domain is \((3,\infty)\).
Step 2: Differentiate on the domain. For \(x>3\), the logarithm argument is positive, and logarithm rules allow
Therefore,
Check: At \(x=4\), the original logarithm argument is \(\sqrt{3}/1=\sqrt{3}>0\). The derivative formula gives \(1/(2\cdot3)-1/1=1/6-1=-5/6\). Differentiating the two logarithmic terms gives the same values \(1/6\) and \(1\), hence the same derivative, \(-5/6\). The domain condition \(4>3\) is satisfied.
When the Formula Fails but the Composite Has a Derivative
The square-root formula requires a positive radicand. If the radicand is zero, this formula gives no conclusion about differentiability of the composite. The chain rule requires the outer function to be differentiable at the inner function’s value; the square-root function is not differentiable at zero in the ordinary two-sided sense. The composite must instead be examined directly.
Worked Example: A Differentiable Composite at a Zero Radicand
Consider \(f(x)=\sqrt{x^4}\). Determine its derivative, including at \(x=0\).
Step 1: Check the domain. Since \(x^4\geq 0\) for every real \(x\), the original function is defined for all \(x\in\mathbb{R}\).
Step 2: Simplify the composite. Because \(x^2\geq 0\), \(\sqrt{x^4}=\sqrt{(x^2)^2}=x^2\). Therefore \(f(x)=x^2\) for every real \(x\), and \(f'(x)=2x\).
Step 3: Check the exceptional input directly. At \(x=0\), the derivative definition gives
Check: The simplified function \(x^2\) has derivative \(2x\), which gives \(f'(0)=0\), agreeing with the difference-quotient calculation. The direct chain-rule expression would be \(4x^3/(2\sqrt{x^4})\), which is undefined at \(x=0\). That failure means the formula cannot be used there; it does not mean the composite lacks a derivative.
A Common Mistake: Confusing the Formula with the Function
For \(f(x)=\ln(x^2-4)\), it is incorrect to say that the domain is all real numbers except \(\pm2\), just because those values make the derivative denominator zero. That checks only whether the derivative expression is defined. The original logarithm imposes a stronger condition:
Thus the function and its derivative are defined on \((-\infty,-2)\cup(2,\infty)\), not on the intervals between \(-2\) and \(2\). The mistaken approach checks for a nonzero logarithm argument, but a logarithm needs a positive argument. The correction is to apply the original function’s domain condition first, before differentiating.
A Reliable Domain-Check Routine
Mark every logarithm argument, square-root radicand, and denominator.
Require logarithm arguments to be positive, radicands to be nonnegative, and denominators to be nonzero.
An input is allowed only if every restriction is satisfied at once.
Check the hypotheses of the relevant derivative formula, especially at zero radicands.
If the original function exists there, the formula alone does not determine whether the composite is differentiable.
These checks matter because a derivative is a limit of function values near an input. If the original function is not defined at an input, there is no derivative there. If the function is defined but a formula is unavailable, further reasoning may be needed. Keeping those two questions separate prevents both invalid derivatives and missed differentiability.
Check Your Understanding
For each question, first identify the original function’s domain, then decide where the stated derivative formula applies.
- Find the domain and derivative of \(f(x)=\ln(7-x)\).
- For \(g(x)=\sqrt{x+4}\), compare the function domain with the domain of the usual chain-rule derivative formula.
- Find the domain and derivative of \(h(x)=\frac{1}{x^2-9}\).
- Why does an undefined square-root chain-rule formula at a zero radicand not automatically prove that the composite is not differentiable there?
- For \(p(x)=\ln\left(\frac{\sqrt{x}}{x-2}\right)\), determine the domain by combining the restrictions.