Classifying critical points for a function of two variables

Math 104 Calculus II, November 9, 2017
T. Ratliff, Wheaton College
ratliff_thomas@wheatoncollege.edu

f(x,y) = (x^2)y + 3 x y

We can define f and take the partial derivatives
Notice that you need to leave a space between the ‘x’ and ‘y’ so that Mathematica knows these are two different variables. If I had entered ‘xy’, it would think that I was using a single variable named xy.

f=x^2 y + 3 x y
D[f,x]
D[f,y]

The critical points occur where both partials are simultaneously 0, i.e. ∇f(x,y)=(0,0)
Notice that in the Solve[ ] command we need to us the double equal “==” rather than “=” since we are creating an equation, not assigning the partials to be 0.
We need to include the equations in the brackets { } to indicate that we want solutions to the set of equations.

Solve[{D[f,x]==0,D[f,y]==0}]

Now let’s classify the critical points by looking at a contourplot and 3D plot

ContourPlot[f, {x,-4,1},{y,-1,1},Contours->30,ColorFunction->"Rainbow"]
Plot3D[f,{x,-4,1},{y,-1,1},MeshFunctions->{#3&},Mesh->30,ColorFunction->"Rainbow"]

Therefore, f(x,y) has two critical points,  (-3,0) and (0,0), and both of them are saddle points.

f(x,y) = 4 x y - (x^4)-(y^4)+3

Let’s try the same as above

f=4 x y - x^4 - y^4 + 3
Solve[{D[f,x]==0, D[f,y]==0}]

Oops. Looks like there are solutions involving complex numbers. 
Let’s restrict to solutions with only real numbers.

Solve[{D[f,x]==0, D[f,y]==0},Reals]

That’s better. Now let’s classify the critical points.
I need to add more contour lines to the contour plot to see what’s going on.

ContourPlot[f, {x,-2,2},{y,-2,2},Contours->70,ColorFunction->"Rainbow"]
Plot3D[f, {x,-2,2},{y,-2,2},MeshFunctions->{#3&},Mesh->30,ColorFunction->"Rainbow"]

Therefore, 
	(-1,-1) and (1,1) are local maxima
	(0,0) is a saddle point