Multivariable Optimization Word Problem The question is as follows:
A $120$ meter long fence is to be cut into pieces to make three enclosures, each of which is square. How should the fence be cut up in order to minimize the total area enclosed by the fence?
I'm having difficulting setting up a function to allow optimization.
I was thinking of doing something like:
$f(x, y) = 3xy$ and $120 = 6x + 6y$ with the idea being that each square should have the same dimensions for overall minimization.
However, I'm not sure if this is at all correct. Any guidance would be appreciated!
 A: Each square has equal width and length so you only need one variable to describe it. Let's suppose the first square has side of length $x$, the second length $y$ and the third length $z$. 
Then you want to minimize $f(x,y,z)=x^2+y^2+z^2$ subject to the constraint that $4x+4y+4z=120$ or equivalently, $x+y+z=30$.
Using Lagrange multipliers gives $L(x,y,z,\lambda)=x^2+y^2+z^2-\lambda(x+y+z-30)$
Setting the partial derivatives equal to $0$ gives $$\frac{\partial L}{\partial x}=2x-\lambda=0$$
$$\frac{\partial L}{\partial y}=2y-\lambda=0$$
$$\frac{\partial L}{\partial z}=2z-\lambda=0$$
$$\frac{\partial L}{\partial\lambda}=-x-y-z+30=0$$
Solving this we get that $x=y=z=10$
A: You can also avoid Lagrange multipliers here. 
You want to minimize $x^2+y^2+z^2$ under $x+y+z=30$. 
Observe that $(x+y+z)^2=x^2+y^2+z^2+2xy+2xz+2yz.$ 
But $2xy \le x^2 + y^2$, etc., with equality if and only if $x=y$ (we're assuming $x,y\ge 0$). This is the arithmetic-geometric mean inequality. Thus, 
$$ 900 = (x+y+z)^2 \le 3x^2 + 3y^2+3z^2$$
with equality if and only if $x=y=z$. Therefore, the minimum is attained at $x=y=z=10$. 
