Local Extrema Worksheet by Russell Blyth - blythrd@slu.edu restart; with(plots):
<Text-field style="Heading 1" layout="Heading 1">Contour Plots</Text-field> Local extrema of functions of two variables can be located from contour plots by noting the concentric contours around such a point. Saddle points occur where contour lines cross with contours rising and falling alternately between the crossing contours. Consider some examples: f := x -> x^2 - 3*x + y^2 - 2*y - 6; contourplot(f(x,y),x=-4..4,y=-4..4,contours=[-9,-8,-7,-6,-5,-4,-3,-2],grid=[50,50]); In a 2-D contour plot the darker red colored contour lines represent smaller function values. We conclude there is a local minimum at or near (1.5,1). f := x -> x^2 - 3*x - y^2 - 2*y - 4; contourplot(f(x,y),x=-2..4,y=-4..2,contours=[-9,-8,-7,-6,-5.25,-5,-4,-3,-2],grid=[50,50]); We have located a saddle point at or near (1.5, -1)
<Text-field style="Heading 2" layout="Heading 2">Exercise</Text-field> 1. For the contour plot below, locate and classify each critical point. f := x -> sin(x) + cos(y); contourplot(f(x,y),x=-5..5,y=-5..5,contours=[-1.9,-1.5,-1,-.5,0,.5,1,1.5,1.9],grid=[50,50]); Conclusions:
<Text-field style="Heading 1" layout="Heading 1">Gradient Plots</Text-field> Local extrema may be located using plots of the gradient vector field of a function. At a local maximum all the gradient vectors at nearby points point toward the local maximum, while if the gradient vectors all point away from a point then there is a local minimum there. Note that the gradient vectors near a local extremum which has a horizontal tangent plane are all short - that is have small magnitude. If some gradient vectors point toward a critical point while some point away, then we have found a saddle point. f := x -> x^2 - 3*x + y^2 - 2*y - 6; gradplot(f(x,y),x=-1..4,y=-1..4,grid=[10,10]); There is a local minimum at or near (1.5,1) f := x -> x^2 - 3*x - y^2 - 2*y - 4; gradplot(f(x,y),x=-2..4,y=-4..2,grid=[10,10]); There are gradient vectors both pointing toward and away from (1,-1), so there's a saddle point there.
<Text-field style="Heading 2" layout="Heading 2">Exercise</Text-field> 2. For the gradient plot below, locate and classify each critical point. You may need to zoom in on points of interest by changing the x and y ranges to find and classify all critical points. f := x -> 8*y^3+12*x^2-24*x*y; gradplot(f(x,y),x=-0.5..2,y=-0.5..2,grid=[10,10]); gradplot(f(x,y),x=0.8..1.2,y=0.8..1.2,grid=[10,10]); Conclusions: 3. For the gradient plot below, locate and classify each critical point. You may need to zoom in on points of interest by changing the x and y ranges to find and classify all critical points. f := x -> x^3-3*x*y^2; gradplot(f(x,y),x=-2..2,y=-2..2,grid=[10,10]); Conclusions:
<Text-field style="Heading 1" layout="Heading 1">The Second Derivative Test</Text-field> The Second Derivative test classifies critical points as maxima, minima or saddle points. For smooth functions, only if both the gradient vector is zero and the discriminant is zero does it not help us. Look at an example. f := x -> 8*y^3+12*x^2-24*x*y; fx := diff(f(x,y),x); fy := diff(f(x,y),y); critpts:=solve({fx=0,fy=0}); fxx := diff(fx,x); fxy := diff(fx,y); fyy := diff(fy,y); discr := fxx*fyy - fxy^2; `fxx `:= subs({x=0,y=0},fxx); ` D `:= subs({x=0,y=0},discr); We conclude that f(x,y) has a saddle point at the origin, since D<0 at this critical point. `fxx `:= subs({x=1,y=1},fxx); ` D `:= subs({x=1,y=1},discr); We conclude that f(x,y) has a local minimum at (1,1), since fxx>0 and D>0. Finally, we graph the surface. Rotate the surface until you are convinced that you see the critical points clearly. plot3d(f(x,y),x=-0.5..1.5,y=-0.5..1.5,view=-5..10,axes=boxed,color=green);
<Text-field style="Heading 2" layout="Heading 2">Exercise</Text-field> 4. Locate and classify the critical points of g(x,y) = x(x-1)cos(y). Produce a graph that shows the critical points clearly (this may take some careful choices of x, y and view ranges). g := x -> x*(x-1)*cos(y); Conclusions: Once you have reached your conclusions, regraph the function with y=-2*Pi..2*Pi. What do you see now?