Directional Derivatives and the Gradient Vector
Calculus III Project
Objective:
To study directional derivatives and gradients using Maple.
Required Information:
Vectors are described by bold letters or by using arrows on the letter. We assume the function is
differentiable at the given point.
A directional derivative for a function f(x, y) at (a, b) in the direction u = u1 i + u2 j ,
f a C hu1 , b C hu2 K f a, b
where u is a unit vector, is given by lim
h/0
h
By local linearity, this amounts to finding fu a, b = fx a, b u1 + fy a, b u2
The gradient of a surface z = f(x, y) at (a, b), written grad f(a, b), is a vector
grad f (a, b) = fx a, b i + fy a, b j
pointing in the direction where the directional derivative is a maximum-- i.e., ||grad f (a, b)|| >= fv(a,
b) for any
vector v. Its magnitude, ||grad f(a, b)||, is the directional derivative of f at (a, b) in that direction.
The gradient vector is perpendicular to the contour curve at (a, b).
A directional derivative for a function f(x, y, z) in the direction u = u1 i + u2 j + u3 k at (a, b, c)
is given by
fu a, b, c = fx a, b, c u1 + fy a, b, c u2 + fz a, b, c u3
The gradient vector is given by grad f (a, b, c) = fx a, b, c i + fy a, b, c j + fz a, b, c k,
where the directional derivative is a maximum-- i.e., ||grad f (a, b, c)|| >= fv(a, b, c) for any
vector v. Its magnitude, ||grad f(a, b, c)||, is the directional derivative of f at (a, b, c) in that direction.
The gradient vector of a function of 3 variables is perpendicular to the level surfaces.
Solved Example 1
Let
(a)
(b)
(c)
(d)
z = f(x, y) = x2 y .
Graph z = f(x, y).
Find the directional derivative fv(a, b), where v is in the direction of 4i - 3j by using limits.
Find the directional derivative fv(2, 6) using the formula for the directional derivative.
Find the gradient of f at (2, 6) using the formula and verify the definition using limits.
Solution:
Activate the plots and student packages.
> with(plots): with(student):
Define the function.
> f := (x, y) -> x^2*y;
Graph z = f(x, y) and use the plot3d command, giving ranges for x and y.
> plot3d(f(x, y), x = 1..3, y = 5..7, axes = boxed, grid = [5, 5],
labels = [x, y, z],title=`z = x^2 * y `);
(b) The direction given is v = 4i - 3j. Since ||v|| = 5, the unit vector in the direction of v is
4/5 i - 3/5 j.
> fv (2, 6) := limit ((f(2 + 4/5*h, 6 - 3/5*h) - f(2, 6))/h, h = 0)
;
84
fv 2, 6 :=
(4.1)
5
Note how the limit is defined.
(c) The formula for the directional derivative is fv a, b = fx a, b v1 + fy a, b v2 .
For the given v, v1 = 4/5, v2 = -3/5.
> fx(x, y) := diff(f(x, y), x); fy(x, y) := diff(f(x, y), y);
fx x, y := 2 x y
(4.2)
fy x, y := x2
> fx(2, 6) := subs(x = 2, y = 6, fx(x, y));
2, y = 6, fy(x, y));
fx 2, 6 := 24
fy(2, 6) := subs(x =
(4.3)
fy 2, 6 := 4
> fv(2, 6) := fx(2, 6)*4/5 + fy(2, 6)*(-3/5);
84
fv 2, 6 :=
5
(4.4)
(d) The gradient of f is the direction in which f increases at the greatest rate.
By definition, it is the vector fx 2, 6 i + fy 2, 6 j and .
grad f(2, 6) = 24i + 4j.
Its magnitude, ||grad f(2, 6)||, is the directional derivative in the direction 24i + 4j.
We verify this in the following steps.
> magnitude := sqrt(24^2 + 4^2);
magnitude := 4
37
(4.5)
> fv (2, 6) := limit ((f(2 + 24/(magnitude)*h, 6 + 4/(magnitude)*h)
- f(2, 6))/h, h = 0);
fv 2, 6 := 4 37
(4.6)
Solved Example 2:
Let f(x, y, z) = x2 y - z.
(a) Graph f(x, y, z) = 0, f(x, y, z) = 10 on the same reference axes.
(b) Find the directional derivative fv(a, b, c), where v is in the direction of 4i - 3j - k by using
limits.
(c) Find the directional derivative fv(2, 6, 24) using the formula for the directional derivative.
(d) Find the gradient of f at (2, 6, 24) using the formula and verify the definition using limits.
Solution:
Define the function.
> f := (x, y, z) -> x^2*y - z;
To graph f(x, y, z) = 0 and f(x, y, z) = 10 , we rewrite the functions as z = x2 y and z = x2 y - 1 and
we use the plot3d command, giving ranges for x and y.
> plot3d({x^2*y, x^2*y - 10}, x = 1..3, y = 5..7, grid=[10,10],
title=`Level Surfaces `);
(b) The direction given is v = 4i - 3j - k. Since ||v|| =
direction of v is
(4/ 26 ) i - (3/ 26 ) j - (1/ 26 ) k .
32 C 42 C 12 =
26 , the unit vector in the
> fv (2, 6,24) := limit ((f(2 + 4/sqrt(26)*h, 6 - 3/sqrt(26)*h,24
-1/sqrt(26)*h) - f(2, 6,24))/h, h = 0);
85
fv 2, 6, 24 :=
26
(6.1)
26
Note how the limit is defined.
(c) The formula for the directional derivative is
fz a, b, c v3
For the given v, v1 = 4/ 26 , v2 = -3/
fv a, b, c = fx a, b, c v1 + fy a, b, c v2 +
26 , v3 = -1/ 26 .
> fx(x, y, z) := diff(f(x, y,z), x); fy(x, y, z) := diff(f(x, y,
z), y); fz(x, y, z) := diff(f(x, y, z), z);
fx x, y, z := 2 x y
(6.2)
fy x, y, z := x2
fz x, y, z := K1
> fx(2, 6, 24) := subs(x = 2, y = 6,z=24, fx(x, y, z)); fy(2, 6,
24) := subs(x = 2, y = 6, z=24, fy(x, y,z));fz(2, 6,24) := subs(x
= 2, y = 6, z=24, fz(x, y, z));
fx 2, 6, 24 := 24
(6.3)
(6.3)
fy 2, 6, 24 := 4
fz 2, 6, 24 := K1
> fv(2, 6, 24) := fx(2, 6, 24)*4/sqrt(26) + fy(2, 6, 24)*(-3/ sqrt
(26)) +fz(2, 6, 24)*(-1/ sqrt(26));
85
fv 2, 6, 24 :=
26
(6.4)
26
This shows that the answers in b) and c) agree.
(d) The gradient of f is the direction in which f increases at the greatest rate.
By definition, it is the vector fx 2, 6, 24 i + fy 2, 6, 24 j + fz 2, 6, 24 k and
grad f(2, 6,24) = 24i + 4j - k.
Its magnitude, ||grad f(2, 6, 24)||, is the directional derivative in the direction v = 24i + 4j - k.
We verify this in the following steps.
> magnitude := sqrt(24^2 + 4^2 + 1);
magnitude := 593
(6.5)
> fv (2, 6, 24) := limit ((f(2 + 24/(magnitude)*h, 6 + 4/
(magnitude)*h,24-1/(magnitude)*h) - f(2, 6, 24))/h, h = 0);
fv 2, 6, 24 := 593
(6.6)
_______________________________________________________________
ASSIGNMENT
Problem 1:
Let f(x, y) =
xCy
and let P = (1, -2). Graph the surface. Find the directional derivative at P
1 C x2
in the direction of the vectors (a) v = 3i - 2j and
(b) v = - i + 4j using the formula and verify your answers using limits.
(c) What is the direction of greatest increase at P? Calculate the gradient of f at P.
Problem 2:
Let f(x, y, z) =
xCy
- z.
1 C x2
(a) Graph f(x, y, z) = 0, f(x, y, z) = 10 on the same reference axes.
(b) Find the directional derivative fv(a, b, c), where v is in the direction of 4i - 3j - k by using
limits.
1
(c) Find the directional derivative fv(1, -2, K ) using the formula for the directional derivative.
2
1
(d) Find the gradient of f at (1, -2, K ) using the formula and verify the definition using limits.
2
_____________________________________________________________________
MSIP Grant #P120A10065: "Three Urban Calculus Reform Programs: Adopting the Best" 2010-2013
© Copyright 2026 Paperzz