13. Chain Rule & Implicit Differentiation

a. Compositions

By a composition of functions we simply mean that we have a function of a function. Thus, if we have two functions, f(x)f(x) and g(x)g(x), we can form two compositions, f(g(x))f(g(x)) (Read β€œf of g of x.”) and g(f(x))g(f(x)) (Read β€œg of f of x.”). We write f∘gf\circ g and g∘fg\circ f for these two compositions. In other words, (f∘g)(x)=f(g(x))and(g∘f)(x)=g(f(x)) (f\circ g)(x)=f(g(x)) \qquad \text{and} \qquad (g\circ f)(x)=g(f(x)) We read f∘gf\circ g as β€œf composed with g” or β€œf following g”.

To evaluate a composition of functions, we evaluate the inner function at a value, then evaluate the outer function at the first result.

Suppose f(x)=x2f(x)=x^2 and g(x)=4xg(x)=4x, what are (f∘g)(3)(f\circ g)(3) and (g∘f)(3)(g\circ f)(3)?

On the one hand, g(3)=12g(3)=12, and then (f∘g)(3)=f(g(3))=f(12)=144(f\circ g)(3)=f(g(3))=f(12)=144.
On the other hand, f(3)=9f(3)=9, and then (g∘f)(3)=g(f(3))=g(9)=36(g\circ f)(3)=g(f(3))=g(9)=36.
The answers are different!

Suppose p(x)=(1+x2)3p(x)=(1+x^2)^3 and q(x)=(1+x3)2q(x)=(1+x^3)^2, what are (p∘q)(2)(p\circ q)(2) and (q∘p)(2)(q\circ p)(2)?

Answer

(p∘q)(2)=(1+812)3=282558696328(q∘p)(2)=(1+1253)2=3814701171876\begin{aligned} (p\circ q)(2)&=(1+81^2)^3=282\,558\,696\,328 \\ (q\circ p)(2)&=(1+125^3)^2=3\,814\,701\,171\,876 \end{aligned}
They're different!

[Γ—]

Solution

Since q(2)=(1+23)2=81q(2)=(1+2^3)^2=81, we have (p∘q)(2)=p(q(2))=p(81)=(1+812)3=282558696328 (p\circ q)(2)=p(q(2))=p(81)=(1+81^2)^3=282\,558\,696\,328 Since p(2)=(1+22)3=125p(2)=(1+2^2)^3=125, we have (q∘p)(2)=q(p(2))=q(125)=(1+1253)2=3814701171876 (q\circ p)(2)=q(p(2))=q(125)=(1+125^3)^2=3\,814\,701\,171\,876 These are two very big but different numbers!

[Γ—]

The composition can also be evaluated at a variable instead of a number.

Suppose f(x)=x2f(x)=x^2 and g(x)=4xg(x)=4x, what are (f∘g)(x)(f\circ g)(x) and (g∘f)(x)(g\circ f)(x)?

On the one hand, g(x)=4xg(x)=4x, and then (f∘g)(x)=f(g(x))=f(4x)=(4x)2=16x2(f\circ g)(x)=f(g(x))=f(4x)=(4x)^2=16x^2.
On the other hand f(x)=x2f(x)=x^2, and then (g∘f)(x)=g(f(x))=g(x2)=4x2(g\circ f)(x)=g(f(x))=g(x^2)=4x^2.
Notice (f∘g)(x)(f\circ g)(x) and (g∘f)(x)(g\circ f)(x) are different functions.

As a check, notice (f∘g)(3)=16x2∣x=3=16β‹…9=144(f\circ g)(3)=\left.16x^2\right|_{x=3}=16\cdot9=144.
And (g∘f)(3)=4x2∣x=3=4β‹…9=36(g\circ f)(3)=\left.4x^2\right|_{x=3}=4\cdot9=36.
Both of these agree with the first example.

Suppose p(x)=(1+x2)3p(x)=(1+x^2)^3 and q(x)=(1+x3)2q(x)=(1+x^3)^2, what are (p∘q)(x)(p\circ q)(x) and (q∘p)(x)(q\circ p)(x)?

Answer

(p∘q)(x)=(1+(1+x3)4)3(q∘p)(x)=(1+(1+x2)9)2\begin{aligned} (p\circ q)(x)&=(1+(1+x^3)^4)^3 \\ (q\circ p)(x)&=(1+(1+x^2)^9)^2 \end{aligned}

[Γ—]

Solution

Since q(x)=(1+x3)2q(x)=(1+x^3)^2, we have (p∘q)(x)=p(q(x))=p((1+x3)2)=(1+[(1+x3)2]2)3=(1+(1+x3)4)3\begin{aligned} (p\circ q)(x)&=p(q(x))=p((1+x^3)^2)=(1+[(1+x^3)^2]^2)^3 \\ &=(1+(1+x^3)^4)^3 \end{aligned} Since p(x)=(1+x2)3p(x)=(1+x^2)^3, we have (q∘p)(x)=q(p(x))=q((1+x2)3)=(1+[(1+x2)3]3)2=(1+(1+x2)9)2\begin{aligned} (q\circ p)(x)&=q(p(x))=q((1+x^2)^3)=(1+[(1+x^2)^3]^3)^2 \\ &=(1+(1+x^2)^9)^2 \end{aligned} These multiply out to two different polynomials!

[Γ—]

Check

As a check, notice (p∘q)(2)=(1+(1+x3)4)3∣x=2=(1+812)3 (p\circ q)(2) =\left.\rule{0pt}{10pt}(1+(1+x^3)^4)^3\right|_{x=2}=(1+81^2)^3 And (q∘p)(2)=(1+(1+x2)9)2∣x=2=(1+1253)2 (q\circ p)(2) =\left.\rule{0pt}{10pt}(1+(1+x^2)^9)^2\right|_{x=2}=(1+125^3)^2 Both of these agree with exercise 2.

[Γ—]

It is confusing for f(x)f(x) and g(x)g(x), to both have the same variable xx. So we frequently write something like z=f(y)z=f(y) and y=g(x)y=g(x). Then z=f(g(x))=(f∘g)(x)z=f(g(x))=(f\circ g)(x). Then xx is called the inner variable, yy is called the intermediate variable and zz is called the outer variable.
In the formula y=g(x)y=g(x), xx is independent and yy is dependent.
In the formula z=f(y)z=f(y), yy is independent and zz is dependent.
Overall, in the formula z=(f∘g)(x)z=(f\circ g)(x), xx is independent and zz is dependent.

Suppose an ant is walking in a straight line on a hot frying pan. The position (in mm) of the ant at time tt (in sec) is x(t)=4tx(t)=4t. The temperature of the pan (in ∘^\circC) is T(x)=40+x2T(x)=40+x^2. What is the temperature of the pan as seen by the ant at time tt?

(T∘x)(t)=T(x(t))=40+x(t)2=40+(4t)2=40+16t2 (T\circ x)(t)=T(x(t))=40+x(t)^2=40+(4t)^2=40+16t^2

Although TT is really a function of xx, scientists frequently write T(t)T(t) for this composition: T(t)=T(x(t))=40+16t2 T(t)=T(x(t))=40+16t^2 Even though this is bad notation, scientists do it anyway. We need to be aware of it and we will sometimes do it in this book. Mathematicians call this β€œabuse of notation”.

A fish is swimming in salt water where the density of salt is Ξ΄(x)=(5+x)mgcm3\delta(x)=(5+x) \dfrac{\text{mg}}{\text{cm}^3}. If the fish's position is x(t)=3+t2x(t)=3+t^2 where tt is in sec and xx is in cm, what is the density of the salt Ξ΄(t)\delta(t) at the fish's position at time tt?

Hint

By abuse of notation, Ξ΄(t)=Ξ΄(x(t))\delta(t)=\delta(x(t)).

[Γ—]

Answer

Ξ΄(t)=8+t2\displaystyle \delta(t)=8+t^2

[Γ—]

Solution

We compute the composition: Ξ΄(t)=Ξ΄(x(t))=5+x(t)=5+(3+t2)=8+t2 \delta(t)=\delta(x(t))=5+x(t)=5+(3+t^2)=8+t^2

[Γ—]

Β© 2025 MYMathApps

Supported in part by NSF Grant #1123255