Curves and Surfaces in (ℝ^3): Extrema

Practice Problems relating to curves and surfaces. Solutions are provided.

Problem 1

Use a sketch in 3D or a contour plot to estimate the location of any local maximum and minimum values of the function

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

Then use calculus to find the location and value of extrema exactly.

Your Solution

Barry's Solution

Plot3D[f[x,y],{x,-10,10},{y,-10,10}]

It is hard to see anything from the sketch. Let's try a contour plot instead:

ContourPlot[f[x,y],{x,-2,2},{y,-1,3},Contours->14]

Note that I played around a bit with the x and y ranges until I got the above sketch.

It looks like there is a local max around (0,0) and a local min around (0,2).

To find these values exactly, we must find the points where the first partial derivatives are zero:

eq1=D[f[x,y],x]==0
eq2=D[f[x,y],y]==0

Now, we solve these equations for (x,y) pairs:

Solve[{eq1,eq2},{x,y}]

Here, we get a bunch of points. One corresponds to the local max, one to the local min, and the other two are saddle points where the tangent plane is horizontal but we don't get an extrema.

Now that we have some idea of what is going on, a 3D plot can really help us see what is happening:

Plot3D[f[x,y],{x,-2,2},{y,-1,3},PlotRange->{-2,2}]

The extrema and saddle points are readily apparent from this sketch.

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

These are the values of the local max and local min.

Problem 2

Use a sketch in 3D or a contour plot to estimate the location of any local maximum and minimum values of the function

f[x_,y_]=2x^4 y^2 -20x^2-2y^2+x+2

Then use calculus to find the location and value of extrema exactly.

Your Solution

Barry's Solution

Plot3D[f[x,y],{x,-10,10},{y,-10,10}]

It is hard to see anything from the sketch. Let's try a contour plot instead:

ContourPlot[f[x,y],{x,-2,2},{y,-2,2},Contours->14]

Note that I played around a bit with the x and y ranges until I got the above sketch.

It looks like there is a local max around (0,0).

To find these values exactly, we must find the points where the first partial derivatives are zero:

eq1=D[f[x,y],x]==0
eq2=D[f[x,y],y]==0

Now, we solve these equations for (x,y) pairs:

Solve[{eq1,eq2},{x,y}]

Since it is hard to tell where the fractions lie, let's use decimals to help us eliminate some possibilities.

NSolve[{eq1,eq2},{x,y}]

Here, we get a bunch of points. We are only interested in the real valued ones. One corresponds to the local max, which is at (1/40,0). The points (±1,±2.26385) all correspond to saddle points (where there is a horizontal tangent plane but there is no extrema).

Now that we have some idea of what is going on, a 3D plot can really help us see what is happening:

Plot3D[f[x,y],{x,-3,3},{y,-3,3},PlotRange->{-25,10},PlotPoints->40]

The extrema and saddle points are readily apparent from this sketch. Note that the surface is truncated (the flat parts) where it goes beyond the range I have requested.

f[1/40,0]

The value of the local max is 161/80.

Problem 3

Use a sketch in 3D or a contour plot to estimate the location of the local maximum and minimum values of the function

f[x_,y_]=Sin[x ]/(1+x^2+y^2)

Then use calculus to determine which equations you would have to solve to determine the points exactly.

Your Solution

Barry's Solution

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

Although we can see a max and min in the above, the contour plot is easier to read. Let's try a contour plot instead:

ContourPlot[f[x,y],{x,-2,2},{y,-3,3},Contours->16,PlotPoints->60]

Note that I played around a bit with the x and y ranges until I got the above sketch.

It looks like there is a local max around (0.75,0) and a local min around (-0.75,0).

To find these values exactly, we must find the points where the first partial derivatives are zero:

eq1=D[f[x,y],x]==0
eq2=D[f[x,y],y]==0

These are the equations we would like to solve. Mathematica has difficulty solving them:

Solve[{eq1,eq2},{x,y}]

Problem 4

Find the point on the plane 4x-2y+z=1 that is closest to the point (-2,-1,5).

Your Solution

Barry's Solution

First, we need to know what we are minimizing. We are minimizing a distance, so we can also minimize the distance squared (since minimizing the distance squared will also minimimize the distance). Here is the plane:

f[x_,y_]=1-4x+2y

distancesq=(-2-x)^2+(-1-y)^2+(5-f[x,y])^2

To find the minimum, we must find the points where the first partial derivatives are zero:

eq1=D[distancesq,x]==0
eq2=D[distancesq,y]==0

Now, we solve these equations for (x,y) pairs:

Solve[{eq1,eq2},{x,y}]

Here, we only get one point! So we should create a 3D plot or contour plot to verify we have found a minimum:

ContourPlot[distancesq,{x,-3,0},{y,-6,3}]

It is difficult to guess accurately the point where the minimum occurs from the contour plot, but we can definitely see there is a minimum around (-2,-1). Remember that darker shading means lower value in Mathematica's contour plots.

A Plot3D shows the minimum clearly:

Plot3D[distancesq,{x,-3,0},{y,-6,0}]

Problem 5

Find the dimensions of a box with an open top which has surface area of 32000 (cm^2) which maximizes the volume of the box.

Your Solution

Barry's Solution

We are maximizing the volume, so we need to work out the volume of the box. Let's let the box have length x, height z, and width y.

You can easily draw a sketch by hand; I am using Mathematica to draw my sketch, so it is a bit more work!

<<"PolyhedronOperations`"

Show[Graphics3D[Cuboid[{0,0,0},{3,2,2}]],AxesLabel->{"x","y","z"},Axes->True,Ticks->False]

vol=x*y*z

We need to eliminate one of the variables using surface area= 32000 = 2x z + 2 z y + x y :

Solve[32000==2x z + 2 z y + x y,z]

vol=x*y*(32000- x y)/(2(x+y))

Now volume is a function of x and y.

To find the minimum, we must find the points where the first partial derivatives are zero:

eq1=D[vol,x]==0
eq2=D[vol,y]==0

Now, we solve these equations for (x,y) pairs:

Solve[{eq1,eq2},{x,y}]

Physically, we cannot have a negative length, so we discard one solution, and are left with x=y=80(Sqrt[5/3]).

Note that I avoid z=y=0to avoid the unphysical situation with zero volume, and mathematically to avoid division by zero. Either of the following plots convinces us we have found a maximum.

Plot3D[vol,{x,5,220},{y,5,220}]
ContourPlot[vol,{x,5,220},{y,5,220}]

The dimensions that maximize the volume of the box with surface area 32000 (cm^2) are

x =y = 80(Sqrt[5/3])
z = ((32000-x y)/(2 (x+y)))= 40(Sqrt[5/3])

I had Mathematica do the algebra for me:

((32000-80(Sqrt[5/3])80(Sqrt[5/3]))/(2(80(Sqrt[5/3])+80(Sqrt[5/3]))))

The volume of the box is (in (cm^3)):

vol= 80(Sqrt[5/3])* 80(Sqrt[5/3]) *40(Sqrt[5/3])

N[vol]

Problem 6

The base of an aquarium with a given volume V is made of slate and the sides are made of glass. If slate costs five times as much as glass, find the dimensions of the aquarium that minimize the cost of the materials.

Your Solution

Barry's Solution

We are minimizing a cost, so we need to work out the cost of the aquarium. Let's let c be the cost of glass per square foot. Then slate will cost 5c per square foot. The cost of the aquarium will be the cost of the materials used to make the sides, and some incidental costs for glue and other materials which we will ignore.Let's let the aquarium have length x, height z, and width y.

You can easily draw a sketch by hand; I am using Mathematica to draw my sketch, so it is a bit more work!

<<"PolyhedronOperations`"

Show[Graphics3D[Cuboid[{0,0,0},{3,2,2}]],AxesLabel->{"x","y","z"},Axes->True,Ticks->False]

cost=c*(2x*z+2z*y)+5c*(y*x)

We need to eliminate one of the variables using V=x y z:

cost=c*(2(V/(y z))*z+2z*y)+5c*(y*(V/(y z)))

Now cost is a function of y and z.

To find the minimum, we must find the points where the first partial derivatives are zero:

eq1=D[cost,y]==0
eq2=D[cost,z]==0

Now, we solve these equations for (x,y) pairs:

Solve[{eq1,eq2},{y,z}]

Ugly! Scary! That's OK, when things look weird, try converting to decimals to see what happens:

NSolve[{eq1,eq2},{y,z}]

Notice that some of the solutions are complex valued (that's what the i=(Sqrt[-1])means), so we search for any real valued solutions. There is only one,

y->0.7368062997280773` (V^(1/3)),z->1.8420157493201932` (V^(1/3))

Here, we only get one point! So we should create a 3D plot or contour plot to verify we have found a minimum, only we would need to know the values of V and c before we could do that. Let's make V=c=1, and get a plot:

cost=c*(2(V/(y z))*z+2z*y)+5c*(y*(V/(y z)))/.{V->1,c->1}

Note that I avoid z=y=0 to avoid the unphysical situation with zero volume, and mathematically to avoid division by zero.

ContourPlot[cost,{y,0.1,2},{z,0.1,3}]

It is difficult to guess accurately the point where the minimum occurs from the contour plot, but we can definitely see there is a minimum around (1,1.5). Remember that darker shading means lower value in Mathematica's contour plots.

A Plot3D shows the minimum clearly:

Plot3D[cost,{y,0.1,2},{z,0.1,3}]

The dimensions of the aquarium that minimize the cost are

x =(V/(y z)) = (V/(1.35721 (((V))^(2/3))))=0.7368056527729681` (((V))^(1/3))
y=0.736806 (V^(1/3))=0.7368056527729681` (((V))^(1/3))
z=1.84202 (V^(1/3))=1.84202(((V))^(1/3))

If you want exact results, you could go back and work with the cube roots you had found when you solved the equations earlier.