You are on page 1of 13

Part 1 PARTIAL DERIVATIVES MAT 295

Chapter 7

Gradient and
Directional
Derivatives
At the end of this module, students should be able to:
 Define and evaluate gradient of function
 Define directional derivatives
 Evaluate directional derivatives
 Evaluate directional derivatives using gradient

7.1 Introduction

Imagine standing at a point x  x0 . The slope of the ground in front of where


we are standing will depend on the direction we are facing. It might slope
steeply in one direction and be relatively flat in another direction.
In earlier modules, we have discussed that f x is the slope of f in the positive

x-direction (i.e. slope parallel to x-axis) and f y is the slope of f in the positive

y-direction (i.e. slope parallel to y-axis). In this module we are going to learn
to find slopes at other directions often called as directional derivatives. There
are several ways to evaluate directional derivatives in which one is of the
methods is by using gradient vectors.

7.2 The Gradient Vectors

The gradient of a function of two variables is a vector-valued function of two


variables.

89
Part 1 PARTIAL DERIVATIVES MAT 295

Definition
Let z  f ( x, y ) be a function of x and y such that f x and f y exists. Then the

gradient of f at any point ( x, y ) , denoted by f ( x, y ) or grad f ( x, y ) , is the


vector such that
 
f ( x, y )  f x ( x, y ) i  f y ( x, y ) j
f  f 
 i  j
x y
 f x , fy

The gradient f ( x, y ) is a vector in the plane (not a vector in space) as in


Figure 7.1.
z

y
x
(x,y)
Figure 7.1

Steps : Gradient

 Identify f ( x, y )
 Find f x and fy
 Write gradient as f ( x, y )  f x , fy

Example 1

Let f ( x, y )  2x 2 y  3y . Find the gradient of f at any point ( x, y ) and the


gradient of f at the point (1, 2).

Solution

 Identify f ( x, y )

f ( x, y )  2x 2 y  3y

 Find f x and f y

90
Part 1 PARTIAL DERIVATIVES MAT 295

f x ( x, y )  4xy ,

fy ( x, y )  2x 2  3

 Find the gradient of f at any point


 
f ( x, y )  f x ( x, y )i  fy ( x, y ) j
 
 ( 4 xy )i  (2 x 2  3) j
 4 xy , 2 x 2  3

 Evaluate the gradient of f at the point (1,2)


 
f (1, 2)  f x (1, 2)i  f y (1,2) j
 
 ( 4)(1)(2)i  (2(1)2  3) j
 
 8i  5j
 8,5

Example 2

Find the gradient of f ( x, y )  y ln x  xy 2 at the point (1,3).

Solution

 Identify f ( x, y )

f ( x, y )  y ln x  xy 2

 Find f x and f y

y
f x ( x, y )   y2 , fy ( x, y )  ln x  2xy
x
 Find the gradient of f at any point
 
f ( x, y )  f x ( x, y )i  fy ( x, y ) j

y  
f ( x, y )  (  y 2 ) i  (ln x  2 xy ) j
x
y
  y 2 , ln x  2 xy
x
 Evaluate the gradient of f at the point (1,3)
 
f (1, 2)  f x (1, 3) i  fy (1,3) j
3  
f (1, 2)  (  3 2 ) i  (ln 1  (2)(1)(3)) j
1
 
 12 i  6 j or 12 , 6

91
Part 1 PARTIAL DERIVATIVES MAT 295

Warm up exercise
3 3
Let f ( x, y )  3y  x  y  3x .

(i) Compute f x and fy .

(ii) Find f (2,1) .

7.3 Directional Derivatives

There are infinitely many directional derivatives of a surface at a given point.


In order to find the directional derivative at that point, we first need to specify
the direction in which to compute the slope. We write the directional derivative

of f in the direction of the unit vector u at the point ( x, y ) as Du f ( x, y ) i.e.

u  1 . The directional derivative Du f ( x, y ) is simply the slope of f ( x, y ) when

standing at the point ( x, y ) and facing the direction given by u . For instance if

x and y were given in meters, then Du f ( x, y ) would be the change in height



per meter as you moved in the direction given by u when you are at the point
( x, y ) .

Definition
The directional derivative of f ( x, y ) at the point (a, b) and in the direction of

u  u1, u2 is given by

f (a  hu1, b  hu 2 )
Du f (a, b)  lim
h 0 h
Note that Du f ( x, y ) is a constant value (representing a slope). In fact, the

directional derivative is the same as a partial derivative if u points in the
positive x or positive y direction.
z



y
x u
Figure 7.2

92
Part 1 PARTIAL DERIVATIVES MAT 295

Theorem
Directional derivative
If f is a differentiable function of x and y, then the directional derivative of f in
   
the direction of the unit vector u  cos  i  sin  j (or u  cos , sin  ) is

Du f ( x, y )  fx ( x, y )  cos   fy ( x, y )  sin 

Alternatively, directional derivative may be evaluated by using gradient as in


the following theorem.

Theorem
Directional derivative
If f is a differentiable function of x and y, then f has a directional derivative in
   
the direction of any unit vector u  a i  b j (or, u  a, b ) and

Du f ( x, y )  f ( x, y )  uˆ
 f x ( x, y ), f y ( x, y )  a, b
 f x ( x, y ).a  fy ( x, y ).b

In this case, the directional derivative is calculated by taking the dot product of
the gradient vector of f and the unit vector in the direction or parallel to the
slope needed.

Steps : Directional derivative

 Identify f ( x, y )
 Compute the gradient f ( x, y )

 Identify direction v
 
 Compute magnitude v : v

 v
 Compute unit vector u  
v

 Compute directional derivative : u  f

93
Part 1 PARTIAL DERIVATIVES MAT 295

Example 3

y2
Let f ( x, y )  4  x 2  . Find the directional derivative of f at (1,2) in the
4
  
direction of the unit vector u  cos , sin .
3 3

Solution

 Find f x and fy

y
f x ( x, y )  2x , f y ( x, y ) 
2
 Find the directional derivative of f at point (1,2) in the direction of the

unit vector u
Du f ( x, y )  f x ( x, y )  cos   fy ( x, y )  sin 
 y 
 ( 2x )  cos ( )  sin
3 2 3

Thus, 6 2
3
Du f (1,2)  f x (1,2)  cos   fy (1,2)  sin  
3
 2  1
 ( 2)(1)  cos ( )  sin
3 2 3
 1  3
 ( 2)   ( 1) 
2  2 
 
 1.866

Example 4

Find the directional derivative of f ( x, y )  x 3 y at (-1, 5) in the direction of


  
the vector v  i  3 j .

Solution

 Find f x and fy

f x ( x, y )  3 x 2 y , fy ( x, y )  x 3

 Since the direction is not given in the form of a unit vector, then we
 
need to find the unit vector u in the same direction as v

94
Part 1 PARTIAL DERIVATIVES MAT 295


 v 1
u   1,3
v 12  3 2
1 3
 ,
10 10

 Find the directional derivative of f at point (-1,5) in the direction of



the unit vector u

Du f ( x, y )   f ( x, y )  u
Thus,

Du f ( 1,5)   f ( 1, 5)  u
1 3
 f x ( 1, 5), f y ( 1, 5)  ,
10 10
1 3
 15,1  ,
10 10
 1   3 
 (15 )   ( 1) 
 10   10 
12
  3.795
10

Example 5

Let f ( x, y )  x 2  2y 2  3x . Find the:


a) gradient of f at (1,1).
b) directional derivative at the same point in the direction of the unit
  
vector u  cos , sin .
4 4

Solution

 Find f x and f y

f x ( x, y )  2x  3 , fy ( x, y )  4y

 Find the gradient of f at any point


 
f ( x, y )  f x ( x, y ) i  fy ( x, y ) j
 
 (2x  3) i  ( 4y ) j or 2x  3 , 4y

 Evaluate the gradient of f at the point (1,1)


 
f (1,1)  f x (1,1) i  fy (1,1) j

95
Part 1 PARTIAL DERIVATIVES MAT 295

 
f (1,1)  (2  1) i  4(1) j
 
 i  4 j
  1, 4

 Find the directional derivative at point (1,1) as a dot product of



gradient of f and the unit vector u

Du f (1,1)  f (1,1)  u
 
  1,4  cos , sin
4 4

1 1
  1,4  ,
2 2
1 1
 ( 1)( )  ( 4)( )
2 2
3
  2.121
2

Example 6

Given f ( x, y )  sin x  e xy . Find the directional derivative of f at (0,1)


  
parallel to the vector v  3i  4 j .

Solution

 Find f x and f y

f x ( x, y )  cos x  ye xy , fy ( x, y )  xe xy

 Find the gradient of f at any point


 
f ( x, y )  f x ( x, y ) i  fy ( x, y ) j
 
 (cos x  ye xy ) i  ( xe xy ) j
 cos x  ye xy , xe xy

 Evaluate the gradient of f at the point (0,1)


 
f (0,1)  f x (0,1) i  f y (0,1) j
 
 2i  0 j
 2,0
 Since the direction is not given in the form of a unit vector, then we
 
need to find the unit vector u in the same direction as v .

96
Part 1 PARTIAL DERIVATIVES MAT 295


 v 1
u   3,4
v 3 2  ( 4)2
3 4
 ,
5 5

 Find the directional derivative of f at point (0,1) in the direction of the



unit vector u .

Du f (0,1)  f (0,1)  u
3 4
 2,0  ,
5 5
3 4
 (2)( )  (0)( )
5 5
6

5

Example 7
 
Find the directional derivative of f ( x, y )  x 2 y  3y in the direction 4i  3 j
at the point (1, -1).

Solution

 Identify f ( x, y )
f ( x, y )  x 2 y  3y
 Compute the gradient f ( x, y )
f  2xy, x 2  3

 Identify direction v

v  4,  3
 
 Compute magnitude v : v

v  4 2  ( 3)2
 16  9
 25  5

 v
 Compute unit vector u  
v
 1
u  4,  3
5
 Compute directional derivative

97
Part 1 PARTIAL DERIVATIVES MAT 295


Du f ( x, y )  u  f
1
 4, 5  2 xy, x 2  3
5
1

 4(2 xy )  5( x 2  3
5

1

 5 x 2  8 xy  15
5

 Directional derivative at (1, -1)
Du f (1,1)  5  8(1)(1)  15 
1
5
12

5

Example 8

Determine the directional derivative of the function f ( x, y )  3x 2  3y 2 in



the unit vector j direction.

Solution

 Identify f ( x, y )

f ( x, y )  3x 2  3y 2

 Compute the gradient f ( x, y )

f ( x, y )  6x,  6y

 Identify direction v
 
v  j  0,1

 Compute magnitude v

v 1

 Compute unit vector


 
 v j 
u     j  0,1
v 1

 Compute directional derivative


Du f ( x, y )  0, 1  6 x,  6 y
 0  6y
 6 y

98
Part 1 PARTIAL DERIVATIVES MAT 295

Example 9

Find the directional derivative of f ( x, y )  x 2 y 3  y 4 at (1,2) in the


direction given by the angle   .
4

Solution

The gradient of f is given by

f ( x, y )  2xy 3 , 3 x 2 y 2  4y 3

while the unit vector u is
      
u  cos i  sin  j
4 4
1 1
 , .
2 2


4 2
1

4
1

Hence, the directional derivative is determined by


1 1
Du f ( x, y )  2 xy 3 , 3 x 2 y 2  4 y 3  ,
2 2
 1 
 2 xy 3 
 2

  3 x 2 y 2  4 y 3  12 
Therefore, at (1, 2)
 1 
Du f (1, 2)  2(1)(2)3 
 2

  3(1)2 (2)2  4(2)3  12 
16 20
 
2 2
4
  2 2
2
Note that Du f (1, 2) represents the slope or the rate of change of f ( x, y ) at

    1 1
point (1, 2) in the direction of v  cos , sin or v  , .
4 4 2 2

99
Part 1 PARTIAL DERIVATIVES MAT 295

Warm up exercise
Let f ( x, y )  x 3  3xy  4y 2 at the point (1, 2) in the direction of


(a) (b) 3,  4
6
(i) Compute the gradient f ( x, y ) .
(ii) Identify the direction.
(iii) Compute the magnitude of the direction vector.
(iv) Compute the unit vector.
(v) Compute the directional derivative.

Exercise 7

1. Find the gradient for the following functions.

a) f ( x, y )  sin x  e xy at (0, 1)

b) f ( x, y )  x 2 y 3  4y at (2, -1)

c) f ( x, y )  x 2  y 2  z 2 at (1, 4, 2)

2. For the following functions, points and vectors:


a) find the gradient of f.
b) evaluate the gradient at the given values of (x,y).

c) find the directional derivative of f in the direction of the vector v .
 5 12
i) f ( x, y )  5 xy 2  4 x 3 y , (1, 2), v ,
13 13
 4 3 
ii) f ( x, y )  y ln x, (1,3), v  i  j
5 5

iii) f ( x, y )  x sin( xy ), (2,0), 
3

iv) f ( x, y )  x 3  3 xy  4y 2 , (1, 2), 
6
  
v) f ( x, y )  xey  cos(xy ), (2,0), v  3i  4 j

100
Part 1 PARTIAL DERIVATIVES MAT 295

3. Find the directional derivatives of f ( x, y )  xy e y at P(1,1) in the direction of

a) the y-axis

b) PQ where Q is (4,5).


4. Compute Du f (2,1) , where u is a unit vector in the direction of the vector

v  1, 3 and f ( x, y )  x 4  x 2 y 3 .

y t
5. Find the directional derivatives of f ( x, y , t )   t at (2,1,-1) in the direction
xy
  
of v  3i  j  k .

6. Find the directional derivative of the function f ( x, y )  xy at the point P(2, 8) in

the direction of the point Q(5, 4).

x
7. Find the directional derivative of f ( x, y )  in the direction of
xy
   
u  cos i  sin j when    .
6

8. Find the directional derivative of the function f ( x, y )  x 2 y 3  4y at the point


  
P(2, -1) in the direction of the vector v  2i  5 j .

101

You might also like