Lecture 22: Chain Rule

Watch 3Blue1Brown videos on visualizing the chain rule for a further conceptual understanding of the rule.

Chain Rule

If f(x)f(x) and g(x)g(x) are both differentiable, then:

ddx[f(g(x))]=f(g(x))g(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x)

or in Leibniz notation:

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

(Note that this looks like a multiplication of fractions, but it is not. It's a multiplication of two derivatives.)

Example 1:

Task: Find ddx[(x+1)2]\frac{d}{dx}[(x+1)^2]

Solution:
f(x)=x2f(x) = x^2, g(x)=x+1    f(g(x))=(x+1)2g(x) = x+1 \implies f(g(x)) = (x+1)^2
f(x)=2xf'(x) = 2x, g(x)=1g'(x) = 1
ddx[f(g(x))]=f(g(x))g(x)=2(x+1)1=2x+2\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x) = 2(x+1) \cdot 1 = 2x + 2

In Leibniz notation:
ddx[(x+1)2]=ddu[u2]dudx=2u1=2(x+1)\frac{d}{dx}[(x+1)^2] = \frac{d}{du}[u^2] \cdot \frac{du}{dx} = 2u \cdot 1 = 2(x+1) where u=x+1u = x+1

Example 2:

Find ddx[ex]\frac{d}{dx}[e^{-x}]:
Let u=x    ddx[ex]=ddu[eu]dudx=eu(1)=exu = -x \implies \frac{d}{dx}[e^{-x}] = \frac{d}{du}[e^u] \cdot \frac{du}{dx} = e^u \cdot (-1) = -e^{-x}

In Lagrange notation:
f(x)=ex,g(x)=x    f(g(x))=exf(x) = e^x, g(x) = -x \implies f(g(x)) = e^{-x}
f(x)=ex,g(x)=1f'(x) = e^x, g'(x) = -1
    (ex)=(f(g(x)))=f(g(x))g(x)=ex(1)=ex\implies (e^{-x})' = (f(g(x)))' = f'(g(x)) \cdot g'(x) = e^{-x} \cdot (-1) = -e^{-x}

Example 3:

Find ddx[ln(x2+1)]\frac{d}{dx}[\ln(x^2 + 1)]:
Let u=x2+1    ddx[ln(x2+1)]=ddx[ln(u)]=ddu[ln(u)]dudx=1u2x=2xx2+1u = x^2 + 1 \implies \frac{d}{dx}[\ln(x^2 + 1)] = \frac{d}{dx}[\ln(u)] = \frac{d}{du}[\ln(u)] \cdot \frac{du}{dx} = \frac{1}{u} \cdot 2x = \frac{2x}{x^2 + 1}

In Lagrange notation:
f(x)=ln(x),g(x)=x2+1    f(g(x))=ln(x2+1)f(x) = \ln(x), g(x) = x^2 + 1 \implies f(g(x)) = \ln(x^2 + 1)
f(x)=1x,g(x)=2xf'(x) = \frac{1}{x}, g'(x) = 2x
    (ln(x2+1))=(f(g(x)))=f(g(x))g(x)=1x2+12x=2xx2+1\implies (\ln(x^2 + 1))' = (f(g(x)))' = f'(g(x)) \cdot g'(x) = \frac{1}{x^2 + 1} \cdot 2x = \frac{2x}{x^2 + 1}

Example 4:

Task: Let f(x)=3xf(x) = 3^x. Find f(x)f'(x).

Solution:
f(x)=3x=eln(3x)=exln(3)f(x) = 3^x = e^{\ln(3^x)} = e^{x\ln(3)}. (we do this step to make it easier to differentiate by having the base as ee and knowing the derivative of exe^x is exe^x)
Let u=xln(3)    f(x)=euu = x\ln(3) \implies f(x) = e^u.
    f(x)=euu=exln(3)ln(3)=3xln(3)\implies f'(x) = e^u \cdot u' = e^{x\ln(3)} \cdot \ln(3) = 3^x \cdot \ln(3)

Example 5:

Task: Let f(x)=log3(x)f(x) = \log_3(x). Find f(x)f'(x).

Solution:
f(x)=log3(x)=ln(x)ln(3)f(x) = \log_3(x) = \frac{\ln(x)}{\ln(3)}. (using the change of base log rule)
Let u=ln(x)    f(x)=uln(3)u = \ln(x) \implies f(x) = \frac{u}{\ln(3)}.
    f(x)=1ln(3)u=1ln(3)1x=1xln(3)\implies f'(x) = \frac{1}{\ln(3)} \cdot u' = \frac{1}{\ln(3)} \cdot \frac{1}{x} = \frac{1}{x\ln(3)}

General Strategy

  1. Identify the inner and outer functions: What is g(x)g(x) and what is f(x)f(x)?
  2. Differentiate the outer function while leaving the inner function untouched.
  3. Multiply by the derivative of the inner function.

Exercises

1. Practice Chain Rule

Find the derivative using the chain rule:

  1. f(x)=(x2+1)2f(x) = (x^2 + 1)^2
  2. f(x)=ex2f(x) = e^{x^2}
  3. f(x)=ln(4x2+4)f(x) = \ln(4x^2 + 4)
  4. f(x)=2e3x+2f(x) = 2e^{3x+2}
  5. f(x)=4xf(x) = 4^x
Answer Key
  1. f(x)=4x3+4xf'(x) = 4x^3 + 4x
  2. f(x)=2xex2f'(x) = 2x e^{x^2}
  3. f(x)=8x4x2+4f'(x) = \frac{8x}{4x^2 + 4}
  4. f(x)=6e3x+2f'(x) = 6e^{3x+2}
  5. f(x)=4xln(4)f'(x) = 4^x \ln(4)

2. More Chain Rule

Find the derivative of the following functions:

  1. f(x)=3x2+4f(x) = \sqrt{3x^2+4}
  2. f(x)=ln(x2+1)f(x) = \ln (\sqrt{x^2 + 1})
  3. f(x)=(e2x+1+3)4f(x) = (e^{2x+1}+3)^4
  4. f(x)=ln(x)f(x) = \sqrt{\ln(x)}
  5. f(x)=14x3+2f(x) = \frac{1}{\sqrt{4x^3 + 2}}
  6. f(x)=(ln(2x2+1))5f(x) = (\ln(2x^2 + 1))^5
  7. f(x)=log3(2x+5)f(x) = \log_3(2^x + 5)
Answer Key
  1. f(x)=3x3x2+4f'(x) = \frac{3x}{\sqrt{3x^2+4}}
  2. f(x)=x(x2+1)f'(x) = \frac{x}{(x^2 + 1)}
  3. f(x)=4(e2x+1+3)32e2x+1f'(x) = 4(e^{2x+1}+3)^3 \cdot 2e^{2x+1}
  4. f(x)=12xln(x)f'(x) = \frac{1}{2x\sqrt{\ln(x)}}
  5. f(x)=6x2(4x3+2)4x3+2f'(x) = \frac{-6x^2}{(4x^3 + 2)\sqrt{4x^3 + 2}}
  6. f(x)=5(ln(2x2+1))44x2x2+1f'(x) = 5(\ln(2x^2 + 1))^4 \cdot \frac{4x}{2x^2 + 1}
  7. f(x)=2xln(2)ln(3)(2x+5)f'(x) = \frac{2^x \ln(2)}{\ln(3)(2^x + 5)}

3. Even more Chain Rule

  1. The radius of a balloon is increasing over time as r(t)=2t+1r(t)=2t+1. The volume of the balloon is V(r)=43πr3V(r) = \frac{4}{3}\pi r^3.

    • Find dVdt\frac{dV}{dt} in terms of tt.
  2. A chemical's concentration is given by C(t)=e0.2t2C(t) = e^{-0.2t^2}.

    • Find the rate of change of concentration with respect to time.
  3. The brightness BB of a light bulb over time is modeled by:

    B(t)=11+etB(t) = \frac{1}{\sqrt{1+e^{-t}}}

    • Find the rate of change of brightness with respect to time.
Answer Key
  1. dVdt=8π(2t+1)2\frac{dV}{dt} = 8\pi (2t+1)^2
  2. dCdt=0.4te0.2t2\frac{dC}{dt} = -0.4t e^{-0.2t^2}
  3. dBdt=et2(1+et)3/2\frac{dB}{dt} = \frac{e^{-t}}{2(1+e^{-t})^{3/2}}

4. Proofs

  1. Assume that the chain rule and the product rule are true. Prove that the quotient rule is also true.

(Given that ddx[f(x)g(x)]=f(x)g(x)+f(x)g(x)\frac{d}{dx}[f(x)g(x)] = f'(x)g(x) + f(x)g'(x) and ddx[f(g(x))]=f(g(x))g(x)\frac{d}{dx}[f(g(x))] = f'(g(x))g'(x). Prove that ddx[f(x)g(x)]=f(x)g(x)f(x)g(x)g(x)2\frac{d}{dx}[\frac{f(x)}{g(x)}] = \frac{f'(x)g(x) - f(x)g'(x)}{g(x)^2} for any differentiable functions f(x)f(x) and g(x)g(x) with g(x)0g(x) \neq 0.)

  1. Using the chain rule, prove the power rule for any real number nn.

(Given that ddx[f(g(x))]=f(g(x))g(x)\frac{d}{dx}[f(g(x))] = f'(g(x))g'(x). Prove that ddx[xn]=nxn1\frac{d}{dx}[x^n] = nx^{n-1} for any real number nn.)