# Maximise the volume of a rectangular prism with 2 constraints

1. Aug 11, 2014

### phosgene

1. The problem statement, all variables and given/known data

Maximise the volume of a rectangular prism with the following constraints: the surface area must equal 2m^2 and the total edge length must be 12m.

2. Relevant equations

Using Lagrange multipliers, we construct the function we want to optimise with

$h(x,y,z, λ_{1}, λ_{2}) = f(x,y,z) + λ_{1}g_{1}(x,y,z) + λ_{2}g_{2}(x,y,z)$

3. The attempt at a solution

In this case our f(x,y,z) is the volume of the rectangular prism, so $f(x,y,z)=xyz$, where we take x to be the length, y the widge and z the depth. $g_{1}(x,y,z)=λ_{1}(xy + yz + zx - 1)$, the surface area constraint and $g_{2}(x,y,z)=λ_{2}(x+y+z-3)$ (the edge length constraint).

The function to be optimised is then $h(x,y,z, λ_{1}, λ_{2}) = xyz + λ_{1}(xy + yz + zx - 1) + λ_{2}(x+y+z-3)$

Obtain all the partial derivatives:

1. $\frac{∂h}{∂x} = yz + λ_{1}(y+z) + λ_{2} = 0$

2. $\frac{∂h}{∂y} = xz + λ_{1}(x+z) + λ_{2} = 0$

3. $\frac{∂h}{∂z} = yx + λ_{1}(y+z) + λ_{2} = 0$

4. $\frac{∂h}{∂λ_{1}} = xy + yx + zy -1 = 0$

5. $\frac{∂h}{∂λ_{2}} = x + y + z -3 = 0$

Add 1, 2 and 3. Then sub in 4 and 5 to obtain the result $λ_{1}=-(3λ_{2}+1)/6$

But from here I'm totally lost. I can re-arrange 1,2 and 3 to get λ2 by itself, then equate them all to get

$\frac{\frac{1}{6}(y+z) - yz}{1-\frac{1}{2}(y+z)}=\frac{\frac{1}{6}(y+x) - yx}{1-\frac{1}{2}(y+x)}=\frac{\frac{1}{6}(z+x) - zx}{1-\frac{1}{2}(z+x)}$

But doesn't this imply that x=y=z? This cannot satisfy both 4 *and* 5.

2. Aug 12, 2014

### HallsofIvy

Staff Emeritus
What that tells you is that the constraints are impossible- you cannot have a rectangular prism with surface area 2 square meters and total edge length 12 meters.

3. Aug 12, 2014

### Ray Vickson

No, you can have such a prism. In fact, over the physically allowable region $x,y,z \geq 0, x+y+z = 3$ the half-area $A = xy + xz + yz$ ranges from $A = 0$ at the points $(x,y,z) = (3,0,0), (0,3,0), (0,0, 3)$ to $A = 3$ at the point $(x,y,z) = (1,1,1)$. Any value of $A$ from 0 to 3 is attainable.

However, the OP made a number of errors (perhaps typographical, perhaps not).

I found it much easier to use one of the constraints to eliminate one of the variables. For example, from $g_2 = 3$ we have $z = 3 - x - y$, and putting that in $g_1$ yields $G_1(x,y) = g_1(x,y,3-x-y) = 3x+3y-x^2-y^2-xy-1$ Now the problem is to maximize $F = x y (3-x-y)$, subject to $G_1(x,y) = 0$. This can be attacked using a Lagrange multiplier method; there are solutions.

Last edited: Aug 12, 2014