Tutorials › AP Calculus › Differentiating a Single Composite Layer

Chain Rule and Nested Functions · Tutorial 164 of 999

Differentiating a Single Composite Layer

Identify the inner and outer functions in a one-layer composition, then multiply their derivatives in the correct order.

Intermediate 9 min read

What You'll Learn

  • Identify the inner expression and outer function in a one-layer composition
  • Write the chain rule using function notation and derivative notation
  • Differentiate examples such as a power of a linear expression and cosine of a linear angle
  • Keep the outer derivative and inner derivative as separate factors
  • Check a composite derivative with an independent calculation
  • Recognize and correct the mistake of omitting the inner derivative

Why a Composite Derivative Has Two Factors

A composite function applies one function to the output of another. For example, in \((3x+2)^5\), the expression \(3x+2\) is calculated first, and then its value is raised to the fifth power. Differentiating the whole expression requires tracking both changes: how the outer power changes when its input changes, and how the inner expression changes as \(x\) changes.

The chain rule combines these two rates of change by multiplication. In this tutorial, the focus is a single composite layer: one inner function followed by one outer function. The practical habit is to write the outer derivative and inner derivative as separate factors before simplifying.

Key idea: For a composition \(y=f(g(x))\), differentiate the outer function while keeping its input \(g(x)\), then multiply by the derivative of the inner function \(g(x)\).

Identify the Inner and Outer Functions

Suppose \(y=(3x+2)^5\). The inner function is \(g(x)=3x+2\). The outer function takes an input \(u\) and raises it to the fifth power, so \(f(u)=u^5\). Using a separate placeholder \(u\) makes the roles clear: \(y=f(g(x))\).

The placeholder \(u\) is not an additional variable whose value must be found. It simply marks the input to the outer function. Its value in this composition is \(u=g(x)=3x+2\).

Definition: A one-layer composition has the form \(y=f(g(x))\), where \(g\) is the inner function and \(f\) is the outer function. If \(g\) is differentiable at \(x\) and \(f\) is differentiable at \(g(x)\), the chain rule gives the derivative of the composition at \(x\).

The Chain Rule for One Layer

The chain rule is the result used for every example in this tutorial. It says to evaluate the derivative of the outer function at the inner function's output, then multiply by the derivative of the inner function.

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

In Leibniz notation, if \(u=g(x)\) and \(y=f(u)\), the same rule is written as a product of two factors:

$$ \frac{dy}{dx} = \frac{dy}{du}\frac{du}{dx}. $$

Here, \(\frac{dy}{du}\) means the derivative of the outer relationship \(y=f(u)\), and \(\frac{du}{dx}\) means the derivative of the inner relationship \(u=g(x)\). The notation highlights the order of the factors; the rule is justified by the chain rule, not by treating these symbols as ordinary fractions.

Why the Factors Multiply

The multiplication reflects how small changes pass through the two functions. If \(x\) changes by a small amount, the inner output changes at a rate of \(g'(x)\) units per unit of \(x\). The outer output then changes at a rate of \(f'(g(x))\) units per unit of the inner output. Combining the rates gives the change in the outer output per unit of \(x\).

More precisely, the local linear approximation for the inner function is \(\Delta u \approx g'(x)\Delta x\). The outer function's local linear approximation is \(\Delta y \approx f'(g(x))\Delta u\). Substituting the first relationship into the second gives \(\Delta y \approx f'(g(x))g'(x)\Delta x\). Dividing by \(\Delta x\) and taking the limit as \(\Delta x\) approaches zero gives the chain rule. This explains why the inner derivative is necessary: a change in \(x\) first produces a change in the input to the outer function.

Worked Examples

Worked Example: Differentiate a Fifth Power of a Linear Expression

Differentiate \(y=(3x+2)^5\). Then verify the result by expanding the original expression.

Step 1: Identify the layers. Let \(u=3x+2\), so \(y=u^5\). The outer function is \(f(u)=u^5\), and the inner function is \(g(x)=3x+2\).

Step 2: Differentiate each layer. The outer derivative is \(\frac{dy}{du}=5u^4\). The inner derivative is \(\frac{du}{dx}=3\).

Step 3: Multiply the factors and substitute \(u=3x+2\).

$$ \frac{dy}{dx} = \frac{dy}{du}\frac{du}{dx} = 5u^4\cdot 3 = 15u^4 = 15(3x+2)^4. $$

Check by expansion. The binomial expansion is \((3x+2)^5=243x^5+810x^4+1080x^3+720x^2+240x+32\). Differentiating term by term gives \(1215x^4+3240x^3+3240x^2+1440x+240\). Also, \((3x+2)^4=81x^4+216x^3+216x^2+96x+16\), so \(15(3x+2)^4=1215x^4+3240x^3+3240x^2+1440x+240\). The two derivatives agree.

Worked Example: Differentiate Cosine of a Linear Expression

Differentiate \(y=\cos(4x)\), where angles are measured in radians.

Step 1: Identify the layers. Set \(u=4x\). The outer function is \(y=\cos u\), and the inner function is \(u=4x\).

Step 2: Differentiate each layer. The derivative of cosine with respect to its input is \(\frac{dy}{du}=-\sin u\). The inner derivative is \(\frac{du}{dx}=4\).

Step 3: Multiply, then replace \(u\) by \(4x\).

$$ \frac{dy}{dx} = \frac{dy}{du}\frac{du}{dx} = (-\sin u)(4) = -4\sin(4x). $$

Check at \(x=\frac{\pi}{8}\) using the difference quotient. At this input, \(4x=\frac{\pi}{2}\), so the derivative predicted by the formula is \(-4\sin(\frac{\pi}{2})=-4\). Directly, for a nonzero increment \(h\),

$$ \frac{\cos(4(\frac{\pi}{8}+h))-\cos(\frac{\pi}{2})}{h} = \frac{\cos(\frac{\pi}{2}+4h)}{h} = \frac{-\sin(4h)}{h} = -4\frac{\sin(4h)}{4h}. $$

As \(h\) approaches zero, \(\frac{\sin(4h)}{4h}\) approaches \(1\), so the limit is \(-4\). This agrees with the chain-rule result at \(x=\frac{\pi}{8}\).

Worked Example: Use Function Notation and Evaluate at a Point

Let \(y=f(g(x))\), where \(f(u)=u^3+2u\) and \(g(x)=4x-1\). Find \(\frac{dy}{dx}\) at \(x=1\), and check by expanding the composition.

Step 1: Differentiate the outer function. Since \(f(u)=u^3+2u\), its derivative is \(f'(u)=3u^2+2\).

Step 2: Differentiate the inner function. Since \(g(x)=4x-1\), its derivative is \(g'(x)=4\).

Step 3: Apply the chain rule.

$$ \frac{dy}{dx} = f'(g(x))g'(x) = \bigl(3(4x-1)^2+2\bigr)4. $$

At \(x=1\), the inner value is \(g(1)=4(1)-1=3\), and the outer derivative there is \(f'(3)=3(3)^2+2=29\). Therefore, \(\frac{dy}{dx}\big|_{x=1}=29\cdot4=116\).

Check by expansion. The composition expands as \((4x-1)^3+2(4x-1)=64x^3-48x^2+20x-3\). Its derivative is \(192x^2-96x+20\), which at \(x=1\) is \(192-96+20=116\). The result matches.

A Reliable Procedure

When a function has one inner expression inside one outer function, keep the calculation organized in this order:

1
Name the inner function.
Write \(u=g(x)\), or identify the expression playing that role.
2
Differentiate the outer function.
Differentiate with respect to \(u\), leaving the input in place.
3
Differentiate the inner function.
Find \(\frac{du}{dx}\).
4
Multiply and substitute.
Multiply the outer derivative by the inner derivative, then express the result in terms of \(x\).

This order prevents a common confusion: differentiating the outside correctly but forgetting that its input is changing with \(x\). The chain rule applies when the inner function is differentiable at the input and the outer function is differentiable at the resulting inner value.

Common Mistake: Omitting the Inner Derivative

For \(y=\cos(4x)\), an incomplete calculation is to differentiate cosine and stop at \(-\sin(4x)\). That calculation has differentiated the outer function, but it has not accounted for the rate at which \(4x\) changes.

$$ \text{Incorrect: }\frac{d}{dx}\cos(4x)=-\sin(4x). \qquad \text{Correct: }\frac{d}{dx}\cos(4x)=-\sin(4x)\cdot 4=-4\sin(4x). $$

The difference is visible at \(x=\frac{\pi}{8}\). The incorrect expression gives \(-1\), while the correct derivative gives \(-4\), as the difference-quotient check showed. Always account for the inner derivative, even when it is a constant factor.

Why This Method Matters

Many expressions are easiest to understand as a familiar outer function acting on a more complicated input. Recognizing that structure lets you use familiar derivative formulas without treating the entire expression as a new function. It also gives a useful check: each derivative factor has a specific role, and leaving out either one changes the rate of change.

Before simplifying, preserve the product of factors. For example, writing \(5(3x+2)^4\cdot3\) makes the outer and inner contributions visible. It can then be simplified to \(15(3x+2)^4\). This is especially useful when checking work or explaining a derivative to someone else.

Check Your Understanding

For each question, identify the inner and outer functions before calculating.

  1. Differentiate \(y=(2x-5)^4\), and state the two derivative factors before multiplying.
  2. Differentiate \(y=\sin(7x)\). What is the inner derivative?
  3. If \(y=f(g(x))\), \(f'(u)=2u+1\), \(g(x)=3x-2\), and \(g'(x)=3\), write \(\frac{dy}{dx}\) in terms of \(x\).
  4. Explain why \(\frac{d}{dx}\cos(4x)\) is not just \(-\sin(4x)\).
  5. For \(y=(3x+2)^5\), give one independent way to check the chain-rule result.

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