The Chain Rule

Finding derivatives of composite functions

🔗 The Chain Rule

What is the Chain Rule?

The Chain Rule is one of the most important and widely used differentiation rules. It tells us how to find the derivative of a composite function (a function inside another function).

📊 The Formula

If y=f(g(x))y = f(g(x)), then:

dydx=f(g(x))g(x)\frac{dy}{dx} = f'(g(x)) \cdot g'(x)

Or in Leibniz notation:

dydx=dydududx\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}

where u=g(x)u = g(x).

💡 Memory Trick: "Derivative of the outside times derivative of the inside"


Understanding Composite Functions

A composite function is a function within another function.

Examples of Composite Functions

  1. f(x)=(x2+1)5f(x) = (x^2 + 1)^5 — The function x2+1x^2 + 1 is inside the power of 5
  2. f(x)=sin(3x)f(x) = \sin(3x) — The function 3x3x is inside the sine function
  3. f(x)=ex2f(x) = e^{x^2} — The function x2x^2 is inside the exponential
  4. f(x)=x32xf(x) = \sqrt{x^3 - 2x} — The function x32xx^3 - 2x is inside the square root

The "Outside-Inside" Method

Step-by-Step Process

  1. Identify the outside function and the inside function
  2. Differentiate the outside function (leave the inside alone)
  3. Multiply by the derivative of the inside function

Example Walkthrough

Find the derivative of f(x)=(x2+3x)4f(x) = (x^2 + 3x)^4

Step 1: Identify

  • Outside function: u4u^4 (something to the 4th power)
  • Inside function: u=x2+3xu = x^2 + 3x

Step 2: Differentiate the outside

  • Derivative of u4u^4 is 4u34u^3
  • Replace uu with (x2+3x)(x^2 + 3x): 4(x2+3x)34(x^2 + 3x)^3

Step 3: Multiply by derivative of inside

  • Derivative of (x2+3x)(x^2 + 3x) is 2x+32x + 3
  • Final answer: f(x)=4(x2+3x)3(2x+3)f'(x) = 4(x^2 + 3x)^3(2x + 3)

Common Chain Rule Patterns

Pattern 1: Powers of Functions

If f(x)=[g(x)]nf(x) = [g(x)]^n, then f(x)=n[g(x)]n1g(x)f'(x) = n[g(x)]^{n-1} \cdot g'(x)

Example: (3x21)7(3x^2 - 1)^7

  • Answer: 7(3x21)66x=42x(3x21)67(3x^2 - 1)^6 \cdot 6x = 42x(3x^2 - 1)^6

Pattern 2: Square Roots

If f(x)=g(x)f(x) = \sqrt{g(x)}, then f(x)=g(x)2g(x)f'(x) = \frac{g'(x)}{2\sqrt{g(x)}}

Example: x2+1\sqrt{x^2 + 1}

  • Answer: 2x2x2+1=xx2+1\frac{2x}{2\sqrt{x^2 + 1}} = \frac{x}{\sqrt{x^2 + 1}}

Pattern 3: Functions with Coefficients

If f(x)=g(ax+b)f(x) = g(ax + b), then f(x)=ag(ax+b)f'(x) = a \cdot g'(ax + b)

Example: sin(5x)\sin(5x)

  • Answer: 5cos(5x)5\cos(5x)

⚠️ Common Mistakes

Mistake 1: Forgetting the Chain Rule

Wrong: ddx[(2x+1)3]=3(2x+1)2\frac{d}{dx}[(2x + 1)^3] = 3(2x + 1)^2Right: ddx[(2x+1)3]=3(2x+1)22=6(2x+1)2\frac{d}{dx}[(2x + 1)^3] = 3(2x + 1)^2 \cdot 2 = 6(2x + 1)^2

Mistake 2: Not Simplifying

While (3x21)66x(3x^2 - 1)^6 \cdot 6x is correct, it's better to write 6x(3x21)66x(3x^2 - 1)^6 (constants first).

Mistake 3: Confusing Inside and Outside

Make sure you identify which function is inside and which is outside!


🎯 When to Use the Chain Rule

Use the Chain Rule whenever you see:

  • A function raised to a power (other than just xx)
  • Trig functions with anything other than just xx inside
  • Exponentials with anything other than just xx in the exponent
  • Square roots or other roots of expressions
  • Any function within another function

💡 Quick Test: If you can't apply the Power Rule, Product Rule, or Quotient Rule directly, you probably need the Chain Rule!


Multiple Compositions

Sometimes you need to apply the Chain Rule more than once!

Example: f(x)=sin2(3x)=[sin(3x)]2f(x) = \sin^2(3x) = [\sin(3x)]^2

This has TWO layers:

  1. Outside: squaring function
  2. Middle: sine function
  3. Inside: 3x3x

Solution:

  • Derivative of square: 2sin(3x)2\sin(3x)
  • Times derivative of sine: 2sin(3x)cos(3x)2\sin(3x) \cdot \cos(3x)
  • Times derivative of 3x3x: 2sin(3x)cos(3x)32\sin(3x)\cos(3x) \cdot 3
  • Answer: f(x)=6sin(3x)cos(3x)f'(x) = 6\sin(3x)\cos(3x)

📝 Practice Strategy

  1. Circle the inside function
  2. Box the outside function
  3. Write "outside' × inside'" as a reminder
  4. Apply the formula step by step
  5. Simplify your answer

📚 Practice Problems

1Problem 1medium

Question:

Find the derivative of each function:

a) f(x)=(3x25)7f(x) = (3x^2 - 5)^7 b) g(x)=sin(4x)g(x) = \sin(4x) c) h(x)=ex2+1h(x) = e^{x^2 + 1}

💡 Show Solution

Solution:

Part (a): Chain rule: ddx[f(g(x))]=f(g(x))g(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x)

Let u=3x25u = 3x^2 - 5, then y=u7y = u^7

dydu=7u6\frac{dy}{du} = 7u^6 dudx=6x\frac{du}{dx} = 6x

f(x)=7(3x25)66x=42x(3x25)6f'(x) = 7(3x^2 - 5)^6 \cdot 6x = 42x(3x^2 - 5)^6

Part (b): Let u=4xu = 4x, then y=sinuy = \sin u

dydu=cosu\frac{dy}{du} = \cos u dudx=4\frac{du}{dx} = 4

g(x)=cos(4x)4=4cos(4x)g'(x) = \cos(4x) \cdot 4 = 4\cos(4x)

Part (c): Let u=x2+1u = x^2 + 1, then y=euy = e^u

dydu=eu\frac{dy}{du} = e^u dudx=2x\frac{du}{dx} = 2x

h(x)=ex2+12x=2xex2+1h'(x) = e^{x^2+1} \cdot 2x = 2xe^{x^2+1}

2Problem 2medium

Question:

Find the derivative of f(x)=(2x35x+1)6f(x) = (2x^3 - 5x + 1)^6 using the Chain Rule.

💡 Show Solution

Step 1: Identify the functions

Outside function: u6u^6 (something to the 6th power)

Inside function: u=2x35x+1u = 2x^3 - 5x + 1


Step 2: Apply the Chain Rule

Using ddx[u6]=6u5dudx\frac{d}{dx}[u^6] = 6u^5 \cdot \frac{du}{dx}


Step 3: Find the derivative of the inside

dudx=ddx[2x35x+1]=6x25\frac{du}{dx} = \frac{d}{dx}[2x^3 - 5x + 1] = 6x^2 - 5


Step 4: Put it together

f(x)=6(2x35x+1)5(6x25)f'(x) = 6(2x^3 - 5x + 1)^5 \cdot (6x^2 - 5)

This can also be written as:

f(x)=6(6x25)(2x35x+1)5f'(x) = 6(6x^2 - 5)(2x^3 - 5x + 1)^5

Answer: f(x)=6(6x25)(2x35x+1)5f'(x) = 6(6x^2 - 5)(2x^3 - 5x + 1)^5

3Problem 3medium

Question:

Find the derivative of each function:

a) f(x)=(3x25)7f(x) = (3x^2 - 5)^7 b) g(x)=sin(4x)g(x) = \sin(4x) c) h(x)=ex2+1h(x) = e^{x^2 + 1}

💡 Show Solution

Solution:

Part (a): Chain rule: ddx[f(g(x))]=f(g(x))g(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x)

Let u=3x25u = 3x^2 - 5, then y=u7y = u^7

dydu=7u6\frac{dy}{du} = 7u^6 dudx=6x\frac{du}{dx} = 6x

f(x)=7(3x25)66x=42x(3x25)6f'(x) = 7(3x^2 - 5)^6 \cdot 6x = 42x(3x^2 - 5)^6

Part (b): Let u=4xu = 4x, then y=sinuy = \sin u

dydu=cosu\frac{dy}{du} = \cos u dudx=4\frac{du}{dx} = 4

g(x)=cos(4x)4=4cos(4x)g'(x) = \cos(4x) \cdot 4 = 4\cos(4x)

Part (c): Let u=x2+1u = x^2 + 1, then y=euy = e^u

dydu=eu\frac{dy}{du} = e^u dudx=2x\frac{du}{dx} = 2x

h(x)=ex2+12x=2xex2+1h'(x) = e^{x^2+1} \cdot 2x = 2xe^{x^2+1}

4Problem 4hard

Question:

Find dydx\frac{dy}{dx} if y=cos(3x2)y = \sqrt{\cos(3x^2)}.

💡 Show Solution

Solution:

Rewrite: y=[cos(3x2)]1/2y = [\cos(3x^2)]^{1/2}

This requires chain rule twice (nested composition).

Let u=cos(3x2)u = \cos(3x^2), then y=u1/2y = u^{1/2}

dydu=12u1/2=12u\frac{dy}{du} = \frac{1}{2}u^{-1/2} = \frac{1}{2\sqrt{u}}

Now find dudx\frac{du}{dx} where u=cos(3x2)u = \cos(3x^2):

Let v=3x2v = 3x^2, then u=cosvu = \cos v

dudv=sinv\frac{du}{dv} = -\sin v dvdx=6x\frac{dv}{dx} = 6x

dudx=sin(3x2)6x=6xsin(3x2)\frac{du}{dx} = -\sin(3x^2) \cdot 6x = -6x\sin(3x^2)

Combine:

dydx=12cos(3x2)(6xsin(3x2))\frac{dy}{dx} = \frac{1}{2\sqrt{\cos(3x^2)}} \cdot (-6x\sin(3x^2))

=6xsin(3x2)2cos(3x2)= \frac{-6x\sin(3x^2)}{2\sqrt{\cos(3x^2)}}

=3xsin(3x2)cos(3x2)= \frac{-3x\sin(3x^2)}{\sqrt{\cos(3x^2)}}

5Problem 5hard

Question:

Find dydx\frac{dy}{dx} if y=cos(3x2)y = \sqrt{\cos(3x^2)}.

💡 Show Solution

Solution:

Rewrite: y=[cos(3x2)]1/2y = [\cos(3x^2)]^{1/2}

This requires chain rule twice (nested composition).

Let u=cos(3x2)u = \cos(3x^2), then y=u1/2y = u^{1/2}

dydu=12u1/2=12u\frac{dy}{du} = \frac{1}{2}u^{-1/2} = \frac{1}{2\sqrt{u}}

Now find dudx\frac{du}{dx} where u=cos(3x2)u = \cos(3x^2):

Let v=3x2v = 3x^2, then u=cosvu = \cos v

dudv=sinv\frac{du}{dv} = -\sin v dvdx=6x\frac{dv}{dx} = 6x

dudx=sin(3x2)6x=6xsin(3x2)\frac{du}{dx} = -\sin(3x^2) \cdot 6x = -6x\sin(3x^2)

Combine:

dydx=12cos(3x2)(6xsin(3x2))\frac{dy}{dx} = \frac{1}{2\sqrt{\cos(3x^2)}} \cdot (-6x\sin(3x^2))

=6xsin(3x2)2cos(3x2)= \frac{-6x\sin(3x^2)}{2\sqrt{\cos(3x^2)}}

=3xsin(3x2)cos(3x2)= \frac{-3x\sin(3x^2)}{\sqrt{\cos(3x^2)}}

6Problem 6medium

Question:

Find dydx\frac{dy}{dx} if y=4x2+9y = \sqrt{4x^2 + 9}.

💡 Show Solution

Step 1: Rewrite using exponents

y=4x2+9=(4x2+9)1/2y = \sqrt{4x^2 + 9} = (4x^2 + 9)^{1/2}


Step 2: Identify the functions

Outside function: u1/2u^{1/2}

Inside function: u=4x2+9u = 4x^2 + 9


Step 3: Apply the Chain Rule

dydx=12(4x2+9)1/2ddx[4x2+9]\frac{dy}{dx} = \frac{1}{2}(4x^2 + 9)^{-1/2} \cdot \frac{d}{dx}[4x^2 + 9]


Step 4: Find the derivative of the inside

ddx[4x2+9]=8x\frac{d}{dx}[4x^2 + 9] = 8x


Step 5: Combine and simplify

dydx=12(4x2+9)1/28x\frac{dy}{dx} = \frac{1}{2}(4x^2 + 9)^{-1/2} \cdot 8x

=4x(4x2+9)1/2= 4x(4x^2 + 9)^{-1/2}

=4x4x2+9= \frac{4x}{\sqrt{4x^2 + 9}}

Answer: dydx=4x4x2+9\displaystyle\frac{dy}{dx} = \frac{4x}{\sqrt{4x^2 + 9}}

7Problem 7hard

Question:

Find the derivative of g(x)=(x2+1)3(2x5)4g(x) = (x^2 + 1)^3(2x - 5)^4. (This requires both Product Rule AND Chain Rule!)

💡 Show Solution

This problem requires both the Product Rule and the Chain Rule.


Step 1: Identify that this is a product

Let u=(x2+1)3u = (x^2 + 1)^3 and v=(2x5)4v = (2x - 5)^4

So g(x)=uvg(x) = u \cdot v


Step 2: Apply the Product Rule

g(x)=uv+uvg'(x) = u'v + uv'


Step 3: Find uu' using the Chain Rule

u=(x2+1)3u = (x^2 + 1)^3

u=3(x2+1)22x=6x(x2+1)2u' = 3(x^2 + 1)^2 \cdot 2x = 6x(x^2 + 1)^2


Step 4: Find vv' using the Chain Rule

v=(2x5)4v = (2x - 5)^4

v=4(2x5)32=8(2x5)3v' = 4(2x - 5)^3 \cdot 2 = 8(2x - 5)^3


Step 5: Substitute into Product Rule

g(x)=[6x(x2+1)2][(2x5)4]+[(x2+1)3][8(2x5)3]g'(x) = [6x(x^2 + 1)^2][(2x - 5)^4] + [(x^2 + 1)^3][8(2x - 5)^3]


Step 6: Factor out common terms

Factor out (x2+1)2(2x5)3(x^2 + 1)^2(2x - 5)^3:

g(x)=(x2+1)2(2x5)3[6x(2x5)+8(x2+1)]g'(x) = (x^2 + 1)^2(2x - 5)^3[6x(2x - 5) + 8(x^2 + 1)]

Simplify inside the brackets:

=(x2+1)2(2x5)3[12x230x+8x2+8]= (x^2 + 1)^2(2x - 5)^3[12x^2 - 30x + 8x^2 + 8]

=(x2+1)2(2x5)3[20x230x+8]= (x^2 + 1)^2(2x - 5)^3[20x^2 - 30x + 8]

We can factor out 2:

=2(x2+1)2(2x5)3[10x215x+4]= 2(x^2 + 1)^2(2x - 5)^3[10x^2 - 15x + 4]

Answer: g(x)=2(x2+1)2(2x5)3(10x215x+4)g'(x) = 2(x^2 + 1)^2(2x - 5)^3(10x^2 - 15x + 4)