Tutorials › AP Calculus › Mixed Composition Derivative Workshop

Chain Rule and Nested Functions · Tutorial 180 of 999

Mixed Composition Derivative Workshop

Build a reliable layer-by-layer method for differentiating mixed compositions and checking that every inner derivative factor is included.

Intermediate 9 min read

What You'll Learn

  • Identify the outer and inner functions in a nested expression.
  • Apply the chain rule through several layers in the correct order.
  • Combine chain-rule factors with quotient, trigonometric, exponential, and logarithmic derivatives.
  • Check the differentiability and domain conditions for a composition.
  • Detect missing inner derivative factors and distinguish them from other derivative-rule errors.
  • Verify a derivative by tracing its factors back to the layers of the original function.

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.

Chain Rule: If \(y=F(u)\) and \(u=g(x)\), with \(F\) differentiable at \(g(x)\) and \(g\) differentiable at \(x\), then $$ \frac{dy}{dx}=F'(g(x))g'(x). $$ For a deeper composition, apply this rule repeatedly. Each layer contributes its derivative, evaluated at the expression inside that layer.

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.

$$ \frac{du}{dx}=6x-2. $$

Step 4: Multiply the layer derivatives.

$$ \frac{dy}{dx} =5u^4(6x-2) =5(3x^2-2x+1)^4(6x-2). $$

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

$$ \frac{dq}{dx} = \frac{(2x)(x+1)-(x^2+1)(1)}{(x+1)^2} = \frac{2x^2+2x-x^2-1}{(x+1)^2} = \frac{x^2+2x-1}{(x+1)^2}. $$

Step 3: Multiply by the derivative of the sine layer.

$$ \frac{dy}{dx} = \cos(q)\frac{dq}{dx} = \cos\left(\frac{x^2+1}{x+1}\right) \frac{x^2+2x-1}{(x+1)^2}, \qquad x\ne -1. $$

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.

$$ \frac{dy}{dv}=e^v, \qquad \frac{dv}{dw}=\frac{1}{2\sqrt{w}}, \qquad \frac{dw}{dx}=8x. $$

Step 3: Multiply the factors and replace the temporary variables.

$$ \frac{dy}{dx} = e^v\frac{1}{2\sqrt{w}}(8x) = e^{\sqrt{1+4x^2}}\frac{4x}{\sqrt{1+4x^2}}. $$

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

$$ \frac{da}{dx} = 2\sin(3x)\cos(3x)(3) = 6\sin(3x)\cos(3x). $$

Step 3: Include the logarithm's derivative factor.

$$ \frac{dy}{dx} = \frac{1}{a}\frac{da}{dx} = \frac{6\sin(3x)\cos(3x)}{1+\sin^2(3x)}. $$

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:

$$ F(g(x+h))-F(g(x)) = F'(g(x))\bigl(g'(x)h+o(h)\bigr)+o(k). $$

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

$$ \frac{d}{dx}F(g(x)) = F'(g(x))g'(x). $$

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

$$ \frac{d}{dx}\sin(3x) = \cos(3x)\cdot 3 = 3\cos(3x). $$

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.

Key takeaway: Name the nested expressions, differentiate one layer at a time, multiply every derivative factor, then check that each factor corresponds to a layer in the original function.

Check Your Understanding

For each derivative, identify the layers before simplifying. State any domain restriction that affects the derivative.

  1. Differentiate \(y=(2x^3+1)^4\).
  2. Differentiate \(y=\cos\left(\frac{x}{x+2}\right)\) and state the restriction on \(x\).
  3. Differentiate \(y=e^{\sqrt{2+x}}\) on its real domain.
  4. Differentiate \(y=\ln(1+\cos^2 x)\).
  5. For \(y=\sin(5x)\), show the missing factor in the incorrect derivative \(y'=\cos(5x)\).

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