A Layer-by-Layer Approach
A mixed composition can look complicated because several familiar functions are nested inside one another. The reliable approach is to avoid differentiating the whole expression at once. Instead, identify each layer, differentiate the outside layer, and multiply by the derivative of what is inside it. Continue until every layer has been accounted for.
This method applies whether the layers are polynomial, rational, trigonometric, exponential, or logarithmic. The order matters: the derivative factors are written from the outside inward, while the expression being differentiated is built from the inside outward.
For example, in \(y=F(g(h(x)))\), the outer layer is \(F\), the next layer is \(g\), and the innermost layer is \(h\). The derivative is \(F'(g(h(x)))g'(h(x))h'(x)\). Each derivative factor must be evaluated at the appropriate inner expression.
Worked Example: A Power of a Polynomial
Worked Example: A Power of a Polynomial
Differentiate \(y=(3x^2-2x+1)^5\).
Step 1: Name the inner expression. Let \(u=3x^2-2x+1\). Then \(y=u^5\). The outside operation is raising \(u\) to the fifth power.
Step 2: Differentiate the outside layer. The derivative of \(u^5\) with respect to \(u\) is \(5u^4\).
Step 3: Differentiate the inner layer.
Step 4: Multiply the layer derivatives.
Check: The outer derivative contributes \(5(3x^2-2x+1)^4\), and the derivative of the inner polynomial is \(6x-2\). Their product is exactly the displayed derivative, so neither layer has been omitted.
Worked Example: A Trigonometric Function of a Rational Expression
Worked Example: A Trigonometric Function of a Rational Expression
Differentiate \(y=\sin\left(\frac{x^2+1}{x+1}\right)\). The expression is defined when \(x\ne -1\); on that domain, the rational inner function and its sine are differentiable.
Step 1: Identify the two main layers. Let \(q=\frac{x^2+1}{x+1}\), so \(y=\sin(q)\). The derivative of the outer sine layer is \(\cos(q)\).
Step 2: Differentiate the rational layer. Applying the quotient rule to \(q\), with numerator \(x^2+1\) and denominator \(x+1\), gives
Step 3: Multiply by the derivative of the sine layer.
Check: The outer layer contributes \(\cos(q)\). The quotient-rule calculation supplies \(\frac{x^2+2x-1}{(x+1)^2}\), the derivative of \(q\). Substituting the original expression for \(q\) gives the stated result. At \(x=0\), for instance, the inner value is \(1\) and its derivative is \(-1\), so the formula gives \(y'(0)=-\cos(1)\), consistent with the two layer derivatives.
Worked Example: An Exponential of a Radical
Worked Example: An Exponential of a Radical
Differentiate \(y=e^{\sqrt{1+4x^2}}\). The radicand \(1+4x^2\) is positive for every real \(x\), so the square root and the exponential are differentiable throughout the real domain.
Step 1: Separate the layers. Write \(y=e^v\), where \(v=\sqrt{w}\) and \(w=1+4x^2\). There are three layers: the exponential, the square root, and the polynomial.
Step 2: Differentiate each layer.
Step 3: Multiply the factors and replace the temporary variables.
Check: Reading from the outside inward, the factors are the exponential value, the square-root derivative, and the polynomial derivative. Their product is \(e^{\sqrt{1+4x^2}}\cdot\frac{1}{2\sqrt{1+4x^2}}\cdot 8x\), which simplifies to the answer above. At \(x=0\), this gives \(y'(0)=0\), as the innermost derivative \(8x\) is zero there.
Worked Example: A Logarithm of a Trigonometric Expression
Worked Example: A Logarithm of a Trigonometric Expression
Differentiate \(y=\ln(1+\sin^2(3x))\). Since \(\sin^2(3x)\ge 0\), the logarithm's argument is at least \(1\), so the function is defined and differentiable for every real \(x\).
Step 1: Name the layers. Let \(a=1+\sin^2(3x)\). The outside layer is \(y=\ln(a)\), whose derivative with respect to \(a\) is \(1/a\). Inside \(a\) is a square, then a sine, then the linear expression \(3x\).
Step 2: Differentiate the inner expression layer by layer. The derivative of \(1+\sin^2(3x)\) is obtained by differentiating the square, the sine, and then \(3x\):
Step 3: Include the logarithm's derivative factor.
Check: The logarithm contributes \(1/(1+\sin^2(3x))\); the square contributes \(2\sin(3x)\); the sine contributes \(\cos(3x)\); and the linear inside contributes \(3\). Multiplying gives the numerator \(2\cdot 1\cdot 3=6\) times \(\sin(3x)\cos(3x)\), as required. At \(x=\pi/6\), \(\sin(3x)=1\) and \(\cos(3x)=0\), so the formula gives derivative \(0\), matching the zero sine-derivative factor at that point.
Why the Chain Rule Works
The chain rule describes how a small change in an input passes through successive functions. A short derivation makes clear why the derivative factors multiply.
Suppose \(g\) is differentiable at \(x\), and \(F\) is differentiable at \(g(x)\). For a small change \(h\) in \(x\), write \(k=g(x+h)-g(x)\). Differentiability gives the approximations \(k=g'(x)h+o(h)\) and \(F(g(x)+k)-F(g(x))=F'(g(x))k+o(k)\), where each \(o\)-term divided by its stated input tends to zero as that input tends to zero.
Substitute the first change into the second:
Since differentiability of \(g\) implies \(k=O(h)\), the final remainder \(o(k)\) is also \(o(h)\). Dividing by \(h\) and taking the limit as \(h\to 0\) therefore gives
The same reasoning can be applied to each successive pair of layers. That is why a composition with several differentiable layers has one derivative factor for every layer.
A Common Missing-Factor Error
A frequent mistake is to differentiate the outside function but treat its inside expression as if it were simply \(x\). For \(y=\sin(3x)\), the incorrect calculation \(y'=\cos(3x)\) omits the derivative of \(3x\). The correction is
The error is not fixed by changing the trigonometric derivative; the missing factor comes from the inner layer. In a deeper composition, omitting any one inner derivative factor has the same effect. A useful check is to list the layers before calculating and confirm that the final product contains one derivative factor for each.
When This Method Applies
The chain rule requires differentiability at the relevant inputs. In practical AP problems, check that each layer is defined and differentiable at the point or on the interval where a derivative is requested. For example, a logarithm layer requires a positive argument; a rational layer requires a nonzero denominator; and a radical layer may have restrictions on its input or on where its derivative exists.
Once these conditions are satisfied, the outer-to-inner product is a dependable way to organize the computation. It also helps separate different kinds of work: differentiating a rational inner layer may require the quotient rule, while the surrounding layers still contribute their own chain-rule factors.
Check Your Understanding
For each derivative, identify the layers before simplifying. State any domain restriction that affects the derivative.
- Differentiate \(y=(2x^3+1)^4\).
- Differentiate \(y=\cos\left(\frac{x}{x+2}\right)\) and state the restriction on \(x\).
- Differentiate \(y=e^{\sqrt{2+x}}\) on its real domain.
- Differentiate \(y=\ln(1+\cos^2 x)\).
- For \(y=\sin(5x)\), show the missing factor in the incorrect derivative \(y'=\cos(5x)\).