SOME SOLUTIONS FOR WORKSHEET #6

1.  f has exactly one critical point.

Clear[u,x,y,t,f,dot,graph];
f[x_,y_]=(x^2)-(y^2);
dot=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{0,0,f[0,0]}]}];
graph=Plot3D[f[x,y],{x,-1,1},{y,-1,1},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,dot,DisplayFunction->$DisplayFunction]

2. f has exactly one critical point, and f has both a global maximum and a global minimum.

Clear[u,x,y,t,f,dot1,dot2,graph];
f[x_,y_]=-(x+y-(x^2)-(y^2));
dot1=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{-2,-2,f[-2,-2]}]}];
dot2=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{(1/2),(1/2),f[(1/2),(1/2)]+0.05`}]}];
graph=Plot3D[f[x,y],{x,-2,2},{y,-2,2},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,dot1,dot2,DisplayFunction->$DisplayFunction]

3.  f has a line of critical points.

Clear[u,x,y,t,f,line,graph];
f[x_,y_]=1-(((x+y))^2);
line=Graphics3D[{Thickness[0.01`],RGBColor[1,0,0],Line[{{-2,2,f[-2,2]},{2,-2,f[2,-2]}}]}];
graph=Plot3D[f[x,y],{x,-2,2},{y,-2,2},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,line,DisplayFunction->$DisplayFunction]

Clear[u,x,y,t,f,line,graph];
f[x_,y_]=(E^(-(1/2) (((x+y))^2)));
line=Graphics3D[{Thickness[0.01`],RGBColor[1,0,0],Line[{{-2,2,f[-2,2]},{2,-2,f[2,-2]}}]}];
graph=Plot3D[f[x,y],{x,-2,2},{y,-2,2},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,line,DisplayFunction->$DisplayFunction]

4. f has a circle of critical points.

Clear[u,x,y,t,f,line,graph,curve];
f[x_,y_]=1-((((x^2)+(y^2)-2))^2);
line=ParametricPlot3D[{(Sqrt[2]) Cos[t],(Sqrt[2]) Sin[t],1.1`},{t,0,2 π},PlotStyle->Red,DisplayFunction->Identity];
graph=Plot3D[f[x,y],{x,-1.7`,1.7`},{y,-1.7`,1.7`},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,line,DisplayFunction->$DisplayFunction]

5. Every point of f  is a critical point.

Clear[f,x,y];
f[x_,y_]=3.7;
Print["Horizontal Plane"]
Plot3D[f[x,y],{x,-2,2},{y,-2,2}]

6. f has a local maximum which is not the global maximum.

Clear[u,x,y,t,f,dot1,dot2,graph];
f[x_,y_]=-(x+y-(x^2)-(y^2))+5 (E^(-(((x-(1/2)))^2)-(((y-(1/2)))^2)));
dot1=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{-2,-2,f[-2,-2]}]}];
dot2=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{(1/2),(1/2),f[(1/2),(1/2)]+0.05`}]}];
graph=Plot3D[f[x,y],{x,-2,2},{y,-2,2},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,dot1,dot2,DisplayFunction->$DisplayFunction]

7. f has a global maximum which is not a local maximum.

Can't be done (unless you define a "local maximum" as being strictly an interior point, in which case the global maximum on the boundary would not be considered "local").

8. f has a local maximum and f_x>0 at the maximum.

It must occur on the boundary.  In particular, as you move in the x-direction you must be going up and then stop at this point.  Either of the two points below satisfies this criterion.

Clear[u,x,y,t,f,dot1,dot2,graph];
f[x_,y_]=(x^2)+(y^2);
dot1=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{2,-1,f[2,1]}]}];
dot2=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{2,2,f[2,2]}]}];
graph=Plot3D[f[x,y],{x,-1,2},{y,-1,2},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,dot1,dot2,DisplayFunction->$DisplayFunction]

9. f has a local maximum which is not a critical point.

See graph above, for problem 8.

10. f has global maximum which is not a critical point.

It must be at a boundary;  see graph for problem 8.

11. f has a critical point which is not a local maximum.

Clear[u,x,y,t,f,dot,graph];
f[x_,y_]=(x^2)-(y^2);
dot=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{0,0,f[0,0]}]}];
graph=Plot3D[f[x,y],{x,-1,1},{y,-1,1},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,dot,DisplayFunction->$DisplayFunction]

Clear[u,x,y,t,f,dot,graph];
f[x_,y_]=(x^3)+(y^2);
dot=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{0,0,f[0,0]}]}];
graph=Plot3D[f[x,y],{x,-1,1},{y,-1,1},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,dot,DisplayFunction->$DisplayFunction]

12. f has a critical point which is neither a local maximum nor a local minimum.

See graphs (problem 11) above.

13. f has a critical point which is a maximum in the x-direction and a minimum in the y-direction.

Clear[u,x,y,t,f,dot,graph];
f[x_,y_]=-(x^2)+(y^2);
dot=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{0,0,f[0,0]}]}];
graph=Plot3D[f[x,y],{x,-1,1},{y,-1,1},AxesLabel->{"x","y"," "},DisplayFunction->Identity];
Show[graph,dot,DisplayFunction->$DisplayFunction]

14. f has a point which is a maximum in the x-direction and a minimum in the y-direction, but is not a critical point.

Clear[u,x,y,t,f,dot,graph];
f[x_,y_]=3 x-2 y;
dot=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{1,1,f[1,1]}]}];
graph=Plot3D[f[x,y],{x,-1,1},{y,-1,1},AxesLabel->{"x","y"," "},DisplayFunction->Identity,DisplayFunction->Identity];
Show[graph,dot,DisplayFunction->$DisplayFunction]

15. f has a point which is a local minimum in the x-direction and a local minimum in the y-direction, but which is NOT a local minimum of f.

Clear[u,r,theta,t,x,y,dot,fred];
u[r_,theta_]=(r^2) Cos[4 theta];
dot=Graphics3D[{PointSize[0.03],RGBColor[1,0,0],Point[{0,0,0}]}];
fred=ParametricPlot3D[{r Cos[theta],r Sin[theta],u[r,theta]},{r,0,1},{theta,0,2 π},PlotPoints->{5,60}];
Show[fred,dot]
Print["f(x,y) = ",u[(Sqrt[(x^2)+(y^2)]),ArcTan[(y/x)]]];
Print["---------------------------------------------"];
Print["  "];

16. f has a local maximum NOT on the boundary and the gradient is not zero at this local maximum.

Clear[u,x,y,t,f,dot,graph];
f[x_,y_]=1-4 (Sqrt[(x^2)+(y^2)]);
dot=Graphics3D[{PointSize[0.02`],RGBColor[1,0,0],Point[{0,0,f[0,0]}]}];
graph=Plot3D[f[x,y],{x,-1,1},{y,-1,1},AxesLabel->{"x","y"," "},ViewPoint->{-5,2,1},DisplayFunction->Identity];
Show[graph,dot,AspectRatio->1,DisplayFunction->$DisplayFunction]

17. f  has a local maximum which is neither at a critical point nor at a point on the boundary.

Can't be done!!  
If you're at an interior point and a tangent plane exists at that point, it MUST be horizontal (so the gradient would be zero).  If there isn't a tangent plane, then the gradient does not exist.  Either case is called a "critical point."

18. f has two local maxima, but no other critical points (i.e., the only critical points are at the maxima).

Can't be done!!  To get from one maximum to the other, you must go down and then up.  If you try to find the path between the two where you go down the least amount possible, then the bottom of this path is a critical point.  Nearby this "mountain pass", the graph looks like the Pringles function (see the second graph below).

Clear[u,x,y,t,f,dot1,dot2,dot3,graph];
f[x_,y_]=(E^(-4 ((((x-0.75`))^2)+(((y-0.75`))^2))))+1.5` (E^(-4 ((((x+0))^2)+(((y+0))^2))));
graph=Plot3D[f[x,y],{x,-1,2},{y,-1,2},AxesLabel->{"x","y"," "},PlotRange->{0,1.6`},PlotPoints->40,DisplayFunction->Identity];
dot1=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{0,0,f[0,0]+0.05`}]}];
dot2=Graphics3D[{PointSize[0.04`],RGBColor[1,0,0],Point[{0.75`,0.75`,f[0.75`,0.75`]+0.05`}]}];
Clear[dot3];
dot3=Graphics3D[{PointSize[0.04`],RGBColor[0,1,0],Point[{0.4362628965222642`,0.4362628965222642`,f[0.4362628965222642`,0.4362628965222642`]+0.1`}]}];
Show[graph,dot1,dot2,DisplayFunction->$DisplayFunction]

Show[graph,dot1,dot2,dot3,DisplayFunction->$DisplayFunction]

*****************************************

The following will generate an animation showing how to "make" the graph of a function with a minimum in the x-direction and a minimum in the y-direction which is not a local minimum of the function, by starting with a bowl-shaped graph.

To animate the graphics, click once on the middle cell bracket to hightlight the cells, then go up to the "Cell" menu and click on "Animate Selected Graphics".

Clear[u,r,theta,t,x,y,a,n];
n=20;
Do[a=1-(i/n);Print[ParametricPlot3D[{r Cos[theta],r Sin[theta],a (r^2)+(1-a) (r^2) Cos[4 theta]},{r,0,1},{theta,0,2 π},PlotPoints->{5,60},PlotRange->{-1,1}]],{i,0,n}];