Word problem , Design a rectangular milk carton box This is the problem:
Design a rectangular milk carton box of width w, length l, and height h which holds 520 $cm^3$ of milk. The sides of the box cost 2 $cent/cm^2$ and the top and bottom cost 3 $cent/cm^2$. Find the dimensions of the box that minimize the total cost of materials used.
My approach was to do:
length(base)(height)=520
then that $b=h$ where($b$ is base and $h$ is height)
And, so $l(b^2)=520$  $\rightarrow $  $l=520/b^2$ (where $l$ is length)
then substitute into
Surface Area=$2(2lb+b^2)$ $\rightarrow $ $4(520/b^2)(b)+2b^2$ 
$2080/b +2b^2$ $\rightarrow $ take the derivative of this to get
$-2080/b^2 +4b$ and then
$4b=2080b^2$ and so $b^3=520$
Then plug that in to get $l$ as $l=520/(8.0414^2)$
But this is wrong, and I need someone to tell me how to approach it the right way.
 A: You have a cost function. Letting dimension of the box be $x \times y \times z$ such that the top and bottom have area $xy$, we have cost in cents given by
$$C(x,y,z) = 2 (2xz + 2yz) + 3 (2xy)$$
You also have a constraint, the volume:
$$V(x,y,z) = xyz = 520$$
This problem hints at using the technique of Lagrange multipliers, which often arises in multivariable calculus course. To progress, you'll need to solve
$$\nabla C(x,y,z) = \lambda \nabla V(x,y,z) $$
under the constraint. You should find certain $\lambda$ that will lead to a set of $\{x,y,z\}$ to subtitute back into $C$, producing possible extremas.

As a solution to the system of equations created by the last step, I get
$$x = 2(\frac{130}{3})^{1/3}$$
$$y=x$$
$$z=\frac{3}{2}x$$
which when plugged into $C$ gives
$$C_{min} = 888.275 \mathtt{ cents}$$
This matches the answer given by Wolfram Alpha.
A: Starting with the same approach as zahbaz in his/her answer, consider $$C = 2 (2xz + 2yz) + 3 (2xy)$$ and replace $$z=\frac V {xy}$$ from the constraint (this being done, Lagrange multipliers are no more needed).
This gives $$C=2 \left(\frac{2 V}{x}+\frac{2 V}{y}\right)+6 x y$$ Taking the partials and setting them to $0$ since we look for an extremum $$C'_x=6 y-\frac{4 V}{x^2}=0$$ $$C'_y=6 x-\frac{4 V}{y^2}=0$$ which are clearly satisfied if $x=y$. Do $$x=y=\sqrt[3]{\frac{2V}{3}} \implies z=\sqrt[3]{\frac{9V}{4}}=\frac {3x} 2$$ Plugging all these results leads to $$C=6\,  \sqrt[3]{12}\,  V^{2/3}$$ and then the result already given.
