Partial differentiation

Chapter 3
Partial di↵erentiation
3.1
Introduction to partial di↵erentiation
Many quantities that we measure are functions of two or more variables.
Example 3.1. The temperature T of a rod heated suddenly from time t = 0 at one end.
Figure 3.1: The rod is heated at the end x = 0. Initially, T = 0.
Clearly T depends on:
i The distance x from the heated end
ii The time t after heating commenced.
So we write
T = T (x, t),
i.e. T is a function of the two independent variables: x and t.
Example 3.2. (More abstractly), suppose that a function f is defined as
f (x, y) = x2 + 3y 2 ,
then the value of f is determined by every possible pair (x, y), so if (x, y) = (0, 2) then
f (0, 2) = 02 + 3 ⇥ 22 = 12.
Partial derivatives generalise the derivative to functions of two or more variables.
28
CHAPTER 3. PARTIAL DIFFERENTIATION
29
Definition 3.1. Suppose f is a function of two independent variables x and y, then the
partial derivative of f (x, y) w.r.t x is defined as
@f
f (x +
= fx = lim
x!0
@x
x, y)
x
f (x, y)
.
Similarly, the partial derivative of f (x, y) w.r.t y is
@f
f (x, y +
= fy = lim
y!0
@y
y)
y
f (x, y)
.
But. . . there’s a shortcut! If you want fx , say, then just pretend that y is a constant and
di↵erentiate with respect to x only. Similarly, when you want fy , simply pretend that x is
constant and go ahead with di↵erentiating with respect to y only. And yes, this lets you
use (most) of the tricks we have from Chapter 1!
Example 3.3. For the function f defined by
f (x, y) = x2 + 3y 2 ,
find the partial derivative of f w.r.t x by
i Di↵erentiating from first principles:
@f
@x
x, y) f (x, y)
x!0
x
(x + x)2 + 3y 2 (x2 + 3y 2 )
= lim
x!0
x
2x x + ( x)2
= lim
x!0
x
= 2x.
=
lim
f (x +
ii Di↵erentiating w.r.t x, treating y as a constant. Then we can ignore the term 3y 2
because it vanishes, hence we end up with:
@f
= 2x,
@x
as above.
We can also find the partial derivative of f w.r.t y. . .
i Again, we use the definition:
@f
@y
y) f (x, y)
y
2
x + 3(y + y)2 (x2 + 3y 2 )
= lim
y!0
y
3(2y y + ( y)2 )
= lim
y!0
y
= 6y.
=
lim
y!0
f (x, y +
CHAPTER 3. PARTIAL DIFFERENTIATION
30
ii Alternatively, if we di↵erentiate f w.r.t y, treating x as a constant, we see that the
x2 term vanishes, leaving us with
@f
= 6y,
@y
as expected.
Physical Interpretation: Consider the heated rod problem.
Figure 3.2: Plots showing how temperature T varies with respect to t and to x separately.
a In the top graph of Figure 3.2,
@T
@t
is the rate of change of T with time at a fixed distance x.
b In bottom graph of the same figure,
a particular instance in time.
@T
@x
is the rate of change of T with distance x at
Example 3.4. Suppose
f (x, y) = y sin x + x cos2 y,
Then for the partial derivative fx
@f
= y cos x + cos2 y
@x
where we treated y as a constant.
Meanwhile,
@f
@y
= sin x + 2x cos y( sin y)
= sin x
x sin 2y
where we treated x as a constant.
Example 3.5. Suppose
f (x, y) = tan
then compute fx and fy .
Recall that
d
tan
du
1
u =
1
⇣y⌘
x
1
1 + u2
CHAPTER 3. PARTIAL DIFFERENTIATION
31
Therefore, calculating fx (treating y as a constant):
1
@ ⇣y⌘
1
fx =
=
y 2 @x x
1+ x
1 + xy
2
⇣
y⌘
,
x2
i.e
@f
y
= fx =
.
2
@x
x + y2
Similarly, calculating fy (treating x as a constant):
1
@ ⇣y⌘
1
fy =
=
y 2 @y x
1+ x
1 + xy
i.e
2
✓ ◆
1
,
x
@f
x
= fy = 2
.
@y
x + y2
Example 3.6 (Exam Question 2008). If a function f (x, y) is defined as
✓ ◆
x
f (x, y) = x ln
,
y
then find
@f
@x
and
@f
@y .
Solution: Note that
so for the x derivative,
✓ ◆
x
f (x, y) = x ln
= x (ln x
y
@f
= 1 · (ln x
@x
ln y) + x
ln y) + ⇢
x·
= (ln x
✓
ln y) ,
1
x
1
x
⇢
0
◆
= ln x ln y + 1
✓ ◆
x
= ln
+ 1.
y
Meanwhile, for the y derivative
@f
=0
@y
=
=
@
(x ln y)
@y
@
x (ln y)
@y
x
.
y
Example 3.7 (Function with three variables). Suppose f (x, y, z) is defined as
f (x, y, z) = zey cos x
then
@f
@x
@f
@y
@f
@y
=
zey sin x,
= zey cos x,
= ey cos x.
CHAPTER 3. PARTIAL DIFFERENTIATION
3.2
32
Higher Partial Derivatives
You can di↵erentiate the first partial derivatives again to obtain second partial derivatives.
✓ ◆
@ @f
@2f
fxx =
=
@x @x
@x2
✓ ◆
@ @f
@2f
fyy =
=
@y @y
@y 2
✓ ◆
@ @f
@2f
fxy =
=
@y @x
@y@x
✓ ◆
@ @f
@2f
fyx =
=
@x @y
@x@y
Example 3.8. For the function
f = tan
we are given that
1
✓ ◆
x
,
y
y
x
, fy =
.
x2 + y 2
x2 + y 2
by treating y as constant and applying the quotient rule:

@
@
y
fxx =
[fx ] =
2
@x
@x x + y 2
0 y(2x)
2xy
=
=
.
2
2
2
2
(x + y )
(x + y 2 )2
fx =
We calculate fxx
In a similar fashion,
fyy =
=
and
fxy =
=
=

@
@
x
[fy ] =
@y
@y x2 + y 2
0 ( x)(2y)
2xy
= 2
2
2
2
(x + y )
(x + y 2 )2

@
@
y
[fx ] =
2
@y
@y x + y 2
2
2
(x + y ) y(2y)
(x2 + y 2 )2
x2 + y 2 2y 2
x2 y 2
=
.
(x2 + y 2 )2
(x2 + y 2 )2
And finally,
fyx =
=
=

@
@
x
[fy ] =
2
@x
@x x + y 2
(x2 + y 2 )( 1) ( x)(2x)
(x2 + y 2 )2
x2 y 2
= fxy .
(x2 + y 2 )2
CHAPTER 3. PARTIAL DIFFERENTIATION
33
Fact: If fx , fy , fxy and fyx are continuous (i.e. doesn’t ’jump’) at (x, y), then fxy = fyx ,
i.e. fyx = fxy holds for any f .
Example 3.9. Let
f (x, y) = xe2y .
fx = e2y
fxy = 2e2y
fxyy = 4e2y
fy = 2xe2y
fyx = 2e2y
fyxy = 4e2y
fy = 2xe2y
fyy = 4xe2y
fyyx = 4e2y
i.e.
fxyy = fyxy = fyyx
so the order does not matter.
Example 3.10 (Exam Question 2004).
solution of the equation
a) Verify that f (x, y) = e
@f
@2f
=
@x
@y 2
(1+a2 )x cos ay
f.
Solution: First compute the required derivatives
@f
@x
@f
@y
@2f
@y 2
=
(1 + a2 )e
=
ae
=
a2 e
(1+a2 )x
(1+a2 )x
cos ay
sin ay
(1+a2 )x
cos ay
So computing the RHS (right hand side)
RHS = fyy
f
(1+a2 )x
2
=
a e
2
=
(1 + a )e
cos ay
(1+a2 )x
e
(1+a2 )x
cos ay
cos ay = LHS.
b Let g = yf (xy). Show that
y
@g
@y
x
@g
= g.
@x
Solution:
@g
@y
@g
@x
= = f (xy) + yxf 0 (xy),
= y 2 f 0 (xy),
where primes denote di↵erentiation w.r.t the combined variable xy.
Note: To see this, consider
d
(sin 2x) = 2 cos 2x,
dx
is a
CHAPTER 3. PARTIAL DIFFERENTIATION
i.e
d
(f (2x)) = 2f 0 (2x).
dx
Also consider
@
(sin xy) = y cos xy,
@x
and therefore
@
(f (xy)) = yf 0 (xy).
@x
Hence returning to the example,
⇠
⇠
2⇠
LHS = yf (xy) + ⇠
xy⇠
f 0 (xy)
as required.
⇠⇠ = g(x, y) = RHS,
2⇠
xy⇠
f 0 (xy)
⇠
34