Tutorials › Calculus I › Deriving the Chain Rule for Three Nested Functions

Product, Quotient, and Chain Rules · Tutorial 475 of 1495

Deriving the Chain Rule for Three Nested Functions

Learn how two applications of the Chain Rule produce the derivative of three nested functions, with each factor evaluated at the correct input.

Intermediate 9 min read

What You'll Learn

  • State the differentiability conditions for a three-function composition.
  • Apply the Chain Rule first to the outer function and then to the inner composition.
  • Track where each derivative factor is evaluated.
  • Compute and verify derivatives of nested polynomial functions.
  • Identify and correct an omitted inner derivative factor.

Why Three Nested Functions Need Two Chain Rule Applications

A function can be built by feeding the output of one function into another. With three functions, the output of the innermost function becomes the input of the middle function, and that output becomes the input of the outermost function. Keeping track of these inputs is essential when differentiating.

For example, in \(f(g(h(x)))\), the function \(h\) acts first, then \(g\), and finally \(f\). The derivative must account for how a change in \(x\) passes through all three stages. The Chain Rule handles one composition at a time, so we apply it twice.

Key formula: If the functions are differentiable at the required inputs, then the derivative of \(f(g(h(x)))\) is \(f'(g(h(x)))g'(h(x))h'(x)\).

Composition and the Required Inputs

Let \(h\) map an input \(x\) to \(h(x)\), let \(g\) map that result to \(g(h(x))\), and let \(f\) map the final result to \(f(g(h(x)))\). It is useful to name the two compositions that appear along the way:

$$ q(x)=g(h(x)), \qquad F(x)=f(q(x))=f(g(h(x))). $$

In this notation, \(q\) is the inner two-function composition, while \(F\) is the full three-function composition. To differentiate \(F\) at a particular \(x\), the functions must be differentiable at the points where they are used: \(h\) at \(x\), \(g\) at \(h(x)\), and \(f\) at \(g(h(x))\).

Conditions: At a point \(x\), suppose \(h\) is differentiable at \(x\), \(g\) is differentiable at \(h(x)\), and \(f\) is differentiable at \(g(h(x))\). Then the Chain Rule applies to the composition \(f(g(h(x)))\) at \(x\).

The evaluation points matter. The derivative \(h'(x)\) is evaluated at the original input. The derivative \(g'(h(x))\) is evaluated at the output of \(h\). The derivative \(f'(g(h(x)))\) is evaluated at the output of \(g\circ h\). Each derivative is taken with respect to the input of its own function.

Deriving the Three-Function Chain Rule

We can obtain the formula by applying the two-function Chain Rule first to \(F=f\circ q\), and then to \(q=g\circ h\). The first application treats the entire expression \(g(h(x))\) as the input to \(f\). The second differentiates that inner expression.

1
Name the inner composition.
Set \(q(x)=g(h(x))\), so \(F(x)=f(q(x))\).
2
Differentiate the outer composition.
By the Chain Rule, \(F'(x)=f'(q(x))q'(x)\).
3
Differentiate the inner composition.
Since \(q(x)=g(h(x))\), another Chain Rule application gives \(q'(x)=g'(h(x))h'(x)\).
4
Substitute and simplify the notation.
Replace \(q(x)\) and \(q'(x)\) in the formula for \(F'(x)\).

Substitution gives the result:

$$ \begin{aligned} F'(x) &=f'(q(x))q'(x)\\ &=f'(g(h(x)))g'(h(x))h'(x). \end{aligned} $$
Theorem (Chain Rule for three nested functions): Under the differentiability conditions stated above, $$ \frac{d}{dx}f(g(h(x))) = f'(g(h(x)))g'(h(x))h'(x). $$

This derivation explains why there are three factors: one derivative for each function through which the input passes. It also explains their evaluation points. The result of the inner function supplies the input for the middle derivative; the result of the first two functions supplies the input for the outer derivative.

The factors are written from the outermost derivative to the innermost derivative. Since these are ordinary real-valued factors, their multiplication can be rearranged numerically. However, keeping the displayed order helps preserve the relationship between each derivative and its input.

Worked Examples

Worked Example: A Three-Layer Polynomial at a Point

Let \(f(u)=u^2+1\), \(g(v)=3v-2\), and \(h(x)=x^2+1\). Find the derivative of \(f(g(h(x)))\) at \(x=1\).

First evaluate the functions in their order of composition. The innermost value is \(h(1)=1^2+1=2\). Next, \(g(h(1))=g(2)=3(2)-2=4\).

The derivative factors are \(f'(u)=2u\), \(g'(v)=3\), and \(h'(x)=2x\). Their required values are \(f'(4)=2(4)=8\), \(g'(2)=3\), and \(h'(1)=2(1)=2\). Therefore,

$$ \left.\frac{d}{dx}f(g(h(x)))\right|_{x=1} =8\cdot 3\cdot 2 =48. $$

To check, simplify the composition: \(g(h(x))=3(x^2+1)-2=3x^2+1\), so \(f(g(h(x)))=(3x^2+1)^2+1\). Differentiating gives \(2(3x^2+1)(6x)=12x(3x^2+1)\). At \(x=1\), this is \(12(1)(4)=48\), as required.

Worked Example: A Cubic Outer Function

Let \(f(u)=u^3\), \(g(v)=v^2+1\), and \(h(x)=2x-1\). Find the derivative of \(f(g(h(x)))\) at \(x=1\).

Evaluate the function layers: \(h(1)=2(1)-1=1\), \(g(h(1))=g(1)=1^2+1=2\). The derivative functions are \(f'(u)=3u^2\), \(g'(v)=2v\), and \(h'(x)=2\). Thus \(f'(2)=3(2^2)=12\), \(g'(1)=2(1)=2\), and \(h'(1)=2\). Multiplying the factors gives

$$ \left.\frac{d}{dx}f(g(h(x)))\right|_{x=1} =12\cdot 2\cdot 2 =48. $$

For a check, the full composition is \(\big((2x-1)^2+1\big)^3\). Its derivative, using the Chain Rule, is \(3\big((2x-1)^2+1\big)^2\cdot 2(2x-1)\cdot 2\). At \(x=1\), the inner quantity is \(2\) and \(2x-1=1\), so the derivative is \(3(2^2)\cdot 2(1)\cdot 2=12\cdot 2\cdot 2=48\). The two calculations agree.

Worked Example: Tracking Each Input at a Different Value

Let \(f(u)=5u-4\), \(g(v)=v^2\), and \(h(x)=x^3-1\). Find the derivative of \(f(g(h(x)))\) at \(x=2\).

The function values are \(h(2)=2^3-1=8-1=7\), then \(g(h(2))=g(7)=7^2=49\). The derivative functions are \(f'(u)=5\), \(g'(v)=2v\), and \(h'(x)=3x^2\). At the relevant inputs, \(f'(49)=5\), \(g'(7)=2(7)=14\), and \(h'(2)=3(2^2)=12\). Therefore,

$$ \left.\frac{d}{dx}f(g(h(x)))\right|_{x=2} =5\cdot 14\cdot 12 =70\cdot 12 =840. $$

To check, \(f(g(h(x)))=5(x^3-1)^2-4\). Its derivative is \(5\cdot 2(x^3-1)\cdot 3x^2=30x^2(x^3-1)\). At \(x=2\), this equals \(30(4)(7)=120(7)=840\). This agrees with the three-factor calculation.

A Common Error: Losing One of the Stages

A frequent error is to differentiate the outer function and the middle function, but stop before accounting for how the innermost function changes with \(x\). Consider the first worked example. An incomplete calculation might be

$$ f'(g(h(x)))g'(h(x)) =2(3x^2+1)\cdot 3 =6(3x^2+1). $$

This is not the derivative with respect to \(x\): it leaves out \(h'(x)=2x\). The corrected calculation is

$$ f'(g(h(x)))g'(h(x))h'(x) =2(3x^2+1)\cdot 3\cdot 2x =12x(3x^2+1). $$

At \(x=1\), the incomplete expression gives \(24\), while the correct derivative is \(48\). A useful check is to count the functions in the composition: for this three-function composition, the derivative formula must include one factor from each of the three functions.

Why the Evaluation Points Matter

The formula is not just a product of three derivative expressions. Each derivative must be evaluated at the correct stage of the composition. If the inputs are misidentified, the factors may be numerically wrong even when all three derivative functions have been found correctly.

For \(f(g(h(x)))\), follow the values from the inside outward: start with \(x\), compute \(h(x)\), then \(g(h(x))\). The derivative \(h'(x)\) uses the starting value; \(g'(h(x))\) uses the first output; and \(f'(g(h(x)))\) uses the second output. Substituting these inputs before multiplying is a reliable way to avoid confusion.

The same organization is useful when differentiating symbolically. First identify the outer, middle, and inner functions. Then write one derivative factor for each layer, with its input shown. This keeps the composition structure visible even when the resulting expression is complicated.

Summary

To differentiate a composition of three functions, apply the Chain Rule to the outer function and the remaining inner composition, then apply it again to the inner composition. Provided each function is differentiable at the point where it is used, the result is

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

Read the expression from outside to inside: the outer derivative is evaluated at \(g(h(x))\), the middle derivative at \(h(x)\), and the inner derivative at \(x\). Keeping those inputs attached to their derivatives gives a systematic derivation and a dependable way to check the calculation.

Check Your Understanding

For each question, identify the function inputs carefully before evaluating any derivative factors.

  1. State the differentiability conditions needed to apply the three-function Chain Rule at \(x\).
  2. If \(f(u)=u^2\), \(g(v)=v+1\), and \(h(x)=3x\), write the derivative of \(f(g(h(x)))\) as a product of three factors. Do not simplify it.
  3. For \(f(u)=u^3\), \(g(v)=2v\), and \(h(x)=x^2\), evaluate the three derivative factors at \(x=1\) and find their product.
  4. In \(f(g(h(x)))\), at what input is \(g'\) evaluated? At what input is \(f'\) evaluated?
  5. Explain why differentiating only \(f\) and \(g\) does not generally give the derivative with respect to \(x\).

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): 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