Review of Simple Multivariate Calculus

Contents

1. Definition of a multivariate function		7. Using the limit concept to compute a derivative
		2. Interior points					8. Calculating partial derivatives
		3. 3D-graph commands in Mathematica		9. Higher order partial derivatives
		4. Graphs and level curves 				10. Multiple Low/High Points Examples	
		5. Limits and Continuity				11. More examples	
		6. Partial differentiation

Department of Economics
Iowa State University

1. Definition of a Multivariate Function

Definition:

Suppose D is a set of n-tuples of real numbers (x1, x2, x3, . . . , xn).  A real-valued function f on D is a rule that assigns a real number

to each element in D.  The set D is the function’s domain.  The set of y-values taken on by f is the range of the function.  The symbol y is the dependent variable of f, and f is said to be a function of the n independent variables (Subscript[x, 1]) to (Subscript[x, n]).  We also call the x’s the function’s input variables and we call y the function’s output variable.

Examples:

a. The volume of a right circular cylinder is a function of the radius and height, V = f(r, h) or V = π (r^2) h.
b. The level of production from a given technology is a function of two inputs (Subscript[x, 1]) and (Subscript[x, 2]), y = f((Subscript[x, 1]), (Subscript[x, 2]))  or y = 20 (Subscript[x, 1])+ 16 (Subscript[x, 2])- 2 ((Subscript[x, 1])^2) - ((Subscript[x, 2])^2)

Mathematica Command:

In Mathematica, the syntax for defining a multivariate function is
		f[(Subscript[x, 1])_, (Subscript[x, 2])_, ..., (Subscript[x, n]) _ ] := expression involving (Subscript[x, 1]), (Subscript[x, 2]), ..., (Subscript[x, n])
Considering the following examples:

Clear[V,  r,  h]
V[r_,  h_]  :=  π (r^2) h
V[2,  3]

Clear[y,  x1,  x2]
y[x1_,  x2_]  :=  
      20 x1  + 16 x2  -  2 x1^2  -  x2^2
y[2,  3]

2. Interior Points

Definition:

A point ((Subscript[x, 0]), (Subscript[y, 0])) in the region R in the x-y plane is an interior point of R if it is the center of a disk that lies entirely in R.  A point ((Subscript[x, 0]), (Subscript[y, 0])) is a boundary point of R if every disk centered at  ((Subscript[x, 0]), (Subscript[y, 0])) contains points that lie outside of R and well as points that lie in R.  (The boundary point itself needs to belong to R).  The interior points of a region, as a set, make up the interior of the region.  The region=s boundary points make up its boundary.  A region is open if it consists entirely of interior points.   A region is closed if it contains all of its boundary points.  

A region in the plane is bounded if it lies inside a disk of fixed radius.  A region is unbounded if it is not bounded.

A point ((Subscript[x, 0]), (Subscript[y, 0]), (Subscript[z, 0]) ) in a region D in space is an interior point of D if it is the center of a ball that lies entirely in D.  A point  ((Subscript[x, 0]), (Subscript[y, 0]), (Subscript[z, 0]) ) is a boundary point of D if every sphere centered at ((Subscript[x, 0]), (Subscript[y, 0]), (Subscript[z, 0]) ) encloses  points that lie outside of D and well as points that lie in D.   The interior of D is the set of interior point of D.  The boundary of D is the set of  boundary points of D.  A region D is open if it consists entirely of interior points.   A region is closed if it contains its entire boundary.

3. 3D-Graph Commands in Mathematica

In Mathematica, the commands for three dimentional graphics, with some useful corresponding options, follow:
	■ Plot3D[f, {x, xmin, xmax}, {y, ymin, ymax}, options]
		  generates a three-dimensional plot of f as a function of x and y.
	■ Show[plot1, plot2, ..., options]
		 shows several plots combined
	options:
	AxesLabel -> {xlabel, ylabel, zlabel }: specifies labels for axes. 
	ViewPoint -> {x, y, z}:  gives the position of the view point relative to the center of the three-dimensional box 
		Some commonly used values are listed below.
				({{"{1.3,"" ""-2.4,"" ""2}""
", "default setting "}, {"{0,""
""-2,"" ""0}"" ", "directly in front "}, {"{0,"" ""-2,"" ""2}"" ", "in front and up "}, {"{0,"" ""-2,""
""-2}"" ", "in front and down "}, {"{-2,"" ""-2,"" ""0}"" ", "left\[Hyphen]hand corner "}, {"{2,""
""-2,"" ""0}"" ", "right\[Hyphen]hand corner "}, {"{0,"" ""0,""
""2}"" ", "directly above "}})
		You can also generate the viewpoint value from the menu "Input -> 3D ViewPoint Selector".
	ImageSize->x: specifies the absolute size of an image to render.
	 Mesh-> True:  Adds a mesh to the plotted surface.  True is the default.  
	DisplayFunction: specifies the function to apply to graphics objects in order to display them.
		 Two commonly used setting are "DisplayFunction  -> Identity"
		 (which causes the objects to be returned, but no display to be generated)
		 and "DisplayFunction  -> $DisplayFunction" (which generate display). 	
	ColorFunction: specifies a function to apply to z values to determine the color to use for a particular x, y region, 
		e.g., ColorFunction -> Hue yields a range of colors
		or  ColorFunction->(RGBColor[1-#,#,.9]&) 
		which shades by alternating various levels of red and green but with a fixed high level of blue.  ColorFunction is a Mathematica function that shades plots.  When we assign a color directive to ColorFunction, that specification will be used for adding color.  With 3-dimensional objects Mathematica shades them (or changes colors) to show elevation and make them easier to understand.  Each time Colorfunction is called Mathematica will supply a different value to the ColorFunction so that this change takes place.  This value is represented by # in the expression RGBColor[1-#,#,.9]&.  The first time ColorFunction is called the colors will be Red = 1-#, Green = # and Blue = 0.9.  The second time  ColorFunction  is called a new value will be assigned to # and the color used will differ.We  add the function operator (&) to ColorFunction->(RGBColor[1-#,#,.9]&) so that this color rule will be applied and reappllied each time Mathematica choses to draw another part of the 3-D plot.  Therefore the ColorFunction will start at the given shade, but then modify it as the plotting proceeds.  If we do not add the & operator, Mathematica will give an error message.

Considering the following example:

Clear[p0];
p0  =  
        Plot3D[ Exp[0.5*x]*Sin[x y], {x, 0, 4}, {y, 0, 4},  
          DisplayFunction  ->  Identity];
Show[p0,  DisplayFunction  -> $DisplayFunction];

Now consider a number of variations on this plot.

Clear[p0, p1, p2, p3, p4, p5];
p0 = 
        Plot3D[ Exp[0.5*x]*Sin[x y], {x, 0, 4}, {y, 0, 4}, 
          ColorFunction -> Hue, 
          DisplayFunction -> Identity];
Show[p0,ViewPoint->{1.3, -2, -1},DisplayFunction  -> $DisplayFunction];

Clear[p0, 
        p1, p2, p3, p4, p5];
\(p1 = 
        Plot3D[Exp[0.5*x]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          ColorFunction -> \((Hue[1 - #] &)\), 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, DisplayFunction -> Identity];\)
Show[p1,ViewPoint->{1.3, -2, -1},DisplayFunction  ->  $DisplayFunction];

\(p2 = 
        Plot3D[Exp[0.5*x]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          ColorFunction -> \((Hue[1 - #] &)\), \ Boxed -> False, 
          TextStyle -> {FontFamily -> "Times", 
              FontSize -> 16}, ImageSize -> \ 350, 
          Ticks -> {{0,  .5, 3}, {0, 2, 3.5}, Automatic\ }, \ 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, PlotPoints -> 
            20, 
DisplayFunction -> 
            Identity];\)
Show[ p2,ViewPoint->{1,-2,3},DisplayFunction  -> $DisplayFunction];

\(p3 = 
        Plot3D[Exp[0.5*x]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          ColorFunction -> \((RGBColor[ .9, #, 1 - #] &)\), \ 
          Boxed -> False, 
          TextStyle -> {FontFamily -> "Times", 
              FontSize -> 14}, \ ImageSize -> \ 400, 
          Ticks -> {Automatic, {0, 2, 3.5}, {\(-1\), 0, 1}\ }, \ 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, PlotPoints -> 
            35, 
DisplayFunction -> 
            Identity];\)
Show[ p3,ViewPoint->{1.3, -2, 3},DisplayFunction  -> $DisplayFunction];

\(p4 = 
        Plot3D[Exp[0.5*x]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          ColorFunction -> \((Hue[1 - #] &)\), \ Boxed -> True, 
          TextStyle -> {FontFamily -> "Times", 
              FontSize -> 8}, \ ImageSize -> \ 200, 
          Ticks -> {{0,  .5, 3}, {0, 2, 3.5}, Automatic\ }, \ 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, PlotPoints -> 
            20, 
DisplayFunction -> 
            Identity];\)
Show[ p4,ViewPoint->{-2,2,-1},DisplayFunction  ->  $DisplayFunction];

\(p5 = 
        Plot3D[Exp[0.5*x]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          ColorFunction -> \((RGBColor[1 - #, #,  .9] &)\), \ 
          Boxed -> False, 
          TextStyle -> {FontFamily -> "Times", 
              FontSize -> 8}, \ ImageSize -> \ 200, 
          Ticks -> {Automatic, {0, 2, 3.5}, {\(-3\), 0, 4}\ }, \ 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, PlotPoints -> 20, 
          Mesh -> False, 
DisplayFunction -> 
            Identity];\)
Show[ p5,ViewPoint->{-1,-2,3},DisplayFunction  ->  $DisplayFunction];

\(p6 = 
        Plot3D[Exp[0.5*x]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          Background -> GrayLevel[0.5], 
          ColorFunction -> \ \ \((RGBColor[ .9, #, 
                  1 - #] &)\), \ \ \ Boxed -> False, 
          TextStyle -> {FontFamily -> "Times", 
              FontSize -> 14}, \ ImageSize -> 280, 
          Ticks -> {{0,  .5, 3}, Automatic\ , Automatic\ }, \ 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, PlotPoints -> 25, 
          FaceGrids -> All, 
DisplayFunction -> 
            Identity];\)
Show[ p6,ViewPoint->{3,-2,1},DisplayFunction  ->  $DisplayFunction];

\(p7 = 
        Plot3D[Exp[0.5*x]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          Background -> RGBColor[ .9,  .2,  .3], \ 
          ColorFunction -> \ \((GrayLevel[#^2] &)\), \ 
          Boxed -> True, 
          Ticks -> {{0,  .5, 3}, Automatic\ , Automatic\ }, \ 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, TextStyle -> {FontFamily -> "Times", 
              FontSize -> 18}, PlotPoints -> 25, 
          ImageSize -> \ 500, 
DisplayFunction -> 
            Identity];\)
Show[ p7,ViewPoint->{-3,2,-1},DisplayFunction  ->  $DisplayFunction];

\(p8 = 
        Plot3D[Exp[0.5*x^2]*Sin[x\ y], {x, 0, 4}, {y, 0, 4}, 
          Background -> RGBColor[ .9,  .2,  .3], \ 
          ColorFunction -> \ \((GrayLevel[#^2] &)\), \ 
          Boxed -> True, 
          Ticks -> {{0,  .5, 3}, Automatic\ , Automatic\ }, \ 
          AxesLabel -> {\*""\!\(x\_1\)"", \*""\!\(x\_2\)"", 
              None}, TextStyle -> {FontFamily -> "Times", 
              FontSize -> 18}, PlotPoints -> 25, 
          ImageSize -> \ 500, 
DisplayFunction -> 
            Identity];\)
Show[ p8,ViewPoint->{-3,2,1},DisplayFunction ->  $DisplayFunction];

Here is a list of options for Plot3D.

Print["The options for Plot3D:"];
Options[Plot3D]

■ ContourPlot[f, {x, xmin, xmax}, {y, ymin, ymax}, options] 
		generates a contour plot of f as a function of x and y.  The plot shows different combinations of (Subscript[x, 1])and (Subscript[x, 2]) that lead to the same value
		of the function y = f((Subscript[x, 1]),(Subscript[x, 2]) ).
	options:
	Contours -> {(Subscript["z", 1]), (Subscript["z", 2]), … }: specifies the explicit z values of contours to use
	 Frame -> True/False:specifies whether or not to draw a frame with tick marks
	 Axes -> True/False:specifies whether or not to draw axes
	 AxesLabel -> {xlabel, ylabel}: specifies labels for axes. 
	 ColorFunction: specifies a function to apply to z values to determine the color to use for a particular x, y region,
	  	   e.g., ColorFunction -> Hue yields a range of colors. 
	 ContourStyle -> style: specifies the style in which contour lines should be drawn,
	  	   e.g., ContourStyle->Thickness[0.01] specifies that the contour lines should be drawn of thickness 0.01
	 ContourShading -> True/False:specifies whether the regions between contour lines should be shaded

Considering the following examples:

Clear[c];
Clear[x1, x2, f, 
      c]
 c  =  { 0.1, 0.2, 0.4,  0.6, 0, 0.8, 1};  
f[x1_, x2_] := 
        Exp[-(x1^2 +  
                x2^2)];
Print["This is the \
function f[x1,x2]= ", 
        f[x1, x2]];
Print["This is a graph of \
the function" ];
surface=Plot3D[  f[x1, x2],{x1, -2, 2},{x2, -2, 2},AxesLabel -> {"x1", "x2", "f(x1,x2)"}, TextStyle -> {FontFamily -> "Times", 
                  FontSize -> 14},ViewPoint->{1.3, -2.4, 2}, ImageSize ->  400, Boxed -> True,Ticks -> {Automatic, Automatic, {0, 0.5, 1}}]; 

Print["These are four different contour plots of the function\
" ];

ContourPlot[
          f[x1, x2], {x1, -2, 2}, {x2, -2, 2},   Contours -> 
            c, 
ColorFunction  ->  Hue, 
          ContourStyle -> Thickness[0.015] ];

ContourPlot[f[x1, x2],{x1, -2, 2},{x2, -2, 2},  Contours -> c,Background -> RGBColor[ .1,  .8,  .2],Axes -> True,AxesLabel -> {"x1", "x2"}, TextStyle -> {FontFamily -> "Times", 
                FontSize -> 14},
 ColorFunction-> (RGBColor[1 - #, #,  .9] &),  ContourStyle -> Thickness[0.015]];

ContourPlot[
          f[x1, x2], {x1, -2, 2}, {x2, -2, 2},   Contours -> 
            c, 
ContourShading  ->  False,  
          ContourStyle -> Thickness[0.015]];

\(ContourPlot[
          f[x1, x2], {x1, \(-2\), 2}, {x2, \(-2\), 2}, \ \ Contours -> 
            c, \ Frame\  -> \ False, \ Axes -> \ True, \ 
          AxesLabel -> \ {"x1_label", "x2_label"}, \ \ ContourShading\  -> \ False, ContourStyle -> Thickness[0.01]];\)


Clear[
        c];
Clear[x1, x2, f, 
      c]
 c  =  { 10,  15,  20,  25};  
A = 10;  α1  = 
      0.3;  α2  =  
      0.5;
f[x1_, x2_] := 
        A*x1^α1*
          x2^α2;
Print["This is a \
different function f[x1,x2]= ", f[x1, x2]]
surface=Plot3D[  f[x1, x2],{x1, 0, 5},{x2, 0, 5},AxesLabel -> {"x1", "x2", "f(x1,x2)"}, TextStyle -> {FontFamily -> "Times", 
                  FontSize -> 14},ViewPoint->{1.3, -2.4, 2}, ImageSize ->  400, Boxed -> True,Ticks -> {Automatic, Automatic, Automatic}]; 

ContourPlot[
          f[x1, x2], {x1, 0, 5}, {x2, 0, 
            5}, 
ColorFunction  ->  Hue, 
          ContourStyle -> Thickness[0.015] ];

ContourPlot[f[x1, x2],{x1, 0, 5},{x2, 0, 5},  Contours -> c,Background -> RGBColor[ .1,  .8,  .2],Axes -> True,AxesLabel -> {"x1", "x2"}, TextStyle -> {FontFamily -> "Times", 
              FontSize -> 14},
 ColorFunction-> (RGBColor[1 - #, #,  .9] &),  ContourStyle -> Thickness[0.015]];

Here is a list of options for ContourPlot.

Print["The options for ContourPlot:"];
Options[ContourPlot]

■ ParametricPlot3D[{(Subscript["f", x]), (Subscript["f", y]), (Subscript["f", z])}, {t, tmin, tmax}, options] 
		produces a three-dimensional space curve parametrized by a variable t which runs from tmin to tmax.
	 ■ ParametricPlot3D[{(Subscript["f", x]), (Subscript["f", y]), (Subscript["f", z])}, {t, tmin, tmax}, {u, umin, umax}, options]
	 	 produces a three-dimensional surface parametrized by t and u, where t runs from tmin to tmax and u runs from umin to umax. 
	options:
	PlotPoints->x:  specifies how many sample points to use.
	BoxRatios->{x,y,z}:  gives the ratios of side lengths for the bounding box of the three-dimensional picture. 
	 ViewPoint -> {x, y, z}:  gives the position of the view point relative to the center of the three-dimensional box.
	 AxesLabel -> {xlabel, ylabel, zlabel }: specifies labels for axes.
	 SurfaceColor[RGBColor[.1, .9,.1]] can be added to the list of arguments of the function as in {x1, x2, z, ,SurfaceColor[RGBColor[.1, .9,.1]]} to change the default color of a parametric plot.  ColorFucntion and other such operators cannot be used in ParametricPlot3D.

Here are some examples of space curve.

Print["This is a space curve"];
\(\(\(line1 = 
        ParametricPlot3D[{t, Exp[t], t^2}, {t, \(-2\), 2}, \ 
          AxesLabel -> \ {"x", \ "y", "z"}];\)\(
\)
    \)\)
Print["This is a space curve with more thickness, and different \
ViewPoint"];
\(\(line2 = 
        ParametricPlot3D[{t, Exp[t], t^2, \ Thickness[0.02]}, {t, \(-2\), 
            2}, \ ViewPoint\  -> \ {\(-1\), \ 2, \ 
              3}, \ \ AxesLabel -> \ {"x", \ "y", "z"}];\)\)

Here are some examples of space surface.

\(\(Print[\*""This is a simple surface in \!\(R\^3\)""];\)\)
ParametricPlot3D[{-3 x2 + 10, x2, y}, {x2, -4, 4}, {y, 0,  
          30}, ViewPoint -> {2, 5, 
            10}];

\(\(Print[\*""This is a more complicated surface in (R^3)""];\)\)
sur1  =  
        ParametricPlot3D[{u^2,  v,  u v},  {u,  -1,  
            1},  {v, -1, 
            1},   AxesLabel ->  {"x", "y",  "z"}, 
          ViewPoint -> {1.425, -1.108,  
              2.589}];

Print["This is the previous surface with differet BoxRatios and \
PlotPoints"];
sur2 =  
        ParametricPlot3D[{u^2,  v,  u v},  {u,  -1,  
            1},  {v,  -1, 
            1},   AxesLabel ->  {"x",  "y", "z"},  
          ViewPoint -> {1.425,  -1.108, 2.589},  
          BoxRatios  ->  {1, 1, 0.8},  
          PlotPoints ->  60];

We can create a variety of functions and then overlay them.

Clear[ f,  x1, x2]
A = 
      10;  α1  =  0.3;  α2  =  
      0.5;
f[x1_, x2_] := 
        A*x1^α1*x2^α2;
x10  =  
      2;  x11 = 4; 
    x20 = 2;
Print["This is the graph of a \
function"]
\(surface\  = \ 
          Plot3D\ [\ f[x1, x2], \ {x1, 0, \ 8}, \ {x2, \ 0, \ 8}, \ 
            AxesLabel\  -> \ {"x1", "x2", "f[x1,x2]"}, 
ViewPoint -> {2, \ \(-1.288\), \ 1.540}, \ 
            PlotPoints -> 40, \ 
            DisplayFunction\  -> \ $DisplayFunction];\)

Print["This is the graph of a vertical plane in the same \
space"];
(* We use SurfaceColor[RGBColor[.1, .9,.1]] to create a color for the surface .   This option is included as a fourth argument in the list of items to plot *)
plane1 = ParametricPlot3D[ {x10, x2, z,SurfaceColor[RGBColor[.1, .9,.1]]}, {x2,  0,  8}, {z,  0,  40},\(AxesLabel\  -> {"x1", "x2", "f[x1,x2]"}\),ViewPoint -> {2,  -1.288,  1.540},BoxRatios -> {1, 1, 0.8}, PlotPoints -> 40,   DisplayFunction  ->   $DisplayFunction];

Print["This is the \
graph of a
different plane in the same space"];
g[
          x2_] := -x1 + 8*x2;
plane2= ParametricPlot3D[ {x1, x2, g[x2],SurfaceColor[RGBColor[.8, .4,.1]]},{x1, 0, 8}, {x2,  0,  8},\(AxesLabel\  -> \ {"x1", "x2", "f[x1,x2]"}\),ViewPoint -> {2,  -1.288, 1.540},BoxRatios -> {1, 1, 0.8}, PlotPoints -> 40,   DisplayFunction  ->  $DisplayFunction];

Print["This \
combines the three surfaces"];
Show[surface,  plane1, plane2,  
          DisplayFunction  -> $DisplayFunction,  
          ImageSize  ->  300];

Print["This is a line that traces the graph of the
curve when x1 is equal to 4"];
(* We use {RGBColor[ .8, 0.3, 0.2], Thickness[ .02]} to create a color for the line .  This option is included as a fourth argument in the list of items to plot *)
surfaceline = ParametricPlot3D[ {x11, x2, f[x11,  x2],{RGBColor[ .8, 0.3, 0.2], Thickness[ .02]} },{x2,  0,  8},  DisplayFunction  ->  $DisplayFunction];

Print["This \
combines the
graphs of the line and surface"];
Show[surface, 
        surfaceline, DisplayFunction  ->  $DisplayFunction,  
        ImageSize  -> 300];
Null

Here is a list of options for ParametricPlot3D.

Print["The options for ParametricPlot3D:"]
Options[ParametricPlot3D]

4. Graphs and Level Curves

a. (R^2)

The set of points in the plane where a function f(x, y) has a constant value f(x,y) = c is called a level curve of f.  The set of all points (x, y, f(x, y)) in space, for (x, y) in the domain of f, is called the graph of f.  The graph of f is also called the surface z = f(x, y).
Consider the function 	z = f(x, y) = 100  -  (x^2) - (y^2)
with graph as follows

\(\(\(
\)\(Print["This is an example graph of a function of two variables"]

    \(Plot3D[\ \ 100 - x^2 - y^2, {x, \(-10\), 10}, {y, \(-10\), 10}, 
	
        AxesLabel -> {"x", "y", "f(x,y)"}, 
        ViewPoint -> {\(-8\), 5, 0}, \ \ ColorFunction -> 
          Hue, \ \ ImageSize -> \ 400];\)

    Print["This is an example level curve of a function of two variables"]

    \(ContourPlot[100 - x^2 - y^2, {x, \(-10\), 10}, {y, \(-10\), 10}, \ 
        ColorFunction -> Hue, ImageSize -> 300];\)\)\)\)

Notice that the level curves form a series of concentric circles as the function rises uniformly from all directions to a maximum point at 100 with coordinates (0, 0).  Consider another function z = f(x, y) = \(TraditionalForm\`\(\(x\^2\) y\^2\)\/\(\((1 + x\^2)\)\ \((1 + y\^2)\)\)\)
with graph as follows

Print["This is an example graph of a function and a
cutting plane outlining a level set"]
Clear[f, x, y];
c  =  0.9;
f[x_, y_] := (x^2  y^2)/(1 + x^2) (1 + y^2);
\(\(surface\  = \ 
        Plot3D[\ \ f[x, y], {x, 0, 2}, {y, 0, 2}, 

          DisplayFunction -> Identity];\)\)
\(\(plane\  = \ 
        Plot3D[c, {x, 0, 2}, {y, 0, 2}, 
		DisplayFunction -> 
            Identity];\)\)
\(\(Show[surface, plane, AxesLabel -> {"x", "y", "f(x,y)"}, 
        ViewPoint -> {3.296, 0, 
            0.764}, 
		DisplayFunction -> $DisplayFunction, \ 
        ImageSize -> \ 400];\)\)
Print["This shows the contour line (curve) 
formed by the intersection of the surface and the plane
at height 0.9"];
c = {0.9};
\(\(ContourPlot[f[x, y], {x, 0, 2}, {y, 0, 2}, \ Contours -> \ c, 
	
        Frame -> False, Axes -> \ True, AxesLabel -> {"x", "y"}, 
        ContourStyle -> Thickness[0.01], 
        ColorFunction -> Hue\ ];\)\)
Print["This shows a number of contours for the
surface"];
c  = {0.1, 0.3, 0.5,  0.2, 1.2};
\(\(ContourPlot[f[x, y], {x, 0, 2}, {y, 0, 2}, \ Contours -> \ c, 
	
        Frame -> False, Axes -> \ True, AxesLabel -> {"x", "y"}, 
        ColorFunction -> Hue];\)\)

b. (R^3)

The set of points (x, y, z) in space where a function of three independent variables f(x, y, z) has a constant value f(x, y, z) = c is called a level surface of f.  The set of all points (x, y, z, f(x, y, z)) in 4-space, for (x, y, z) in the domain of f, is called the graph of f.  The graph of f is also called the surface w = f(x, y, z).
Consider the function f(x, y, z) = Sin[x y] - (z^2) 
with the level surface as follows

Needs["Graphics`ContourPlot3D`"]
Print["This is an example level surface of a function with three \
variables"]
ContourPlot3D[
      2 x^2  +  y^2  +  z^2,  {x,  -3,  3}, {y, -1, 
        1},  {z, -1,  1},  Contours  ->  {1, 2, 3},  
      PlotPoints ->  {5, 7}]

5. Limits and Continuity

Limits:

We say that a function f(x,y) approaches the limit L as (x, y) approaches ((Subscript[x, 0]), (Subscript[y, 0])), and write

Continuity:

A function f(x, y) is continuous at the point ((Subscript[x, 0]), (Subscript[y, 0])) if

6. Partial Differentiation

Definition:

Let f be a function with domain in an open set in (R^n) and range in (R^1), i.e. y = f((Subscript[x, 1]), (Subscript[x, 2]), ... , (Subscript[x, n])).  Now define the partial derivative of f with respect to (Subscript[x, i]) as

whenever the limit exists.  The reason we want f to have a domain in an open set is that we don't want to worry about boundary points. 
The slope of the curve z = f(x, y) at the point ((Subscript[x, 0]), (Subscript[y, 0]), f((Subscript[x, 0]), (Subscript[y, 0]))) in the plane  y = (Subscript[y, 0]) is the value of the partial derivative of f with respect to x at ((Subscript[x, 0]), (Subscript[y, 0])).

Mathematica Command:

In Mathematica, the syntax for finding partial differentiation is
		D[f[(Subscript[x, 1]), (Subscript[x, 2]), ..., (Subscript[x, n]) ] , (Subscript[x, i])]
Without formally defining the how to compute a partial derivative (other than by the definition), considering the following examples of how Mathematica can compute partial derivatives.

Clear[f, x1, x2, x3, fx1, fx2, 
        fx];
f[x1_, x2_, x3_] := 
        3*x1^3*x2^2 + 
          2*x3*x1^2;
Print["This is f[x1, x2, x3], f[x1, x2, x3] \
= ",  f[x1,  x2,  x3]]
fx1 = D[f[x1, x2, x3], x1];  
Print["This is partial derivative of f[x1, x2, x3] with respect to x1, \!\(TraditionalForm\`∂\\ \(f(x)\)\/∂x\_1\) = ",fx1]
fx2 = D[f[x1, x2, x3], x2]; 
Print["This is partial derivative of f[x1, x2, x3] with respect to x2, \!\(TraditionalForm\`∂\\ \(f(x)\)\/∂x\_2\) = ",fx2]
fx3 = D[f[x1, x2, x3], x3];
Print["This is partial derivative of f[x1, x2, x3] with respect to x3, \!\(TraditionalForm\`∂\\ \(f(x)\)\/∂x\_3\) = ",fx3]

Here are more examples:

Clear[f, x1, x2, x3, fx1, fx2, fx];
f[x1_, x2_, x3_] := 
        3*x1^3*x2^(1/5)*x3^(1/2) - 4*x1 - 5*x2;
f[x1,  x2,  x3]
fx1 = D[f[x1, x2, x3], x1];   fx1
fx2 = D[f[x1, x2, x3], x2];   fx2
fx3 = D[f[x1, x2, x3], x3];   fx3

Clear[f, x1, x2, x3, fx1, fx2, fx];
f[x1_, x2_, 
          x3_] := (3*x1^2*x3^2)/(4*x1^2*Exp[x2^2]);
f[x1,  x2,  x3]
fx1 = D[f[x1, x2, x3], x1];  fx1
fx2 = D[f[x1, x2, x3], x2];  fx2
fx3 = D[f[x1, x2, x3], x3];   fx3

7. Using the Limit Concept to Compute a Derivative

Procedure:

a. Add the vector h with zeros in all but one place to the vector x (h…0) and compute f(x+h).
	b. Compute f(x).
	c. Compute the change in the value function: f(x+h) - f(x).
	d. For h … 0, form the quotient ((f(x + h)  -  f(x))/h).
	e. Simplify the fraction in d as much as possible.  Whenever possible, cancel h from both the numerator and denominator.
	f. Then f´(x) is the number that ((f(x + h)  -  f(x))/h)approaches as h tends to zero.

Example:

Let the function be f(x) = 2 ((Subscript[x, 1])^3)(((Subscript[x, 2])^2)+ 1), and find ∂ ((f(x))/∂)(Subscript[x, 1])
	a. f(x+h) = 2 ((((Subscript[x, 1]) + h))^3)(((Subscript[x, 2])^2)+ 1) = 2 (((Subscript[x, 1])^3) + 3 ((Subscript[x, 1])^2) h + 3  (Subscript[x, 1]) (h^2)  +  
        (h^3)) (((Subscript[x, 2])^2)+ 1).
	b. f(x) = 2 ((Subscript[x, 1])^3)(((Subscript[x, 2])^2)+ 1).
	c. f(x+h) - f(x) =  2 (3 ((Subscript[x, 1])^2) h + 3  (Subscript[x, 1]) (h^2)  + (h^3)) (((Subscript[x, 2])^2)+ 1). 
	d. ((f(x + h)  -  f(x))/h)= (( 2 (3 ((Subscript[x, 1])^2) h + 3  (Subscript[x, 1]) (h^2)  +  (h^3))(((Subscript[x, 2])^2)+ 1))/h).
	e. ((f(x + h)  -  f(x))/h)= (( 2 (3  ((Subscript[x, 1])^2) h + 3  (Subscript[x, 1]) (h^2)  +  (h^3))(((Subscript[x, 2])^2)+ 1))/h) =  2 (3 ((Subscript[x, 1])^2) + 3  (Subscript[x, 1]) h  +  (h^2))(((Subscript[x, 2])^2)+ 1) .
	f.  As h-> 0, the expression goes to 2(3 ((Subscript[x, 1])^2)) (((Subscript[x, 2])^2) + 1) = 6 ((Subscript[x, 1])^2)(((Subscript[x, 2])^2)+ 1)

f[x1_,  x2_]  :=  
      2*x1^3*(x2^2 + 1)
l1 = 
        Limit[((f[x1 + h, x2]  -  f[x1, x2])/h),  
          h ->  
            0];
\(Print[\*""This is Limit[\!\(\(f[x1 + h, x2]\\  - \\ f[x1, x2]\)\/h\), h -> 0] = "", 
      l1]\)
Print["This is partial derivative of
f[x1, x2] with respect to x1, \!\(TraditionalForm\`∂\\ \(f(x)\)\/∂x\_1\) = ", D[f[x1,  x2],  x1]]

8.  Calculating partial derivatives

Idea:

For f((Subscript[x, 1]), (Subscript[x, 2])), we calculate ∂((f(x))/∂)(Subscript[x, 1])by differentiating f with respect to (Subscript[x, 1]) in the usual way while treating (Subscript[x, 2]) as a constant.  Similarly for other partial derivatives.

We can see how a partial derivative is the slope of a tangent line to a curve in (R^2) where we hold one of the variables in the domain of the function constant.  Remember in the section on derivatives of functions of a single variable, we saw that the derivative measured the slope of a tangent line.  See the example below.

Clear[f, x, a, t];
f[x_]  :=  
        (x^3)  +  5 (x^2)  + 3 ; 
Print["This is the function f[x] = ",  
      f[x]] 
Print["This is derivative of the function f[x] using the f'[x] \
form"] 
f'[x]
Print["This is derivative of the function f[x] evaluated at x = \
-4"] 
f'[-4]
\(Print["This is derivative of the function f[x] evaluated at x = a"]\ \)
f'[a]

      
t[x_, a_] := 
        f[a] + f'[a] (x - a);
Print["This is the equation for the tangent line"] 
t[x, a]
Print["This is the equation for the tangent line when a = -4"] 
tangentline =  Expand[t[x, -4]]
\(Print["This is a plot of the function and the tangent at a = -4"]\ \)
Plot[{f[x],  t[x, -4]}, {x, -6,  2},  
      GridLines  ->  {{-4} , {}}, 
      AspectRatio ->  0.8  ]

For the case of a function of two variables, we find the slope of the tangent line along a plane where one of the variables is held constant.

Clear[z,  f,  x,  y]
f[x_,  y_]  :=  
        0.5*(x - 1)*y  -  (x - 1)^2  -  
          y^2;
x0  =  1;  
    y0  =  -0.5;

surface  =  
        Plot3D [ f[x, y],  {x,  0,  2},  {y,  -1,  1},  
          AxesLabel  ->  {"x", "y", "z"}, 
          ViewPoint -> {2.635,  -1.288,  1.540},  
          BoxRatios -> {1, 1, 0.8},  PlotPoints -> 40,  
          DisplayFunction  ->  Identity];

    
plane  =  
        ParametricPlot3D[ {x0,  y,  z},  {y,  -1,  
            1},  {z,  -3,  0.5}, 
          AxesLabel  ->  {"x", "y", "z"}, 
          ViewPoint -> {2.635,  -1.288,  1.540}, 
          BoxRatios -> {1, 1, 0.8},  
          PlotPoints -> 40,    DisplayFunction  ->  
            Identity];
fy  =  
        D[ f[x, y],  y]  /.  {x ->  x0,  
            y ->  y0};

    
tanline  =  
        ParametricPlot3D [ {x0,  y,  f[x0,  y0] + fy*(y - y0),  
            Thickness[0.01]},  {y,  -1.2,  
            1},   DisplayFunction  ->  
            Identity];

    
surfaceline  =  
        ParametricPlot3D[ {x0,  y,  f[x0,  y],  
            Thickness[0.01]}, {y,  -1,  
            1},    DisplayFunction  ->  
            Identity];

    
Print["This is the function f[x,y] = ",  
        f[x, y]]; 
\(\(Print[\*""This is the partial derivative of function f[x,y] with respece to y, \!\(∂\\ f[x, y]\/∂\\ y\) = "", \ 
        D[\ f[x, y], y]\ ];\)\ \)
\(\(Print["This is the partial derivative of function f[x,y] with respece to y at point (", \ x0, " , ", \ 
        y0\ , \*""), \!\(∂\\ f[x, y]\/∂\\ y\) = "", \ D[\ f[x, y], y] /. \ {x\  -> \ x0, \ 
            y -> \ y0}\ ];\)\ \)
Print["This is the equation for the tangent line in the plane where \
we hold x = 1 ."];
 Simplify[ 
      f[x0,  y0] + fy*(y - y0)  ]
 Print["This is a plot of the function and the tangent at point \
(",  x0, " , ",  
        y0 , "), in the plane where we hold x = 1 "];
Show[surface,  plane,  tanline, surfaceline,  
        DisplayFunction  ->  $DisplayFunction,  
        ImageSize  ->  300];

This another example.

Clear[z,  f,  x1,  
      x2]
f[x1_,  
          x2_]  :=  (x1 - 2)*x2  +  x2^2 + 
          Exp[x1*x2];
x10  =  1;  
    x20  =  0.5;
surface  =  
        Plot3D [ f[x1, x2],  {x1,  0.5,  1.5},  {x2,  -2,  4},  
          AxesLabel  ->  {"x1", "x2", "z"}, 
          ViewPoint -> {1,  -1.5,  -0.5},  
          PlotPoints -> 40,  
          DisplayFunction  ->  Identity];
plane = ParametricPlot3D[ {x10, x2, z,SurfaceColor[RGBColor[.1, .8,.7]]}, {x2,  -2,  4}, {z,  -5, 20},AxesLabel  ->  {"x1", "x2", "z"},ViewPoint -> {1,  -1.5,  -0.5},BoxRatios -> {1, 1, 0.8}, PlotPoints -> 40,   DisplayFunction  -> Identity];
Show[surface,  plane,  
        DisplayFunction  -> $DisplayFunction,  
        ImageSize  ->  300];
surfaceline = ParametricPlot3D[ {x10, x2, f[x10,  x2],  {RGBColor[ .3, 0.5, 0.9], Thickness[ .011] }  },{x2,  -2, 4},   DisplayFunction  -> Identity];
fx2  =  
        D[ f[x1, x2],  x2]  /.  {x1 ->  x10,  
            x2 ->  x20};
tanline = ParametricPlot3D [ {x10, x2, f[x10,  x20] + fx2*(x2 - x20), {RGBColor[ .9, 0.2, 0.5], Thickness[ .008] } }, {x2,  -2,  4},  DisplayFunction  ->  Identity];
Print["This is the function f[x1,x2] = ",  f[x1, x2]]; 
\(Print[\*""This is the partial derivative of function f[x1,x2] with respece to x2, \!\(∂\\ f[x1, x2]\/∂\\ x2\) = "", \ D[\ f[x1, x2], x2]\ ];\) 
\(Print["This is the partial derivative of function f[x1,x2] with respect to x2 at point (", \ x10, " , ", \ 
          x20\ , \*""), \!\(∂\\ f[x1, x2]\/∂\\ x2\) = "", \ 
          D[\ f[x1, x2], x2] /. \ {x1\  -> \ x10, \ 
              x2 -> \ x20}\ ];\) 
Print["This is the equation for the \
tangent line in the
plane where we hold x1= 1 ."];
 Simplify[ 
        f[x10,  x20] + fx2*(x2 - x20)  ]
 Print["This is a plot
of the function and the tangent at point (",  x10, " , ",  
          x20 , "), in the plane where we
hold x1 = 1 "];
Show[surface,  plane,  
        tanline, surfaceline,  
        DisplayFunction  ->  $DisplayFunction,  
        ImageSize  ->  300];

Examples:

1.  z = (x^2)y + 8 (x^2)(y^3) + x ln(y)
	∂(z/∂)x  =  
        2 x y  +  16 x (y^3)+ ln(y)
	∂(z/∂)y =	(x^2)+ 24 (x^2)(y^2)+ (x/y)

Clear[x,  y,  z]
z[x_,  y_] :=  
      x^2 y +  8 x^2  y^3  +  x Log[y]
Print["This is the partial derivative of z with respect to x"]
D[z[x, y], x]
Print["This is the
partial derivative of z with respect to y"]
D[z[x, y],  y]

2.  f(x, y, z) = x Sin(y+3z)
	∂(f/∂)x  =  Sin(y + 3  z)
	∂(f/∂)y =	x Cos(y+3z)
	∂(f/∂)z =	3x Cos(y+3z)

Clear[f,  x,  y ,  z]
f[x_, y_,  z_]  :=  x Sin[y +  3  z]
D[f[x, y, z],  x]
D[f[x, y, z], y]
fz = D[f[x, y, z], z]
fz /. {x -> 2, y -> (π/2), 
        z -> (π/3)}
fz /. {x -> 2, y -> (π/2), z -> (π/6)}

3.  f((Subscript[x, 1]), (Subscript[x, 2]), (Subscript[x, 3])) = 50 + 5 (Subscript[x, 1]) + 3 (Subscript[x, 2]) + 2 (Subscript[x, 3]) + 7 ((Subscript[x, 1])^2)+ 2 (Subscript[x, 1])(Subscript[x, 2]) + 3(Subscript[x, 1])(Subscript[x, 3])+ 5 ((Subscript[x, 2])^2)+ 4 (Subscript[x, 2])(Subscript[x, 3])+ 2 ((Subscript[x, 3])^2)
	∂(f/∂)(Subscript[x, 1])  =  
        5  +  14 (Subscript[x, 1]) + 2  (Subscript[x, 2]) + 3 (Subscript[x, 3])
	∂(f/∂)(Subscript[x, 2]) =	3 + 2 (Subscript[x, 1])+ 10 (Subscript[x, 2])+4 (Subscript[x, 3])
	∂(f/∂)(Subscript[x, 3]) =	2 + 3 (Subscript[x, 1])+ 4 (Subscript[x, 2])+4 (Subscript[x, 3])

Clear[x1,  x2,  x3,  f]
f[x1_,  x2_,  x3_]  :=  
      50  +  5 x1  +  3 x2  +  2 x3  +  7 x1^2  + 2 x1 x2 + 
        3 x1 x3  +  5 x2^2  +  4  x2 x3  +  
        2 x3^2
D[f[x1,  x2,  x3],  x1]
(Subscript[f, x1]) = D[f[x1,  x2,  x3],  x2]
D[f[x1,  x2,  x3],  x3]
(Subscript[f, x1]) /. {x1 -> 2, x2 -> 1, x3 -> 4}

9.  Higher order partial derivatives

Second Order Partial Derivatives:

When we differentiate a function f(x, y) twice, we produce its second order derivatives.  These derivatives are usually denoted by

The defining equations are

Notice that the order in which the derivatives are taken, (∂^2) (f/(∂x ∂y)) means differentiate first with respect to y, then with respect to x.
In Mathematica, the command for finding second order partial derivative is:
	D[f, {(Subscript[x, i]), 2}] or D[f, (Subscript[x, 1]), (Subscript[x, 2])]
or you can use \(TraditionalForm\`∂\_\(□, □\)◼\) in the BasicInput palette.

High Order Derivatives:

We can compute higher order partial derivatives just as we computed higher order derivatives by simply differentiating again.
In Mathematica, the basic command for finding high order partial derivative is:
	D[f, {(Subscript[x, i]), n}]
You can use more than one D[f, {(Subscript[x, i]), n}] command to find the high order derivative you need, like using D[ D[f, x], y] to find (∂^2) (f/(∂y ∂x)).

Examples:

Clear[f,  x,  y,  
      z]
f[x_,  y_,  z_]  :=  
      x^3 y^2 Sin[
          z]
Print["This is the function f[x, \
y, z]"]
f[x, y, 
      z]
Print["These are the first partial \
derivatives of f with respect to x, y, and z"]
\(Print[\*""\!\(f\_x\) = "", 
      D[f[x, y, z], 
        x]\ ]\)
\(Print[\*""\!\(f\_y\) = "", 
      D[f[x, y, z], 
        y]\ ]\)
\(Print[\*""\!\(f\_z\) = "", 
      D[f[x, y, z], z]\ ]\)
Print["This is the second partial derivative \!\(TraditionalForm\`∂\^2 f\/\(∂x ∂x\)\\  = \\ ∂\^2 f\/∂x\^2\\ \\ using\\ D[f, \\ {x, \\ 2}]\\ command\)"]
D[
      f[x, y, z],  {x,  2}]
Print["This is the second partial derivative (∂^2) (f/(∂y ∂x)) using D[ D[f,x], y ] command"]
D[ D[f[x, y,  z],  x],  
      y]
Print["This is the second partial derivative (∂^2) (f/(∂x ∂y)) using D[ D[f,y], x ] command"]
D[ D[f[x, y,  z],  y],  
      x]
Print["This is the second partial derivative \!\(TraditionalForm\`∂\^2 f\/\(∂y ∂x\)\\ using\\ D[f, \\ x, \\ y]\\ command\)"]
D[f[x, y, z],  x,  
      y]
Print["This is the third partial derivative \!\(TraditionalForm\`\(\(∂\^3 f\/∂x\^3\)\(\\ \)\)\)"]
D[f[x, y, z],  {x,  3}]

Young's Theorem:

As should be obvious from the examples, \(TraditionalForm\`∂\^2 f\/\(\(\ \)\(∂x ∂y\)\)\) =(∂^2) (f/(∂y ∂x)). This is more generally stated as Young=s theorem:

Hessian Matrices:

The n×n matrix of second order partials of a function is called the Hessian of f.  It is symmetric due to Young=s theorem and looks as follows

(({{(((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, 1]) ∂(Subscript[x, 1]))), (((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, 1]) ∂(Subscript[x, 2]))), ,, ..., ,, (((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, 1]) ∂(Subscript[x, n])))}, {(((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, 2]) ∂(Subscript[x, 1]))), (((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, 2]) ∂(Subscript[x, 2]))), ,, ..., ,, (((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, 2]) ∂(Subscript[x, n])))}, {., ., ,, ..., ,, .}, {., ., ,, ..., ,, .}, {., ., ,, ..., ,, .}, {(((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, n]) ∂(Subscript[x, 1]))), (((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, n]) ∂(Subscript[x, 2]))), ,, ..., ,, (((∂^2) 
                        f ((x^0)))/(∂(Subscript[x, n]) ∂(Subscript[x, n])))}}))

Consider the following example:

Clear[f, c,  x1, x2];
 a0  =  0;  a1 = -200; a2 = -20; b11 = 40; 
      b12 = 200; b22 = 20; c11 = -2; c22 = -1; 
f[x1_, x2_] := 
        a0 + a1*x1 + a2*x2 + b11*x1^2 + b12*x1*x2 + b22*x2^2 + c11*x1^3 + 
          c22*x2^3;
Print["This is the
function"]
f[x1, x2]
 f1 = D[f[x1, x2], x1];
 f2 = D[f[x1, x2], x2];
 f11  =  (∂_(x1, x1))f[x1, x2];
 f12  =  (∂_(x1, x2))f[x1, x2];
 f21 =  (∂_(x2, x1))f[x1, 
              x2];
 f22 =  (∂_(x2, x2))f[x1, 
              x2];
Print["These are the first
partial derivatives"]
Grad2=(({{f1}, {f2}}));
Grad2 // 
      MatrixForm
Print["These are the second \
partial derivatives"]
Hessian2=(({{f11, f12}, {f21, f22}}));
Hessian2 // MatrixForm

Print["This is a \
3-dimensional graph of the function"]
\(Plot3D[
          f[x1, x2], {x1, 0, 70}, {x2, 0, 
            75}, 	\ ViewPoint -> {\(-4\), \(-12\), 
              4}, 
ColorFunction -> Hue, 
          AxesLabel -> {" x1", "   
x2", "   y"}, Boxed -> False, PlotPoints -> 25, 
          TextStyle -> {FontColor -> RGBColor[ .9,  .8,  .7]\ , \ 
              FontWeight -> "Bold", FontFamily -> "Times", 
              FontSize -> 12}, 
Ticks -> {{0, 10, 
                20, 30, 40, 50, 60, \ 70, 75}, {0, 15, 30, 45, 60, 75}, {0, 
                100000, 200000, 300000}}, 
\ 
          Background -> RGBColor[ .5,  .5, 1], 
          AxesStyle -> {RGBColor[ .8,  .8,  .7], 
              Thickness[0.005]}\ \ ];\)

\(surface1\  = \ 
          Plot3D[f[x1, x2], {x1, 0, 70}, {x2, 0, 
              85}, 	\ ViewPoint -> {\(-4\), \(-12\), 
                4}, 
ColorFunction -> Hue, 
            AxesLabel -> {" x1", "    x2", "   y"}, 
            Boxed -> False, PlotPoints -> 25, 
            TextStyle -> {FontColor -> RGBColor[ .9,  .8,  .7]\ , \ 
                FontWeight -> "Bold", 
                FontFamily -> "Times", 
                FontSize -> 12}, 
Ticks -> {{0, 
                  10, 20, 30, 40, 50, 60, \ 70, 75}, {0, 15, 30, 45, 60, 
                  75}, {0, 100000, 200000, 300000}}, 
\ 
            Background -> RGBColor[ .5,  .5, 1], 
            AxesStyle -> {RGBColor[ .8,  .8,  .7], Thickness[0.005]}, \ 
            DisplayFunction\  -> Identity];\)

level1 = 
        100000;
plane1 =  
        Plot3D[level1, {x1, 15, 70}, {x2, 15, 85}, 
          ColorFunction -> Hue,  
          DisplayFunction  -> 
            Identity];
Print["This is a \
3-dimensional graph of the function with a
plane defining a level set at height 100,000"]
Show[surface1, plane1,  
          AxesLabel -> {"x1", "x2", "y"},  
          DisplayFunction  -> $DisplayFunction];

Print["This is a \
contour plot showing the level set at
height 100,000"];
\(ContourPlot[
          f[x1, x2], {x1, 0, 10}, {x2, 0, 10}, \ \ Contours -> {2000}, 	
          
          FrameLabel -> {"x1", " x2"}, 
		\ \ \ \ ColorFunction -> Hue, \ 
          TextStyle -> {FontColor -> RGBColor[ .9,  .8,  .7]\ , \ 
              FontWeight -> "Bold", FontFamily -> "Times", 
              FontSize -> 
                22}, 
\ \ \ Background -> 
            RGBColor[ .5,  .5, 1], \ 
          AxesStyle -> {RGBColor[ .8,  .8,  .7], Thickness[0.05]}, \ 
          PlotPoints -> 25\ , ContourStyle -> Thickness[0.015]\ \ ];\)

Print["This is a \
more general contour
plot (set of level sets)"];
\(ContourPlot[
          f[x1, x2], {x1, 0, 70}, {x2, 0, 
            80}, \ \ Contours -> {2000, 5000, 10000, 20000, 40000, 80000, 
              120000, 180000, 240000, 300000}, 	
          FrameLabel -> {"x1", " x2"}, 
		\ \ \ \ \ ColorFunction -> Hue, \ 
          TextStyle -> {FontColor -> RGBColor[ .9,  .8,  .7]\ , \ 
              FontWeight -> "Bold", FontFamily -> "Times", 
              FontSize -> 
                22}, 
\ \ \ Background -> 
            RGBColor[ .5,  .5, 1], \ 
          AxesStyle -> {RGBColor[ .8,  .8,  .7], Thickness[0.05]}, \ 
          PlotPoints -> 25\ , ContourStyle -> Thickness[0.005]\ \ ];\)

Print["This is a \
contour plot showing three level sets"];
\(ContourPlot[
        f[x1, x2], {x1, 0, 10}, {x2, 0, 
          10}, \ \ Contours -> {2000, 5000, \ 10000}, 	
        FrameLabel -> {"x1", " x2"}, 
		\ \ \ \ \ ColorFunction -> Hue, \ 
        TextStyle -> {FontColor -> RGBColor[ .9,  .8,  .7]\ , \ 
            FontWeight -> "Bold", FontFamily -> "Times", 
            FontSize -> 22}, 
\ \ \ Background -> 
          RGBColor[ .5,  .5, 1], \ 
        AxesStyle -> {RGBColor[ .8,  .8,  .7], Thickness[0.05]}, \ 
        PlotPoints -> 25\ , 
        ContourStyle -> Thickness[0.015]\ \ ];\)

10.  Multiple Low/High Points Examples

Here are some examples which involve functions with multiple low or high points.

Clear[f, x, y,  surface,  plane,  c];
f[x_, y_] := (x^2 y^2) E^(-x^2 - y^2);
surface  =  
        Plot3D[ f[x, y], {x, -5, 5}, {y, -5, 5}, 
          PlotPoints -> 50, 
          PlotRange  ->  {0, 0.14},   ColorFunction -> Hue,  
          DisplayFunction -> Identity];
c  = 0;
plane  =  
        Plot3D[c, {x, -5, 5}, {y, -5, 5}, 
          PlotPoints -> 50,   DisplayFunction -> 
            Identity];
Print["This
shows the graph of the function f[x, y] = ",  f[x, y]]
\(\(\(Show[surface, plane, AxesLabel -> {"x", "y", "f(x,y)"}, 
        ViewPoint -> {2.234, \ \(-1.698\), \ 
            1.540}, 
		DisplayFunction -> $DisplayFunction, \ 
        ImageSize -> \ 400];\)\(
\)
    \)\)
Print["This shows the contour lines formed at a
set of heights"];
c  =  {10^(-6), 10^(-5), 10^(-4), 
          10^(-3), 10^(-2), 0.05,  0.06,  0.07,   0.08,  
          0.09 };
\(\(ContourPlot[f[x, y], {x, \(-5\), 5}, {y, \(-5\), 5}, \ 
        Contours -> \ c, 
	Frame -> False, Axes -> \ True, 
        AxesLabel -> {"x", "y"}, ColorFunction -> Hue, \ 
        ImageSize -> \ 300\ ];\)\)

Clear[f, x, y,  surface,  plane, c];
f[x_, y_] :=  - x y /E^(x^2  +  y^2);
surface  =  
        Plot3D[  f[x, y], {x, -2, 2}, {y, -2, 2}, 
          PlotPoints -> 50, PlotRange  -> {-0.2,  0.2},  
          ColorFunction -> Hue,   DisplayFunction -> 
            Identity];
Print["This shows the graph of the function
f[x, y] = ",  f[x, y]]
\(\(\(Show[surface, AxesLabel -> {"x", "y", "f(x,y)"}, 
        ViewPoint -> {2.234, \ \(-1.698\), \ 
            1.540}, 
		DisplayFunction -> $DisplayFunction, \ 
        ImageSize -> \ 400];\)\(
\)
    \)\)
Print["This shows the contour
lines formed at a set of heights"];
c  =  {-0.18,  -0.14, -0.1,  -0.06,  - 
            0.02,  0.02,  0.06,  0.1,  0.14,  0.18 };
\(\(ContourPlot[f[x, y], {x, \(-2\), 2}, {y, \(-2\), 2}, \ 
        Contours -> \ c, 
	Frame -> False, Axes -> \ True, 
        AxesLabel -> {"x", "y"}, ColorFunction -> Hue, \ 
        ImageSize -> \ 300];\)\)

Clear[f, x, y,  surface,  plane,  c];
f[x_, y_] :=  Sin[x] Sin[y];
surface  =  
        Plot3D[  f[x, y], {x, 0, 10}, {y, 0, 10}, PlotPoints -> 50, 
          PlotRange ->  {-1,  1},   ColorFunction -> Hue,  
          DisplayFunction -> Identity];
Print["This shows the graph of the function f[x,
y] = ",  f[x, y]]
\(\(\(Show[surface, AxesLabel -> {"x", "y", "f(x,y)"}, 
        ViewPoint -> {2.234, \ \(-1.698\), \ 
            1.540}, 
		DisplayFunction -> $DisplayFunction, \ 
        ImageSize -> \ 400];\)\(
\)
    \)\)
Print["This shows the contour
lines formed at a set of heights"];
c  =  {-0.8,  -0.6, -0.4,  -0.2,  0,  0.2,  
          0.4,   0.6, 0.8,  1 };
\(\(ContourPlot[f[x, y], {x, 0, 10}, {y, 0, 10}, \ Contours -> \ c, 
	
        Frame -> False, Axes -> \ True, AxesLabel -> {"x", "y"}, 
        ColorFunction -> Hue, \ 
        ImageSize -> \ 300\ ];\)\)

11.  More Examples

Here are more examples for multivariate calculus.

Clear[f, x1, x2, x3, f1, f2, f3];
y = 3*x1^{0.5}*x2^{0.2}*x3^{0.1}
f1 = (∂_x1) y
f2 = (∂_x2) y
f3 = (∂_x3) y

Clear[f, x1, x2, x3, f1, f2, f3];
y=(2*x1^2*x2^3)/(4*x1^2*x2)
f1 = (∂_x1) 
        y
f2 = (∂_x2) y
f3 = (∂_x3) 
        y

Clear[f, x1, x2, x3, f1, f2, f3];
y=10*x1^{0.2}*x2^{0.2}*x3^{0.4} - 2*x1 - 3  x2 - 2  x3
f1 = (∂_x1) 
        y
f2 = (∂_x2y)
f3 = (∂_x3) 
        y

Clear[f, x1, x2, x3, f1, f2, f3];
y=(3*x1^2*x2*x3^3)/(5*x1^3*Log[(x2)^2])
f1 = (∂_x1) 
        y
f2 = (∂_x2) y
Simplify[
      f2]
f3 = (∂_x3) y

Clear[f, x1, x2];
f[x1_, x2_] := 16*x1 + 12*x2 - x1^2 - x2^2;
f[x1, x2]
f1 = (∂_x1) f[x1, x2]
f2 = (∂_x2f)[x1, x2]
\(\(Plot3D[f[x1, x2], {x1, 0, 20}, {x2, 0, 16}, 
	
        AxesLabel -> {"x1", "x2", "f(x1,x2)"}];\)\)
ContourPlot[f[x1, x2], {x1, 0, 20}, {x2, 0, 20}];

Clear[f, x1, x2];
f[x1_, x2_] := 
        100*x1 + 76*x2 - 4*x1^2 - 2*x2^2;
f[x1, x2]
f1 = (∂_x1) f[x1, x2]
f2 = (∂_x2) f[x1, x2]
\(\(Plot3D[f[x1, x2], {x1, 0, 30}, {x2, 0, 30}, 
	
        AxesLabel -> {"x1", "x2", "f(x1,x2)"}];\)\)
ContourPlot[f[x1, x2], {x1, 0, 25}, {x2, 0, 25}];

Clear[f, x1, x2];
f[x_, y_] := 50*x1^(1/2)*x2^(1/5) - 2*x1 - 3*x2;
f[x1, x2]
f1 = (∂_x1) f[x1, x2]
f2 = (∂_x2) f[x1, x2]
Plot3D[f[x1, x2], {x1, 0, 100}, {x2, 0, 100}, 
        AxesLabel -> {"x1", "x2", "f(x1,x2)"}];
ContourPlot[f[x1, x2], {x1, 10, 40}, {x2, 10, 60}];

Clear[u, q1, q2];
α = 100;  β = 2;   γ = 1; δ = 
      1;
u[q1_, 
          q2_] := α*q1  - (β*q1^2)/2 + γ*
            q2 + δ*(q2^2)/2;
Plot3D[u[q1, q2], {q2, 0, 100}, {q1, 1, 100}, 
        AxesLabel -> {"q1", "q2", "u(q1,q2)"}];
ContourPlot[u[q1, q2], {q2, 0, 100}, {q1, 0, 60}, 
        AxesLabel -> {"q1", "q2"},  
        ColorFunction -> Hue];
Print["This is the partial derivative with respect to
q1"]
 uq1 = D[u[q1, q2], q1]
Print["This is the
partial derivative with respect to q1"]
 uq2 = D[u[q1, q2], q2]
Print["This is the second partial derivative with
respect to q1"]
uq1q1  =  (∂_(x1, x1))u[x1, x2]
Print["This is the second partial derivative with
respect to q1 and q2"]
uq1q2  =  (∂_(q1, q2))u[q1, q2]
Print["This is the second partial derivative with
respect to q2"]
uq2q2  =  (∂_(q2, q2))u[q1, q2]

Clear[u, A, q1, q2];
A = 3; 
u[q1_, q2_] := A*Log[q2] + (q1^2)/2;
Plot3D[u[q1, q2], {q2, 1, 10}, {q1, 1, 10}, 
        AxesLabel -> {"q1", "q2", "u(q1,q2)"}];
ContourPlot[u[q1, q2], {q2, 1, 10}, {q1, 1, 10}, 
        AxesLabel -> {"q1", "q2"},   ColorFunction -> 
          Hue];
Print["This
is the partial derivative with respect to q1"]
 uq1 = D[u[q1, q2], q1]
Print["This is the partial derivative with
respect to q2"]
 uq2 = D[u[q1, q2], q2]
Print["This is the
second partial derivative with respect to q1"]
 uq1q1  = (∂_(x1, x1))u[x1, x2]
Print["This is the
second partial derivative with respect to q1 and q2"]
 uq1q2  = (∂_(q1, q2))u[q1, q2]
Print["This is the
second partial derivative with respect to q2"]
 uq2q2  = (∂_(q2, q2))u[q1, q2]

Clear[u, q1, q2];
Clear[β1, γ1, β2, γ2  ];
u[q1_, 
          q2_] :=    (q1 - γ1)^β1*(q2 - γ2)^β2;
Print["This is the function"];
u[q1, q2]
 uq1 = D[u[q1, q2], q1];;
 uq2 = D[u[q1, q2], q2];
 uq1q1  =  (∂_(q1, q1))u[q1, q2];
 uq1q2  =  (∂_(q1, q2))u[q1, q2];
 uq2q2  = (∂_(q2, q2))u[q1, q2];
\(\(Print[\*""This is the partial derivative with respect to q1,  (∂_q1) u = "", uq1\ \ ];\)\)
\(\(Print[\*""This is the partial derivative with respect to q2,  (∂_q2) u = "", uq2\ \ ];\)\)
\(\(Print[\*""This is the second partial derivative with respect to q1,  (∂_(q1, q1))u = "", 
        uq1q1\ \ ];\)\)
\(\(Print[\*""This is the second partial derivative with respect to q1 and q2,  (∂_(q1, q2))u = "", 
        uq1q2\ \ ];\)\)
\(\(\(Print[\*""This is the second partial derivative with respect to q2,  (∂_(q2, q2))u = "", 
        uq2q2\ \ ];\)\(
\)
    \)\)
β1 = 0.6;  γ1 = -4;  β2 = 
      0.4;   γ2 = -2; 

\(\(\(Plot3D[
        u[q1, q2], {q1, 0, 20}, {q2, 0, 
          25}, 	\ ViewPoint -> {\(-4\), \(-12\), 
            4}, 
ColorFunction -> Hue, 
        AxesLabel -> {" q1", "    q2", "  
u"}, Boxed -> False, \ PlotPoints -> 25, 
        TextStyle -> {FontColor -> RGBColor[ .9,  .8,  .7]\ , \ 
            FontWeight -> "Bold", FontFamily -> "Times", 
            FontSize -> 12}, 
Ticks -> {{0, 4, 8, 
              12, 16, 20}, {0, 5, 10, 15, 20, 25}, {0, 5, 10, 15, 
              20}}, 
\ 
        Background -> RGBColor[ .5,  .5, 1], 
        AxesStyle -> {RGBColor[ .8,  .8,  .7], 
            Thickness[0.005]}\ \ ];\)\(
\)
    \)\)
\(\(surface1\  = \ 
        Plot3D[u[q1, q2], {q1, 0, 20}, {q2, 0, 
            25}, 	\ ViewPoint -> {\(-4\), \(-12\), 
              4}, 
ColorFunction -> Hue, 
          AxesLabel -> {" q1", "    q2", "   u"}, 
          Boxed -> False, \ PlotPoints -> 25, 
          TextStyle -> {FontColor -> RGBColor[ .9,  .8,  .7]\ , \ 
              FontWeight -> "Bold", FontFamily -> "Times", 
              FontSize -> 12}, 
Ticks -> {{0, 4, 
                8, 12, 16, 20, 25}, {0, 5, 10, 15, 20, 25, 30}, {0, 5, 10, 
                15, 20}}, 
\ 
          Background -> RGBColor[ .5,  .5, 1], 
          AxesStyle -> {RGBColor[ .8,  .8,  .7], Thickness[0.005]}\ , \ 
          DisplayFunction\  -> Identity];\)\)
level1 = 15;
plane1 =  
        Plot3D[level1, {q1, 3, 22}, {q2, 3, 26},  
          DisplayFunction  -> Identity];
Show[surface1, plane1,  
        AxesLabel -> {"q1", "q2", "u"},  
        DisplayFunction  -> $DisplayFunction];
ContourPlot[u[q1, q2], {q2, 0, 20}, {q1, 0, 25}, 
        AxesLabel -> {"q1", "q2"},   ColorFunction -> 
          Hue];