Unconstrained Optimization - Example #1

Define Function To Be Optimized/Analyzed:

f[x_,y_]:=x^2+y^2+x^2*y+4;

First plot surface z = f(x,y) to see its shape.  Use both a 3d perspective and a contour plot:

Plot3D[f[x,y],{x,-2,2},{y,-2,2},AxesLabel->{"x","y","f[x,y]"}, PlotLabel -> "Contour Plot of the Function x^2+y^2+x^2*y+4", ColorFunction->Function[{x,y,z},Hue[z]]]

ContourPlot[f[x,y],{x,-2,2},{y,-2,2},AxesLabel->{"x","y","f[x,y]"}, PlotLabel -> "Contour Plot of the Function x^2+y^2+x^2*y+4", ColorFunction->Hue, Contours->100, Axes->True]

Compute Gradient Of f(x,y):

Gradf[x_,y_]:={D[f[x,y],x],D[f[x,y],y]};
Gradf[x,y]

Solve For Critical Points:

Solve[Gradf[x,y]=={0,0},{x,y}]