Lecture 13.5: The chain rule
=⇒
Recall the chain rule for a function of a single variable:
d
f (g(x)) = f ′ (g(x)) · g ′(x)
dx
or if y = f (x) and x = g(u)
dy
dy dx
=
·
du
dx du
=⇒
the chain rule is straightforwardly generalized for a function of several vari-
ables:
• let z = f (x(t), y(t)), then
∂z dx ∂z dy
dz
=
·
+
·
dt
∂x dt
∂y dt
• let z = f (x(s, t), y(s, t)), then
∂z
∂z ∂x ∂z ∂y
=
·
+
·
∂s
∂x ∂s ∂y ∂s
∂z ∂x ∂z ∂y
∂z
=
·
+
·
∂t
∂x ∂t
∂y ∂t
1
Example 1 Given u =
p
x2 + y 2, x = est , y = 1 + s2 cos t, compute ∂u
∂t
=⇒
• first method: use the chain rule formula
∂u ∂x ∂u ∂y
x
y
∂u
=
·
+
·
=p
· sest + p
· (−s2 sin t)
2
2
2
2
∂t
∂x ∂t
∂y ∂t
x +y
x +y
=
se2st − s2 sin t(1 + s2 cos t)
p
e2st + (1 + s2 cos t)2
• second method: do the substitution, and then compute the partial derivative
u(t, s) =
p
e2st + (1 + s2 cos t)2
as usual:
compute ∂u
∂t
∂u
1
2st
2
2
2se + 2(1 + s cos t)(−s sin t)
= p
∂t
2 e2st + (1 + s2 cos t)2
=
se2st − s2 sin t(1 + s2 cos t)
p
e2st + (1 + s2 cos t)2
• note that both results are the same, as it must be
2
∂
∂
f (x2 y, x + 2y) and ∂y
f (x2 y, x + 2y), assuming f is differenExample 2: Compute ∂x
tiable and has partial derivatives f1 (x2 y, x + 2y) and f2 (x2 y, x + 2y)
=⇒
using the chain rule
∂
f = f1 · x2 + f2 · 2
∂y
∂
f = f1 · 2xy + f2 · 1 ,
∂x
Example 3: Compute partial derivatives of z = f (g(s, t))
=⇒
• set u = g(s, t)
• using the chain rule,
∂z
df ∂u
=
·
= f ′ (g(s, t)) · g1 (s, t)
∂s
du ∂s
df ∂u
∂z
=
·
= f ′ (g(s, t)) · g2 (s, t)
∂t
du ∂t
3
Example 4: Compute dtd of z = f (x, y, t), where x = g(t) and y = h(t)
=⇒
• using the chain rule,
df
∂f dx ∂f dy ∂f
=
·
+
·
+
dt
∂x dt
∂y dt
∂t
= f1 · g ′ + f2 · h′ + f3
• note that
df
dt
6=
∂f
= f3
∂t
Note: sometimes when writing the partial derivatives, we need to indicate what variables are fixed, e.g.,
• let z = f (x, y, s, t) and x = g(s, t), y=h(s,t)
4
• varying s and keeping t fixed:
∂z
= f1 · g1 + f2 · h1 + f3
∂s t
where
f3 =
∂z
∂s
x,y,t
i.e., we compute the partial s-derivative keeping all x, y, t fixed
• An applied example: consider a thermometer attached to a balloon moving along
the trajectory
~r(t) = x(t)î + y(t)ĵ + z(t)k̂
What is the variation of the temperature T with time?
T =T
x(t), y(t), z(t)
|
{z
}
,
t
|{z}
changes due to ballon motion variation due to weather at fixed position
=⇒
where
dT
= T1 · x′ + T2 · y ′ + T3 · z ′ + T4
dt
∂T
T4 =
∂t
x,y,z
Higher-order derivatives
Example 5: compute
∂2
f (x2 − y 2 , xy)
∂x∂y
=⇒
• Note
∂2
∂ ∂f
2
2
f (x − y , xy) =
∂x∂y
∂x ∂y
5
• set u = x2 − y 2 and v = xy, so that
f1 =
∂f
∂u
f2 =
∂f
∂v
• using the chain rule:
∂f
= f1 · (−2y) + f2 · x = −2yf1 (u, v) + xf2 (u, v)
∂y
• =⇒
∂ ∂f
∂f1
∂f2
= −2y ·
+ f2 + x ·
∂x ∂y
∂x
∂x
∂f1 ∂u ∂f1 ∂v
∂f2 ∂u ∂f2 ∂v
= −2y
+ f2 + x
+
+
∂u ∂x
∂v ∂x
∂u ∂x
∂v ∂x
= −2y f11 · 2x + f12 · y + f2 + x f21 · 2x + f22 · y
which, using f12 = f21 , becomes
= f2 − 4xy · f11 + (2x2 − 2y 2 ) · f12 + xy · f22
6