Math Core

Lesson 3.1 · Composite, Implicit and Inverse Functions

The chain rule

You can now differentiate powers, sums, products, quotients and the basic trig, exponential and log functions. But most functions you meet are built by plugging one function into another, like sin⁡(x2)\sin(x^2) or 3x+1\sqrt{3x + 1}. The chain rule handles every one of these, which makes it the most-used rule in the whole course.

Functions inside functions

A composite function h(x)=f(g(x))h(x) = f(g(x)) does two jobs in order: first the inner function gg acts on xx, then the outer function ff acts on the result. For example,

functioninner g(x)g(x)outer f(u)f(u)
(3x2+1)5(3x^2 + 1)^53x2+13x^2 + 1u5u^5
sin⁡(x3)\sin(x^3)x3x^3sin⁡u\sin u
ecos⁡xe^{\cos x}cos⁡x\cos xeue^u
4−x2\sqrt{4 - x^2}4−x24 - x^2u\sqrt{u}

A quick way to find the outer function: ask yourself, "What is the last thing I would do if I evaluated this on a calculator?" For (3x2+1)5(3x^2 + 1)^5 you would compute 3x2+13x^2 + 1 first and raise it to the 5th power last, so the outer function is the 5th power.

Why rates multiply

Think of the composite as a chain of machines. Suppose u=g(x)u = g(x) and y=f(u)y = f(u). If uu changes 3 times as fast as xx, and yy changes 2 times as fast as uu, then yy changes 2⋅3=62 \cdot 3 = 6 times as fast as xx. Rates of change along a chain multiply.

In Leibniz notation this looks almost like canceling fractions:

dydx=dydu⋅dudx.\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}.

(They are not really fractions, but the notation is designed so that this memory aid works.)

The chain rule

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).

In words: differentiate the outer function, leaving the inside alone, then multiply by the derivative of the inside.

Notice what "leaving the inside alone" means. In f′(g(x))f'(g(x)), the derivative f′f' is evaluated at g(x)g(x), not at xx. That detail matters a lot when you work from a table of values.

The graph below shows the effect of a simple inner function. The curve y=sin⁡(2x)y = \sin(2x) runs through a full wave twice as fast as y=sin⁡xy = \sin x, so its slopes are twice as steep: ddxsin⁡(2x)=cos⁡(2x)⋅2\dfrac{d}{dx}\sin(2x) = \cos(2x) \cdot 2.

y = sin x and y = sin(2x). The inner function 2x speeds everything up by a factor of 2, and the chain rule multiplies the slope by 2.Open in grapher →

Using the chain rule

Worked example: A power of a polynomial

Differentiate y=(3x2+1)5y = (3x^2 + 1)^5.

Solution. The outer function is u5u^5 with derivative 5u45u^4. The inner function is u=3x2+1u = 3x^2 + 1 with derivative 6x6x.

dydx=5(3x2+1)4⋅6x=30x(3x2+1)4.\frac{dy}{dx} = 5(3x^2 + 1)^4 \cdot 6x = 30x(3x^2 + 1)^4.

Expanding (3x2+1)5(3x^2+1)^5 first would also work, but it would take far longer and invite arithmetic mistakes.

Worked example: Trig, exponential and log outer functions

Differentiate each function.

  1. y=sin⁡(x3)y = \sin(x^3)
  2. y=ecos⁡xy = e^{\cos x}
  3. y=ln⁡(x2+4)y = \ln(x^2 + 4)

Solutions.

  1. Outer sin⁡u→cos⁡u\sin u \to \cos u; inner x3→3x2x^3 \to 3x^2. So y′=cos⁡(x3)⋅3x2=3x2cos⁡(x3)y' = \cos(x^3) \cdot 3x^2 = 3x^2\cos(x^3).
  2. Outer eu→eue^u \to e^u; inner cos⁡x→−sin⁡x\cos x \to -\sin x. So y′=ecos⁡x⋅(−sin⁡x)=−sin⁡x ecos⁡xy' = e^{\cos x} \cdot (-\sin x) = -\sin x \, e^{\cos x}.
  3. Outer ln⁡u→1u\ln u \to \dfrac{1}{u}; inner x2+4→2xx^2 + 4 \to 2x. So y′=1x2+4⋅2x=2xx2+4y' = \dfrac{1}{x^2 + 4} \cdot 2x = \dfrac{2x}{x^2 + 4}.

The pattern in part 3 is worth remembering: ddxln⁡(g(x))=g′(x)g(x)\dfrac{d}{dx}\ln(g(x)) = \dfrac{g'(x)}{g(x)}.

Worked example: More than two layers

Differentiate y=cos⁡3(2x)y = \cos^3(2x).

Solution. First rewrite so the layers are visible: y=(cos⁡(2x))3y = \big(\cos(2x)\big)^3. There are three layers: cube, then cosine, then 2x2x. Peel them from the outside in, multiplying as you go.

dydx=3(cos⁡(2x))2⋅ddxcos⁡(2x)=3cos⁡2(2x)⋅(−sin⁡(2x))⋅2=−6cos⁡2(2x)sin⁡(2x).\begin{aligned} \frac{dy}{dx} &= 3\big(\cos(2x)\big)^2 \cdot \frac{d}{dx}\cos(2x) \\ &= 3\cos^2(2x) \cdot \big(-\sin(2x)\big) \cdot 2 \\ &= -6\cos^2(2x)\sin(2x). \end{aligned}

Worked example: Working from a table

The table gives values of differentiable functions ff and gg. Let h(x)=f(g(x))h(x) = f(g(x)). Find h′(1)h'(1).

xxf(x)f(x)f′(x)f'(x)g(x)g(x)g′(x)g'(x)
1643−2
35718

Solution. By the chain rule, h′(1)=f′(g(1))⋅g′(1)h'(1) = f'(g(1)) \cdot g'(1). From the table, g(1)=3g(1) = 3, so we need f′(3)=7f'(3) = 7, not f′(1)f'(1). Then

h′(1)=f′(3)⋅g′(1)=7⋅(−2)=−14.h'(1) = f'(3) \cdot g'(1) = 7 \cdot (-2) = -14.

Common mistake

The two most common chain rule mistakes:

  • Forgetting the inner derivative. ddxsin⁡(5x)\dfrac{d}{dx}\sin(5x) is 5cos⁡(5x)5\cos(5x), not cos⁡(5x)\cos(5x).
  • Evaluating f′f' at the wrong input. In a table problem, h′(a)=f′(g(a)) g′(a)h'(a) = f'(g(a))\,g'(a). Look up g(a)g(a) first, then find f′f' at that value.

Tip

When an answer has no inner derivative factor, check whether the inside was just xx. The chain rule is always in play; when the inner function is xx, its derivative is 1 and the factor is invisible.

On the AP exam the chain rule rarely appears alone. It sits inside product rule, quotient rule, implicit differentiation and related rates problems, so fluency here pays off for the rest of the year.

Practice

Practice 1

Find dydx\dfrac{dy}{dx} if y=(4x−7)6y = (4x - 7)^6.

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 2

Find dydx\dfrac{dy}{dx} if y=e3x2y = e^{3x^2}.

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 3

Find f′(x)f'(x) if f(x)=x2+9f(x) = \sqrt{x^2 + 9}.

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 4

Find dydx\dfrac{dy}{dx} if y=ln⁡(cos⁡(3x−1))y = \ln\big(\cos(3x - 1)\big).

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 5

Let h(x)=f(g(x))h(x) = f(g(x)), where g(1)=3g(1) = 3, g′(1)=−2g'(1) = -2, f′(1)=4f'(1) = 4 and f′(3)=5f'(3) = 5. Find h′(1)h'(1).

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

Find dydx\dfrac{dy}{dx} if y=2sin⁡3(x2)y = 2\sin^3(x^2).

Enter an expression, e.g. 3x^2 - 2x + 1

Practice 7

(AP-style) What is the slope of the line tangent to the graph of y=(x2−3)4y = (x^2 - 3)^4 at x=2x = 2?

Practice 8

(AP-style) If f(x)=esin⁡(πx)f(x) = e^{\sin(\pi x)}, what is f′(1)f'(1)?