We know how to find the high and low points of a two-variable function f(x,y). Now we want to maximize or minimize real-world quantities like distance, area, or volume that start with three variables tied together by a constraint equation.
Eliminating a Variable with a Constraint
1
Closest Point on a Plane to the Origin
We want to find the point (x,y,z) on the tilted plane z=6−2x−y that is as close as possible to the origin (0,0,0).
Closest Point on a Plane to the Origin
x
y
z
(x,y,z)
z=6−2x−y
(0,0,0)
d
Text solution
Eliminate z in the squared distanceSince minimizing the distance d=x2+y2+z2 happens at the exact same point as minimizing its square, we drop the square root and use the plane equation z=6−2x−y to replace z so only x and y remain.
SS(x,y)=x2+y2+z2=x2+y2+(6−2x−y)2
Set both partial derivatives to zeroWe take the derivatives with respect to x and y using the chain rule on (6−2x−y)2, then set both slopes to zero to find where the surface is flat in both directions.
Solve for the critical pointSubtracting 2x+2y=6 from 5x+2y=12 cancels 2y right away, giving the single critical point (2,1) in the xy-plane.
(5x+2y)−(2x+2y)=12−63x=6⟹x=22(2)+2y=6⟹y=1
Confirm the absolute minimum with the Second Derivative TestWe check the discriminant D=SxxSyy−(Sxy)2 to verify that the surface curves upward rather than forming a saddle or maximum.
Find the height z on the planeBecause the second derivatives are constant, the surface curves upward everywhere and grows toward infinity in every direction, so (2,1) gives the absolute minimum. Plugging (2,1) back into z=6−2x−y gives the closest point on the plane, (2,1,1).
z=6−2(2)−1=1⟹(x,y,z)=(2,1,1)
For every choice of (x,y), the plane fixes the height z=6−2x−y, and squaring the distance stretches the surface vertically into a smooth bowl without moving the lowest spot from (2,1).
Every spot on the floor fixes the height on the plane, and squaring the distance from the origin stretches the surface into a steeper bowl without moving its lowest spot.
2
Minimizing the Surface Area of an Open-Top Box
Now let's take a design problem where the constraint multiplies the variables together and the dimensions must be positive. We want to find the width x, length y, and height z of an open-top rectangular box that holds 32 ft3 of volume while using the least possible area of cardboard.
x
y
z
xyz=32
xy
xz
xz
yz
yz
x
z
y
Minimizing the Surface Area of an Open-Top Box
32 ft3
x
y
z
Text solution
Eliminate z using the volume constraintAdding the areas of the bottom panel xy and the four side walls 2xz and 2yz gives the total surface area. Solving the volume equation xyz=32 for z turns the area into a function of x and y for x>0,y>0.
Set both partial derivatives to zero and clear fractionsWriting x64=64x−1 and y64=64y−1 lets us differentiate with the power rule, and multiplying through by x2 and y2 clears the denominators.
AxAy=y−x264=0⟹x2y=64=x−y264=0⟹xy2=64
Use symmetry to solve for the critical pointSince x2y and xy2 both equal 64 and the box dimensions satisfy x>0 and y>0, we can set them equal and divide by xy to see that the base must be a square.
x2yx3=xy2⟹x=y=64⟹x=4,y=4
Confirm the absolute minimum with the Second Derivative TestEvaluating the second derivatives at (4,4) shows the surface curves upward at its single critical point, and since A(x,y)→∞ whenever x or y approaches 0+ or ∞, this local minimum is the absolute minimum for x>0,y>0.
Find the height z from the constraintSubstituting x=4 and y=4 back into z=xy32 gives a height of 2 ft, so the box that uses the least cardboard has dimensions 4 ft×4 ft×2 ft.
z=4⋅432=2
With the volume locked at 32 ft3, stretching the base wide makes the bottom panel xy grow toward infinity, while squeezing either side toward zero forces tall walls x64 and y64 whose areas also grow toward infinity, leaving a single lowest spot on the area surface at (4,4).
With the volume fixed, wide trays and tall towers both waste cardboard, leaving one sweet spot in between that uses the least.
3
When Substitution Works and What Comes Next
Both problems worked the same way because we could solve for z cleanly, which raises the question of what we do when the constraint equation mixes x,y, and z together so we can't solve for one variable.
When Substitution Works and What Comes Next
x
y
z
z=6−2x−y
xyz=32
Summary
When an optimization problem gives you three variables tied together by a constraint equation, use the constraint to eliminate one variable first:
Linear constraint
(like z=6−2x−y): substitute 6−2x−y for z directly into the formula you are optimizing.
Product constraint
(like xyz=32 on x>0,y>0): divide to get z=xy32, substitute, and cancel before taking derivatives.
Distance from the origin
minimize the squared distance S=x2+y2+z2 instead of d=x2+y2+z2 so you don't differentiate a square root; if a problem asks for the minimum distance itself, take S at the very end.
Confirming the absolute minimum or maximum
solve fx=0 and fy=0, then check D=fxxfyy−(fxy)2>0 (fxx>0 for a minimum, fxx<0 for a maximum) together with what the function does at the edges of the domain.
When not to solve for z
if the formula you are optimizing already has the exact term from the constraint (such as substituting z2=xy+4 directly into S=x2+y2+z2), replace z2 in one piece without taking a square root; if the constraint mixes x,y, and z so you cannot solve for a variable at all, use Lagrange Multipliers instead.
4
Practice
1
Find the point on the plane z=14−2x−3y that is closest to the origin (0,0,0), and find the minimum distance.
Drop the square root to minimize S=x2+y2+z2, and use the plane equation to replace z.
Substitute z=14−2x−3y into the squared distance S=x2+y2+z2:
S(x,y)=x2+y2+(14−2x−3y)2
Set both partial derivatives equal to zero (remembering to multiply by the inside derivatives −2 and −3 from the chain rule):
Since D>0 and Sxx>0 everywhere, (2,3) gives the absolute minimum.
Substitute (2,3) back into z=14−2x−3y to find z, then take the square root of S for the distance (stopping at S=14 without taking the square root is the most common mistake, which gives the squared distance 14 instead of the distance 14):
zd=14−2(2)−3(3)=1⟹closest point (2,3,1)=22+32+12=14
2
Find all points on the curved surface z2=xy+4 that are closest to the origin (0,0,0).
Look at how z appears in S=x2+y2+z2 before trying to take a square root of z2=xy+4.
Substitute z2=xy+4 directly into the squared distance S=x2+y2+z2:
S(x,y)=x2+y2+xy+4
Set both partial derivatives to zero and solve for the critical point:
Verify the absolute minimum with the Second Derivative Test:
SxxD=2,Syy=2,Sxy=1=(2)(2)−12=3>0andSxx=2>0
Substitute (x,y)=(0,0) back into z2=xy+4 to find z (taking only the positive root z=2 and forgetting z=−2 is the likeliest mistake here, which misses the second point (0,0,−2)):
z2(x,y,z)=(0)(0)+4=4⟹z=±2=(0,0,2) and (0,0,−2)
3
An open-top rectangular box must hold a volume of 24 ft3. Material for the bottom costs $4 per ft2, material for the front and back walls (width x, height z) costs $4 per ft2, and material for the left and right walls (length y, height z) costs $3 per ft2. Find the dimensions (x,y,z) that minimize the total cost of the box, and find the minimum cost.
Watch which variable cancels in each fraction: leaving x under 192 and y under 144 swaps the width and length to give (4,3,2) instead of (3,4,2).
Multiply each panel's area by its price per square foot to write the total cost C, then use the volume xyz=24 to replace z.
Multiply the bottom area xy by $4, the two front/back walls 2xz by $4, and the two left/right walls 2yz by $3, then substitute z=xy24 for x>0,y>0 (watch which variable cancels in each fraction: leaving x under 192 and y under 144 swaps the width and length to give (4,3,2) instead of (3,4,2)):
Evaluate C(3,4) to find the minimum cost for the 3 ft×4 ft×2 ft box:
C(3,4)=4(3)(4)+4192+3144=48+48+48=$144
4
A rectangular box sits in the first octant with three of its faces on the coordinate planes and its opposite vertex (x,y,z) on the tilted plane z=18−3x−2y. Find the dimensions (x,y,z) that maximize the volume of the box, and find the maximum volume.
The box runs from the origin to (x,y,z), so its volume is V=xyz; substitute z=18−3x−2y rather than dividing.
Substitute z=18−3x−2y into V=xyz on the open domain x>0,y>0,3x+2y<18 (where V=0 on all boundaries):
V(x,y)=xy(18−3x−2y)=18xy−3x2y−2xy2
Set both partial derivatives to zero and factor out y>0 and x>0 (setting x=0 or y=0 collapses the box onto the boundary with volume 0):