AP Calculus AB · Topic 3.1 · Reading guide, about 5 min

Differentiating functions inside functions

The chain rule: how to differentiate a function built from an inner and an outer function, with worked examples.

In one minute

Most functions you meet are not a single power or trig function. They are built by feeding one function into another, like 4x2+9\sqrt{4x^2+9} or sin⁡(5x)\sin(5x) or e−x2e^{-x^2}. The chain rule is the tool that differentiates these compositions, and it is the rule you will use more than any other for the rest of the course.

The idea is that a change in xx changes the inner function, and that change then passes through the outer function. The slopes multiply, because each stage stretches or shrinks the change that arrives from the stage before it.

Key terms

Composite function
A function built by applying one function to the output of another, written f(g(x))f(g(x)).
Inner function
The function gg that touches xx first. It sits inside the parentheses, under the radical, or in the exponent.
Outer function
The function ff applied last, to the output of the inner function.
Chain rule
The rule ddxf(g(x))=f′(g(x))⋅g′(x)\frac{d}{dx} f(g(x)) = f'(g(x))\cdot g'(x): differentiate the outside, keep the inside, then multiply by the derivative of the inside.
Leibniz form
The form dydx=dydu⋅dudx\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}, where uu is the inner function and yy depends on uu.
General power rule
For a power of a function, ddx[g(x)]n=n[g(x)]n−1⋅g′(x)\frac{d}{dx}[g(x)]^n = n[g(x)]^{n-1}\cdot g'(x).
Nested composition
A composition with three or more layers, such as sin⁡3(5x)\sin^3(5x), differentiated one layer at a time from the outside in.
Evaluate at the inner value
In f′(g(x))f'(g(x)), the outer derivative is evaluated at g(x)g(x), not at xx.

Finding the inner and outer functions

Before differentiating, name the layers. Ask what you would compute last if you were plugging in a number for xx. That last operation is the outer function. In 4x2+9\sqrt{4x^2+9} you would compute 4x2+94x^2+9 first and take the square root last, so the inner function is 4x2+94x^2+9 and the outer function is the square root.

Sometimes the inner function is hard to spot because the notation hides it. In e−x2e^{-x^2} the inner function is the exponent −x2-x^2. In ln⁡(cos⁡x)\ln(\cos x) the inner function is cos⁡x\cos x. In cos⁡2x\cos^2 x, which means (cos⁡x)2(\cos x)^2, the inner function is cos⁡x\cos x and the outer function is squaring. A good habit is to write uu for the inner function on scratch paper before you start.

The rule in two forms

In function notation, if h(x)=f(g(x))h(x)=f(g(x)), then h′(x)=f′(g(x))⋅g′(x)h'(x)=f'(g(x))\cdot g'(x). Read it aloud as "derivative of the outside, evaluated at the inside, times derivative of the inside." The phrase "evaluated at the inside" matters. The outer derivative is a formula in the inner value, so g(x)g(x) stays in it untouched.

In Leibniz notation, set u=g(x)u=g(x) and y=f(u)y=f(u). Then dydx=dydu⋅dudx\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}. The dudu looks like it cancels, which is a useful memory aid, although the real reason is the multiplication of rates. If yy changes 3 times as fast as uu, and uu changes 2 times as fast as xx, then yy changes 6 times as fast as xx.

Chain rule forms you will use constantly (g stands for any differentiable inner function)
FunctionDerivative
[g(x)]n[g(x)]^nn[g(x)]n−1 g′(x)n[g(x)]^{n-1}\,g'(x)
sin⁡(g(x))\sin(g(x))cos⁡(g(x)) g′(x)\cos(g(x))\,g'(x)
cos⁡(g(x))\cos(g(x))−sin⁡(g(x)) g′(x)-\sin(g(x))\,g'(x)
eg(x)e^{g(x)}eg(x) g′(x)e^{g(x)}\,g'(x)
ln⁡(g(x))\ln(g(x))g′(x)g(x)\frac{g'(x)}{g(x)}
g(x)\sqrt{g(x)}g′(x)2g(x)\frac{g'(x)}{2\sqrt{g(x)}}

Nested layers and tables of values

With three layers, peel from the outside in. For y=sin⁡3(5x)y=\sin^3(5x), the outer layer is the cube, the middle layer is sine, and the inner layer is 5x5x. Then y′=3sin⁡2(5x)⋅cos⁡(5x)⋅5=15sin⁡2(5x)cos⁡(5x)y' = 3\sin^2(5x)\cdot\cos(5x)\cdot 5 = 15\sin^2(5x)\cos(5x). Each layer contributes one factor.

Problems often give a table of values for ff, gg, f′f' and g′g' instead of formulas. Suppose h(x)=f(g(x))h(x)=f(g(x)) with g(2)=3g(2)=3, g′(2)=4g'(2)=4 and f′(3)=−5f'(3)=-5. Then h′(2)=f′(g(2))⋅g′(2)=f′(3)⋅4=−20h'(2)=f'(g(2))\cdot g'(2)=f'(3)\cdot 4=-20. The step that students skip is the first one: you need g(2)g(2) to know where to read f′f'.

A fully worked example

Find the equation of the tangent line to y=4x2+9y=\sqrt{4x^2+9} at x=2x=2.

Step 1: find the point. At x=2x=2 the radicand is 4⋅4+9=254\cdot 4+9=25, so y=5y=5 and the point is (2,5)(2,5).

Step 2: name the layers. The inner function is u=4x2+9u=4x^2+9, with dudx=8x\frac{du}{dx}=8x. The outer function is u=u1/2\sqrt{u}=u^{1/2}, with derivative 12u−1/2\frac{1}{2}u^{-1/2}.

Step 3: multiply. y′=12(4x2+9)−1/2⋅8x=4x4x2+9y'=\frac{1}{2}(4x^2+9)^{-1/2}\cdot 8x=\frac{4x}{\sqrt{4x^2+9}}.

Step 4: evaluate. At x=2x=2, y′=825=85y'=\frac{8}{\sqrt{25}}=\frac{8}{5}.

Step 5: write the line. y−5=85(x−2)y-5=\frac{8}{5}(x-2). As a check, the slope is positive and moderate, which fits a curve that is rising and bending like a hyperbola branch.

How it connects

  • Back to 2.5: the power rule is the special case of the chain rule where the inner function is just xx.
  • Back to 2.8 and 2.9: product and quotient rules still apply, but each factor may now need its own chain rule.
  • Forward to 3.2: implicit differentiation is the chain rule applied to a hidden function of xx called yy.
  • Forward to 6.9: u-substitution is the chain rule run backward, so fluency here pays off in integration.

Common mistakes

  • Forgetting the inner derivative. Writing ddxsin⁡(5x)=cos⁡(5x)\frac{d}{dx}\sin(5x)=\cos(5x) is wrong. The correct answer is 5cos⁡(5x)5\cos(5x). After every outer derivative, ask what the inside did.
  • Changing the inside. The outer derivative of u\sqrt{u} is 12u\frac{1}{2\sqrt{u}}, with the original uu kept intact. Do not differentiate the inside twice or replace it with its derivative.
  • **Reading f′f' at the wrong input.** For h(x)=f(g(x))h(x)=f(g(x)), use f′(g(a))f'(g(a)), not f′(a)f'(a). With tables, compute g(a)g(a) first.
  • Missing a layer. In esin⁡2xe^{\sin 2x} there are three layers: the exponential, sine, and 2x2x. Count them before you start.

How it shows up on the exam

  • Expect short free-response parts that give a composite like e−x2e^{-x^2} or x3+1\sqrt{x^3+1} and ask for a derivative, a slope, or a tangent line at a point.
  • Table questions give values of ff, gg and their derivatives and ask for the derivative of f(g(x))f(g(x)) or g(f(x))g(f(x)) at a specific input. Choosing the order correctly is the whole task.
  • Multiple-choice items mix the chain rule with the product or quotient rule, so one answer choice often differs from another only by a missing inner derivative factor.

Check yourself

  1. For ln⁡(cos⁡x)\ln(\cos x), what are the inner and outer functions, and what is the derivative?
  2. If yy changes 4 times as fast as uu and uu changes −2-2 times as fast as xx, how fast does yy change compared with xx?
  3. How many layers does cos⁡2(e3x)\cos^2(e^{3x}) have, and what factor does each layer contribute?
  4. Why is ddx(x2+1)5\frac{d}{dx}(x^2+1)^5 not equal to 5(x2+1)45(x^2+1)^4?

Practice this topic. AP Practice questions on exactly what this lesson covers, with an explanation for every answer.