Professional Documents
Culture Documents
A function z = f (x, y) has two partial derivatives: ∂z/∂x and ∂z/∂y . These derivatives correspond to each of the independent variables
and can be interpreted as instantaneous rates of change (that is, as slopes of a tangent line). For example, ∂z/∂x represents the slope of a
tangent line passing through a given point on the surface defined by z = f (x, y), assuming the tangent line is parallel to the x-axis.
Similarly, ∂z/∂y represents the slope of the tangent line parallel to the y -axis. Now we consider the possibility of a tangent line parallel
to neither axis.
Directional Derivatives
We start with the graph of a surface defined by the equation z = f (x, y) . Given a point (a, b) in the domain of f , we choose a direction to
travel from that point. We measure the direction using an angle θ , which is measured counterclockwise in the xy-plane, starting at zero
from the positive x-axis (Figure 13.5.1). The distance we travel is h and the direction we travel is given by the unit vector
u = (cos θ) i + (sin θ) j . Therefore, the z -coordinate of the second point on the graph is given by z = f (a + h cos θ, b + h sin θ).
⇀ ^ ^
Figure 13.5.1 : Finding the directional derivative at a point on the graph of z . The slope of the blue arrow on the graph indicates
= f (x, y)
To find the slope of the tangent line in the same direction, we take the limit as h approaches zero.
Using f (x, y) = x 2
− xy + 3 y ,
2
we first calculate f (x + h cos θ, y + h sin θ) :
2 2
f (x + h cos θ, y + h sin θ) = (x + h cos θ) − (x + h cos θ)(y + h sin θ) + 3(y + h sin θ)
2 2 2 2 2 2 2
=x + 2xh cos θ + h cos θ − xy − xh sin θ − yh cos θ − h sin θ cos θ + 3 y + 6yh sin θ + 3 h sin θ
2 2
3 9h 4xh 3yh 12h 4 16
2 2 2
=x + 2xh( )+ − xy − − − + 3y + 6yh( ) + 3h ( )
5 25 5 5 25 5 25
2
2 2
2xh 9h 21yh
=x − xy + 3 y + + + .
5 5 5
2x 9h 21y
= lim + +
h→0 5 5 5
2x + 21y
= .
5
To calculate D ⇀ f (−1,
u
2), we substitute x = −1 and y = 2 into this answer (Figure 13.5.2):
2(−1) + 21(2) −2 + 42
D⇀ f (−1, 2) = = = 8.
u
5 5
An easier approach to calculating directional derivatives that involves partial derivatives is outlined in the following theorem.
Proof
Applying the definition of a directional derivative stated above in Equation 13.5.2, the directional derivative of f in the direction of
u = (cos θ) i + (sin θ) j at a point (x , y ) in the domain of f can be written
⇀ ^ ^
0 0
If t = 0, then x = x and y = y 0 0, so
g'(0) = fx (x0 , y0 ) cos θ + fy (x0 , y0 ) sin θ (13.5.7)
Therefore, D ⇀ f (x0 ,
u
y0 ) = fx (x0 , y0 ) cos θ + fy (x0 , y0 ) sin θ .
Since the point (x , y ) is an arbitrary point from the domain of f , this result holds for all points in the domain of
0 0 f for which the
partials f and f exist.
x y
Therefore,
fy (x, y) = −x + 6y,
3 4
= (2x − y) + (−x + 6y)
5 5
6x 3y 4x 24y
= − − +
5 5 5 5
2x + 21y
= .
5
To calculate D ⇀ f (−1,
u
2), let x = −1 and y = 2 :
2(−1) + 21(2) −2 + 42
D⇀ f (−1, 2) = = = 8.
u
5 5
Exercise 13.5.1 :
π π
Find the directional derivative D⇀ f (x, y)
u
of f (x, y) = 3 x y − 4x y
2 3
+ 3y
2
− 4x in the direction of ⇀
u = (cos
^
) i + (sin
^
) j
3 3
using Equation 13.5.4.
What is D ⇀ f (3,
u
?
4)
Hint
Calculate the partial derivatives and determine the value of θ .
Answer
3 2 2
–
(6xy − 4 y − 4)(1) (3 x − 12x y + 6y)√3
D⇀ f (x, y) = +
u
2 2
– –
72 − 256 − 4 (27 − 576 + 24)√3 525 √3
D⇀ f (3, 4) = + = −94 −
u
2 2 2
If the vector that is given for the direction of the derivative is not a unit vector, then it is only necessary to divide by the norm of the
vector. For example, if we wished to find the directional derivative of the function in Example 13.5.2 in the direction of the vector
⟨−5, 12⟩, we would first divide by its magnitude to get u . This gives us u = ⟨− ⟩.
⇀ ⇀ 5 12
,
13 13
Then
5 12
=− (2x − y) + (−x + 6y)
13 13
22 17
=− x+ y
13 13
Gradient
The right-hand side of Equation 13.5.4 is equal to f (x, y) cos θ + f (x, y) sin θ , which can be written as the dot product of two vectors.
x y
⇀
Define the first vector as ∇f (x, y) = f (x, y) ^i + f (x, y) ^j and the second vector as u = (cos θ) ^i + (sin θ) ^j . Then the right-hand
x y
⇀
side of the equation can be written as the dot product of these two vectors:
⇀
⇀
D⇀ f (x, y) = ∇f (x, y) ⋅ u . (13.5.10)
u
⇀
^ ^
∇f (x, y) = fx (x, y) i + fy (x, y) j . (13.5.11)
⇀
The vector ∇f (x, y) is also written as “grad f .”
^ ^
= (2x − y) i + (−x + 6y) j .
^ ^
= (3 cos 3x cos 3y) i − (3 sin 3x sin 3y) j .
Exercise 13.5.2
2 2
⇀ x − 3y
Find the gradient ∇f (x, y) of f (x, y) = .
2x + y
Hint
Calculate the partial derivatives, then use Equation 13.5.11.
Answer
2 2 2 2
⇀ 2x + 2xy + 6 y x + 12xy + 3 y
^ ^
∇f (x, y) = i − j
2 2
(2x + y) (2x + y)
The gradient has some important properties. We have already seen one formula that uses the gradient: the formula for the directional
⇀ ⇀ ⇀
derivative. Recall from The Dot Product that if the angle between two vectors a and b is φ , then a ⋅ b = ∥ a ∥∥ b ∥ cos φ. Therefore, if
⇀ ⇀ ⇀
⇀
the angle between ∇f (x , y ) and u = (cosθ) ^i + (sinθ) ^j is φ , we have
0 0
⇀
⇀ ⇀ ⇀
⇀ ⇀
D⇀ f (x0 , y0 ) = ∇f (x0 , y0 ) ⋅ u = ∥ ∇f (x0 , y0 )∥∥ u ∥ cos φ = ∥ ∇f (x0 , y0 )∥ cos φ. (13.5.12)
u
The ∥ u ∥ disappears because u is a unit vector. Therefore, the directional derivative is equal to the magnitude of the gradient evaluated at
⇀ ⇀
⇀
If φ = 0, then cos φ = 1 and ∇f (x 0, y0 ) and u both point in the same direction.
⇀
⇀
If φ = π , then cos φ = −1 and ∇f (x 0, y0 ) and u point in opposite directions.
⇀
⇀ ⇀ ⇀
ii. If ∇f (x 0, y0 ) ≠ 0 , then D ⇀ f (x0 ,
u
y0 ) is maximized when u points in the same direction as
⇀
∇f (x0 , y0 ) . The maximum value
⇀
of D f (x , y ) is ∥∇f (x , y )∥.
⇀
u 0 0 0 0
⇀ ⇀ ⇀
iii. If ∇f (x , y ) ≠ 0 , then D f (x , y ) is minimized when
0 0 ⇀
u 0 0
⇀
u points in the opposite direction from ∇f (x0 , y0 ) . The minimum
⇀
value of D f (x , y ) is −∥∇f (x , y )∥.
⇀
u
0 0 0 0
Figure 13.5.3 : The gradient indicates the maximum and minimum values of the directional derivative at a point.
so
⇀
^ ^ ^ ^
∇f (x, y) = fx (x, y) i + fy (x, y) j = (6x − 4y) i + (−4x + 4y) j .
⇀ ⇀
We need to find a unit vector that points in the same direction as ∇f (−2, 3), so the next step is to divide ∇f (−2, 3) by its
−−−−−−−−−−− − −−− −−
magnitude, which is √(−24) + (20) = √976 = 4√61 . Therefore,
2 2
⇀ −− −−
∇f (−2, 3) −24 20 6 √61 5 √61
^ ^
= i+ j=− i + j.
⇀ −− −−
4 √61 4 √61 61 61
∥ ∇f (−2, 3)∥
for θ . Since cosine is negative and sine is positive, the angle must be in the second quadrant. Therefore,
−−
θ = π − arcsin((5 √61)/61) ≈ 2.45 rad.
⇀ −−
The maximum value of the directional derivative at (−2, 3) is ∥∇f (−2, 3)∥ = 4√61 (Figure 13.5.4).
Figure 13.5.4 : The maximum value of the directional derivative at (−2, 3) is in the direction of the gradient.
Exercise 13.5.3
Find the direction for which the directional derivative of g(x, y) = 4x − xy + 2y 2
at (−2, 3) is a maximum. What is the maximum
value?
Hint
Evaluate the gradient of g at point (−2, 3).
Answer
⇀ ⇀
The gradient of g at (−2, 3) is ∇g(−2, 3) = ^ ^
i + 14 j . The unit vector that points in the same direction as ∇g(−2, 3) is
⇀
−−− −−−
∇g(−2, 3) 1 14 √197 14 √197
^ ^ ^ ^
= i + j = i + j,
⇀ −−− −−−
√197 √197 197 197
∥ ∇g(−2, 3)∥
−−−
which gives an angle of θ = arcsin((14√197)/197) ≈ 1.499 rad.
⇀ −−−
The maximum value of the directional derivative is ∥∇g(−2, 3)∥ = √197.
Figure 13.5.5 shows a portion of the graph of the function f (x, y) = 3 + sin x sin y . Given a point (a, b) in the domain of f , the
⇀
maximum value of the directional derivative at that point is given by ∥∇f (a, b)∥. This would equal the rate of greatest ascent if the
surface represented a topographical map. If we went in the opposite direction, it would be the rate of greatest descent.
When using a topographical map, the steepest slope is always in the direction where the contour lines are closest together (Figure 13.5.6).
This is analogous to the contour map of a function, assuming the level curves are obtained for equally spaced values throughout the range
of that function.
Let’s suppose further that x = x(t ) and y = y(t ) for some value of t , and consider the level curve f (x, y) = k . Define
0 0 0 0
g(t) = f (x(t), y(t)) and calculate g'(t) on the level curve. By the chain Rule,
But g'(t) = 0 because g(t) = k for all t . Therefore, on the one hand,
fx (x(t), y(t))x'(t) + fy (x(t), y(t))y'(t) = 0; (13.5.15)
Therefore,
⇀
∇f (x, y) ⋅ ⟨x'(t), y'(t)⟩ = 0. (13.5.17)
We can use this theorem to find tangent and normal vectors to level curves of a function.
⇀
Next, we evaluate ∇f (x, y) at (−2, 1) :
⇀
^ ^ ^ ^
∇f (−2, 1) = (4(−2) − 3(1) + 2) i + (−3(−2) + 16(1) − 4) j = −9 i + 18 j .
This vector is orthogonal to the curve at point (−2, 1). We can obtain a tangent vector by reversing the components and multiplying
either one by −1. Thus, for example, −18 ^i − 9 ^j is a tangent vector (Figure 13.5.7).
Exercise 13.5.4
For the function f (x, y) = x − 2xy + 5y + 3x − 2y + 3 , find the tangent to the level curve at point (1, 1). Draw the graph of the
2 2
⇀
level curve corresponding to f (x, y) = 8 and draw ∇f (1, 1) and a tangent vector.
Hint
Calculate the gradient at point (1, 1).
Answer
⇀
^ ^
∇f (x, y) = (2x − 2y + 3) i + (−2x + 10y − 2) j
⇀
^ ^
∇f (1, 1) = 3 i + 6 j
Tangent vector: 6 ^i − 3 ^j or −6 ^i + 3 ^j
Definition: Gradients in 3D
⇀
Let w = f (x, y, z) be a function of three variables such that f x, fy , and f exist. The vector
z ∇f (x, y, z) is called the gradient of f
and is defined as
⇀
^ ^ ^
∇f (x, y, z) = fx (x, y, z) i + fy (x, y, z) j + fz (x, y, z) k. (13.5.18)
⇀
∇f (x, y, z) can also be written as grad f (x, y, z).
Calculating the gradient of a function in three variables is very similar to calculating the gradient of a function in two variables. First, we
calculate the partial derivatives f , f , and f , and then we use Equation 13.5.18.
x y z
b. f (x, y, z) = e −2z
sin 2x cos 2y
Solution
For both parts a. and b., we first calculate the partial derivatives f x, fy , and f , then use Equation 13.5.18.
z
^ ^ ^
= (10x − 2y + 3z) i + (−2x + 2y − 4z) j + (3x − 4y + 2z) k.
b. f x (x, y, z) = 2 e
−2z
,
cos 2x cos 2y fy (x, y, z) = −2 e
−2z
sin 2x sin 2y , and f z (x, y, z) = −2 e
−2z
sin 2x cos 2y , so
⇀
^ ^ ^
∇f (x, y, z) = fx (x, y, z) i + fy (x, y, z) j + fz (x, y, z) k
−2z ^ ^ ^
= 2e (cos 2x cos 2y i − sin 2x sin 2y j − sin 2x cos 2y k).
Exercise 13.5.5 :
2 2 2
⇀ x − 3y +z
Find the gradient ∇f (x, y, z) of f (x, y, z) =
2x + y − 4z.
Answer
2 2 2 2 2 2 2 2 2
⇀ 2x + 2xy + 6 y − 8xz − 2 z x + 12xy + 3 y − 24yz + z 4x − 12 y − 4z + 4xz + 2yz
^ ^ ^
∇f (x, y, z) = i − j + k
2 2 2
(2x + y − 4z) (2x + y − 4z) (2x + y − 4z)
positive x-, y -, and z -axes. Let’s call these angles α, β, and γ. Then the directional cosines are given by cos α, cos β, and cos γ. These are
the components of the unit vector u ; since u is a unit vector, it is true that cos α + cos β + cos γ = 1.
⇀ ⇀ 2 2 2
We can calculate the directional derivative of a function of three variables by using the gradient, leading to a formula that is analogous to
Equation 13.5.4.
⇀
⇀
D⇀ f (x, y, z) = ∇f (x, y, z) ⋅ u = fx (x, y, z) cos α + fy (x, y, z) cos β + fz (x, y, z) cos γ. (13.5.20)
u
Solution:
First, we find the magnitude of v :
−−−−−−−−−−−−−−−
⇀ 2 2 2 –
∥ v ∥ = √ (−1 ) + (2 ) + (2 ) = √9 = 3.
⇀ ^ ^ ^
v −i + 2 j + 2 k 1 2 2 1 2
Therefore, ⇀
= =−
^
i +
^
j +
^
k is a unit vector in the direction of ⇀
v , so cos α = − , cos β = , and
∥ v∥ 3 3 3 3 3 3
2
cos γ = . Next, we calculate the partial derivatives of f :
3
fx (x, y, z) = 10x − 2y + 3z
fy (x, y, z) = −2x + 2y − 4z
1 2 2
= (10x − 2y + 3z)(− ) + (−2x + 2y − 4z)( ) + (−4y + 2z + 3x)( )
3 3 3
10x 2y 3z 4x 4y 8z 8y 4z 6x
=− + − − + − − + +
3 3 3 3 3 3 3 3 3
8x 2y 7z
=− − − .
3 3 3
Exercise 13.5.6 :
Calculate D ⇀ f (x,
v
y, z) and D⇀ f (0,
v
−2, 5) in the direction of ⇀ ^ ^ ^
v = −3 i + 12 j − 4 k for the function
2 2 2
f (x, y, z) = 3 x + xy − 2 y + 4yz − z + 2xz.
Hint
First, divide ⇀
v by its magnitude, calculate the partial derivatives of f , then use Equation 13.5.20.
Answer
3 12 4
D⇀ f (x, y, z) = − (6x + y + 2z) + (x − 4y + 4z) − (2x + 4y − 2z)
v
13 13 13
384
D⇀ f (0, −2, 5) =
v
13
Summary
A directional derivative represents a rate of change of a function in any given direction.
The gradient can be used in a formula to calculate the directional derivative.
The gradient indicates the direction of greatest change of a function of more than one variable.
Key Equations
directional derivative (two dimensions)
f (a + h cos θ, b + h sin θ) − f (a, b)
D⇀ f (a, b) = lim
u
h→0 h
or
Glossary
directional derivative
the derivative of a function in the direction of a given unit vector
gradient
⇀
the gradient of the function f (x, y) is defined to be ^ ^
∇f (x, y) = (∂f /∂x) i + (∂f /∂y) j , which can be generalized to a function of
any number of independent variables