Lesson 4 VC.03
Lesson 4 VC.03
03
Gradient Vectors, Level Curves,
Maximums/Minimums/Saddle Points
Example 1: The Gradient Vector
df
Let f(x) x 2 . Then 2x. This can be thought of as a vector that
dx
tells you the direction of greatest increase on the curve. The magnitude
of the vector tells you how steep the increase.
Let's try a few
df
x-values in :
dx
f f f
f , ,...,
x 1 x 2 x n
The gradient vector is designed to point in the direction
of the greatest INITIAL increase on your curve/surface/etc.
Notice that the gradient vector always lives in one dimension
lower than function does. 3D surface? 2D gradient vector. 2D
curve? 1D gradient vector. 4D hypersurface? 3D gradient vector.
Created by Christopher Grattoni. All rights reserved.
Definition: The Gradient Vector
Let f(x1 , x 2 ,..., x n ) be a function of n variables and let
f f f
f , ,...,
x 1 x 2 x n
Let f(x, y) (cos 2 (x) cos 2 (y))2 . Then we can use Mathematica
f f
to find f(x, y) , .
x y
This is the surface plotted together
with a projected gradient field below it.
f(x, y) 4 cos3 (x)sin(x) 4 cos(x)sin(x)cos(y),2
Created by Christopher Grattoni. All rights reserved. cos (x)sin(y) 2cos(y)sin(y)
2
Example 3: A Surface and Gradient Field
f f
Let f(x, y) (cos2 (x) cos 2 (y))2 and f(x, y) , :
x y
f(x, y) 4 cos3 (x)sin(x) 4 cos(x)sin(x)cos(y),2
Created by Christopher Grattoni. All rights reserved. cos (x)sin(y) 2cos(y)sin(y)
2
Example 3: A Surface and Gradient Field
f f
Let f(x, y) (cos2 (x) cos 2 (y))2 and f(x, y) , :
x y
One of the main reasons we like to plot
the gradient vectors (called a gradient
vector field) is that we can figure out
quite a bit about a 3D surface without
the hard work of a 3D plot:
f(x, y) 4 cos3 (x)sin(x) 4 cos(x)sin(x)cos(y),2
Created by Christopher Grattoni. All rights reserved. cos (x)sin(y) 2cos(y)sin(y)
2
Example 4: A Surface and Contour Plot
f f
Let f(x, y) (cos2 (x) cos 2 (y))2 and f(x, y) , :
x y
We can also generate a "contour plot" of our
surface. This is also called a set of level curves.
These are merely slices of the curve projected
onto the xy-plane:
Let f(x, y) (cos2 (x) cos2 (y))2 and let (x(t), y(t)) cos2 (1 t), sin(2t ) .
Finally, plot f(x(t), y(t)), a path on the surface.
Let f(x, y ) (cos2 (x) cos2 (y))2 and let (x(t), y(t)) cos2 (1 t), sin(2t) .
Finally, plot f(x(t), y(t)), a path on the surface. Add in the gradient vectors
on the path:
f f
If the angle between , and (x'(t),y'(t)) is acute,
x y
f f
, (x'(t),y'(t))>0 and we are walking uphill.
x y
f f
If the angle between , and (x'(t),y'(t)) is obtuse,
x y
f f
, (x'(t),y'(t))<0 and we are walking downhill.
x y Created by Christopher Grattoni. All rights reserved.
The Derivative of f(x(t),y(t)) With Respect to t
f f f f
If the angle between , and (x'(t),y'(t)) is acute, If the angle between , and (x'(t),y'(t)) is obtuse,
x y x y
f f f f
, (x'(t),y'(t))>0 and we are walking uphill. , (x'(t),y'(t))<0 and we are walking downhill.
x y x y
df(x(t), y(t)) f f
The 2D Chain Rule: , (x'(t),y'(t))
dt x y
Chain Rules in Other Dimensions:
df(x(t))
1D : f '(x(t))x '(t)
dt
df(x(t), y(t), z(t)) f f f
3D : , , (x'(t),y'(t),z'(t))
dt x y z
df(x 1 (t),..., x n (t)) f f
n-D: ,..., (x 1'(t),...,x n'(t))
dt x 1 x n
"The derivative of the outside times the derivative of the inside."
(Gradient) (Dot Product) (Tangent Vector)
Created by Christopher Grattoni. All rights reserved.
Chain Rule Proves the Gradient is
Perpendicular to the Level Curve
Theorem: The gradient is always perpendicular to the level curve through its tail.
Proof: We will only show this for a surface z f(x,y) whose
level curve c f(x,y) can be parameterized by (x(t), y(t)).
Then a tangent vector on the level curve can be described
by (x'(t),y'(t)).
f f
Next, the gradient is f(x, y) , .
x y
For them to be perpendicular, we want their dot product
to be 0:
f f df(x(t), y(t))
, (x'(t), y'(t)) By Chain Rule...
x y dt
0 But c f(x, y), and the
So the gradient is to the level curve. derivative of a constant is 0...
Another way to think of this is a level curve is defined as a path
df(x(t), y(t))
on the surface where your height stays constant. So 0...
Created by Christopher Grattoni. All rights reserved.
dt
Example 7: Using the Chain Rule
df
Let f(x, y) x 2 xy and let (x(t), y(t)) cos(t), sin(t) . Find :
dt
f f
, 2x y, x 2cos(t) sin(t), cos(t)
x y
(x '(t), y '(t)) ( sin(t), cos(t))
df(x(t), y(t)) f f
, (x'(t),y'(t))
dt x y
2 cos(t) sin(t), cos( t ) ( sin(t), cos( t ))
2 sin(t) cos(t) sin2 (t) cos 2 (t)
cos(2t) sin(2t)
Created by Christopher Grattoni. All rights reserved.
Example 8: Identifying Local Extrema
from the Gradient
Let f(x, y) x 3 y 3 3x 3y. We previously found f 3x 2 3,3y 2 3 .
Find all local maxima/minima on this surface.
f 3x 2 3,3y 2 3 (0, 0)
x 1, y 1
Critical Points:
1,1 , 1, 1 , 1,1 , 1, 1
Created by Christopher Grattoni. All rights reserved.
Example 8: Identifying Local Extrema
from the Gradient
Let f(x, y) x 3 y 3 3x 3y. We previously found f 3x 2 3,3y 2 3 .
Find all local maxima/minima on this surface.
Critical Points:
1,1 , 1, 1 , 1,1 , 1, 1
(1, 1) and ( 1,1) are called
saddle points:
They bring you up in one
direction down in the other.
These are not extrema.
Summary:
Local Maximum: ( 1, 1)
Local Minimum: (1,1)
Saddle Points: (1, 1) and ( 1,1)
2f 2f
x 2 xy
Let D(x, y) Hf(x, y) 2 . Then:
f f 2
yx y 2
D(a,b) fxx (a,b) Conclusion
(a,b, f(a,b)) is a local maximum.
(a,b, f(a,b)) is a local minimum.
n/a (a,b, f(a,b)) is a saddle point.
0 n/a The test is inconclusive.
Created by Christopher Grattoni. All rights reserved.
Detour: The Second Partial Derivative Test
to Identify Maximums and Minimums
D(a,b) fxx (a,b) Conclusion
(a,b, f(a,b)) is a local maximum.
(a,b, f(a,b)) is a local minimum.
n/a (a,b, f(a,b)) is a saddle point.
0 n/a The test is inconclusive.
How does this work? Well, if D(a,b) is positive, it is telling us that the "second
derivatives in the x-direction and y-direction" are pointing the same way.
So if D(a,b) is positive and fxx (a,b) is negative, then we are "concave down" in
both directions which is a local maximum. If D(a,b) is positive and fxx (a,b) is
positive, then we are "concave up" in both directions, which is a local minimum.
Summary:
Local Maximum: ( 1, 1)
Local Minimum: (1,1)
Saddle Points: (1, 1) and ( 1,1)
Let f(x, y) x 3 y 3 3x 3y and suppose you are standing on the surface at the
point 2,3,20 . If you decide to walk in the direction of ( 7,2), do you go uphill
or downhill on f(x,y) when you take your first step?
f 3x 2 3,3y 2 3
f(2,3) 9,24
9, 24 7, 2 15
Since this dot product is negative, we know
our first step will be downhill.
k = f(x,y) k = f(x,y,z)