In Tuesday’s class we started but didn’t finish an example of maximizing a three-variable function subject to one constraint.  For reference, here is the full solution to that example. The problem was the following:

## Maximizing the Volume of a Rectangular Box with an Open Top

Suppose we are trying to maximize the volume of an open rectangular box using a fixed amount of material. In particular, suppose our box is $x$ feet wide, $y$ feet long, and $z$ feet tall. Also suppose we are making this open-top box from 12 square feet of material.

What are the dimensions of the box with the maximum possible volume?

The volume of such a box is $xyz$, so we are looking to maximize the function $f(x,y,z)=xyz$. The amount of material required to make such a box is equal to its surface area, which is $2xz+2yz+xy$. Since we are making our box from 12 square feet of material, we must therefore have $2xz+2yz+xy=12$. This equation is our constraint. Let’s denote the function on the right-hand side of this equation by $g(x,y,z)$.

As discussed in class, the critical points of $f$ subject to our constraint are the points which satisfy:

1. $\nabla f = \lambda \nabla g$ for some number $\lambda$; and
2. $2xz+2yz+xy=12$

As we computed in class, the first (vector) equation is equivalent to three equations (resulting from the coordinates of the vectors on both sides needing to be equal). As our class ended, we saw that we needed to solve the following system of four equations in four variables:

1. $yz=\lambda (2z+y)$
2. $xz=\lambda (2z+x)$
3. $xy=\lambda (2x+2y)$
4. $2xz+2yz+xy=12$

We ended class with the sad remark that there was no sure-fire way to solve such a system of equations. However, in this particular problem it can be done with a bit of elbow grease. Here is one way to do it.

First notice that if multiply the first equation by $x$, the second by $y$, and the third by $z$, we obtain the following three equations:

1. $xyz=\lambda x(2z+y)$
2. $xyz=\lambda y(2z+x)$
3. $xyz=\lambda z(2x+2y)$

Notice that if $\lambda = 0$, then equations (1)-(3) imply $xy=xz=yz=0$, but then equation (4) is not satisfied. So we must have $\lambda\neq 0$. Equations (5) and (6) then together give

1. $x(2z+y)=y(2z+x)$

This equation simplifies to $(x-y)z=0$ (after a bit of algebra), and so either $x=y$ or $z=0$. Of course, if $z=0$ then the box has volume 0, so we can assume $z\neq 0$. We have therefore deduced that $x=y$.

Similarly, equations (6) and (7) together give

1. $y(2z+x)=z(2x+2y)$

After a bit of simplification, this equation reduces to $x(y-2z)=0$. Again, we can assume $x\neq 0$, so this equation implies $y=2z$.

If we now plug in $x=y=2z$ to equation (4), we see that $12z^2=12$, and so $z=1$. Then $x=y=2$.

So, there is only one critical point, which must be the location of a global maximum in this situation (since the minimum volume is zero and there is clearly some maximum volume).

We can finally say that the optimal box is 2 feet wide, 2 feet long, and one foot tall. This box has a volume of 4 cubic feet, so that is the maximum of any open-top box we can make from 12 square feet of material.

Whew!