Extrema

Problem 1

Here is an equation for a surface, for which we want to determine the maximum. The surface in this case is defined over a restricted domain:

z=f(x,y)=x+y+2, -2≤x≤2 and -3≤y≤3

f[x_,y_]=x+y+2

The maximum of the surface will occur where the tangent plane is horizontal, which means we must solve

((∂z)/(∂x))=0
((∂z)/(∂y))=0

for (x,y).

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

What happened? Well, the surface z=f(x,y) is just a plane (linear in both x and y), so there are no points where the tangent plane is horizontal. This means the extrema occur on the boundary. A contour plot can show us this.

plot1=ContourPlot[f[x,y],{x,-2,2},{y,-3,3}]

L:ight color is higher value in mathematica, so from the contour plot it looks like the maximum is at (2,3) and the minimum is at (-2,-3). If you hover the mouse over the contour lines, Mathematica will tell you what the z value is on that line, so if you forget the lighter/higher bit, you could figure it out.

f[-2,-3]
f[2,3]

Let's get a plot of the surface to check our answer.

plot2=Plot3D[f[x,y],{x,-2,2},{y,-3,3}]

We've got it.

In Calculus III, you will also learn about an interesting object called the gradient. which is a vector that points in the direction of greatest increase at any point on the surface. Since partial derivatives are giving you the rates of change, it shouldn't be surprising that the gradient is given by
⟨((∂z)/(∂x)),((∂z)/(∂y))⟩
where the angles brackets are the typical notation for vector in mathematics. In Mathematica, this is given by

gradient={D[f[x,y],x],D[f[x,y],y]}

Here is a plot of the gradient for this surface. The length of the arrows represents the relative size of the slope of the tangent plane (longer arrows, greater slope).

plot3=VectorPlot[gradient,{x,-2,2},{y,-3,3}]

If we overlay the gradient on the contour plot, we can see that the arrows are perpendicular to the contour lines (but to really see that we have to make sure the aspect ratio in the plot is set correctly!).

Show[plot1,plot3,AspectRatio->6/4]

Gradients are very important in geology and electromagnetism.

Geology: If z=f(x,y) represents the physical topology of the earth, the the negative of the gradient would represent the direction water would flow on the surface.

Electromagnetism: The gradient is used in Maxwell's equations to describe the relationship between electric and magentic fields.

Calculus III holds many other wonders, such as divergence, curl, Laplacian, Green's Thorem, Stokes theorem, and more! But that can wait until Calculus III.

The Gradient will not be on the final!

Problem 3

f[x_,y_]=2x^2+3y^2

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

plot1=ContourPlot[f[x,y],{x,-2,2},{y,-3,3}]

f[0,0]
f[2,3]

plot2=Plot3D[f[x,y],{x,-2,2},{y,-3,3}]

gradient={D[f[x,y],x],D[f[x,y],y]}

plot3=VectorPlot[gradient,{x,-2,2},{y,-3,3}]

Show[plot1,plot3,AspectRatio->6/4]

Problem 3

f[x_,y_]=3^2x^2-2^2y^2

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

plot1=ContourPlot[f[x,y],{x,-2,2},{y,-3,3}]

f[0,0]
f[0,3]

plot2=Plot3D[f[x,y],{x,-2,2},{y,-3,3}]

gradient={D[f[x,y],x],D[f[x,y],y]}

plot3=VectorPlot[gradient,{x,-2,2},{y,-3,3}]

Show[plot1,plot3,AspectRatio->6/4]