# Optimization Problems with Functions of Two Variables

Several optimization problems are solved and detailed solutions are presented. These problems involve optimizing functions in two variables using first and second order partial derivatives.

## Problems with Detailed Solutions

### Problem 1

You decide to build a box that has the shape of a rectangular prism with a volume of 1000 cubic centimeters. Find the dimensions $$x$$, $$y$$, and $$z$$ of the box so that the total surface area of all 6 faces of the box is minimum.
Solution to Problem 1:
The total area $$A$$ of all six faces of the prism is given by:
$A = 2xy + 2yz + 2zx$

The volume of the box is given; hence
$xyz = 1000$
Solve the above for $$z$$:
$z = \frac{1000}{xy}$
Substitute $$z$$ in the expression of the area $$A$$ to obtain:
$A(x,y) = 2xy + 2y \left( \frac{1000}{xy} \right) + 2x \left( \frac{1000}{xy} \right) = 2xy + \frac{2000}{x} + \frac{2000}{y}$
We now need to find $$x$$ and $$y$$ that minimize the area $$A$$. We first need to find
the critical points and then test the second partial derivatives. The first order partial derivatives of $$A$$ are given by:
$A_x(x,y) = 2y - \frac{2000}{x^2}$ $A_y(x,y) = 2x - \frac{2000}{y^2}$
The critical points are found by setting $$A_x(x,y) = 0$$ and $$A_y(x,y) = 0$$ and solving the system obtained, which gives:
$2y - \frac{2000}{x^2} = 0$ $2x - \frac{2000}{y^2} = 0$
Solve the above to obtain:
$x = 10 \quad \text{and} \quad y = 10$
We now need to find the second order partial derivatives:
$A_{xx}(x,y) = \frac{4000}{x^3}$ $A_{yy}(x,y) = \frac{4000}{y^3}$ $A_{xy}(x,y) = 2$
We now need to test the values of $$A_{xx}$$, $$A_{yy}$$, and $$A_{xy}$$ at the point (10,10) in order to use the theorem on
minima and maxima of functions with 2 variables .
$D = A_{xx}(10,10) \cdot A_{yy}(10,10) - A_{xy}^2(10,10) = 4 \times 4 - 4 = 12$
$$D$$ is positive and $$A_{xx}(10,10) = 4$$ is positive, therefore the area $$A$$ is minimum for
$x = 10 \, \text{cm}$ $y = 10 \, \text{cm}$ $z = \frac{1000}{xy} = 10 \, \text{cm}$

### Problem 2

Find the dimensions of a six-faced box that has the shape of a rectangular prism with the largest possible volume that you can make with 12 squared meters of cardboard.

Solution to Problem 2:
Using all available cardboard to make the box, the total area $$A$$ of all six faces of the prism is given by:
$A = 2xy + 2yz + 2zx = 12$

The volume $$V$$ of the box is given by:
$V = xyz$
Solve the equation $$2xy + 2yz + 2zx = 12$$ for $$z$$:
$z = \frac{6 - xy}{x + y}$
Substitute $$z$$ in the expression of the volume $$V$$ to obtain:
$V(x,y) = \frac{xy(6 - xy)}{x + y}$
Let us find
the critical points by first finding the first order partial derivatives:
$V_x(x,y) = -y^2 \frac{x^2 + 2xy - 6}{(x + y)^2}$ $V_y(x,y) = -x^2 \frac{y^2 + 2xy - 6}{(x + y)^2}$
We now solve the system of equations given by $$V_x = 0$$ and $$V_y = 0$$. One obvious solution is given by the point (0,0) but is not physically possible. Other solutions are found by setting:
$x^2 + 2xy - 6 = 0$ $y^2 + 2xy - 6 = 0$
Subtracting the equations term by term we obtain:
$x^2 - y^2 = 0$
Solve to obtain:
$x = y \quad \text{and} \quad x = -y$
The solution $$x = -y$$ is not valid for this problem since both $$x$$ and $$y$$ are dimensions and cannot be negative. Use $$x = y$$ in the equation $$x^2 + 2xy - 6 = 0$$, we obtain:
$x^2 + 2x^2 - 6 = 0$
Solve for $$x$$
$x = \sqrt{2}$
Find $$y$$
$y = x = \sqrt{2}$
Let us now find the second order partial derivatives:
$V_{xx}(x,y) = -2y^2 \frac{y^2 + 6}{(x + y)^3}$ $V_{yy}(x,y) = -2x^2 \frac{x^2 + 6}{(x + y)^3}$ $V_{xy}(x,y) = -2xy \frac{x^2 + 3xy + y^2 - 6}{(x + y)^3}$
We now need the values of $$V_{xx}$$, $$V_{yy}$$, and $$V_{xy}$$ to find the value of $$D = V_{xx}(\sqrt{2},\sqrt{2}) V_{yy}(\sqrt{2},\sqrt{2}) - V_{xy}^2(\sqrt{2},\sqrt{2})$$ in order to use the theorem on
minima and maxima of functions with 2 variables .
$D = V_{xx}(\sqrt{2},\sqrt{2}) V_{yy}(\sqrt{2},\sqrt{2}) - V_{xy}^2(\sqrt{2},\sqrt{2}) = \frac{5}{2}$
Since $$D$$ is positive and $$V_{xx}(\sqrt{2},\sqrt{2}) = -\sqrt{2}$$ is negative, the volume $$V$$ is maximum for:
$x = \sqrt{2} \, \text{meters}$ $y = \sqrt{2} \, \text{meters}$ $z = \frac{6- xy}{x + y} = \sqrt{2} \, \text{meters}$

### Problem 3

Find the distance from the point $$(1,2,-1)$$ to the plane given by the equation $$x - y + z = 3$$.

Solution to Problem 3:
One way to find the distance from a point to a plane is to take a point $$(x,y,z)$$ on the plane; find the distance between this point and the given point and minimize it. Because the distance involves the square root, it would be better to minimize the square of the distance. Let the square of the distance between the given point and the point $$(x,y,z)$$ on the plane be $$f$$.
$f(x,y,z) = (x - 1)^2 + (y - 2)^2 + (z + 1)^2$
We now solve the given equation $$x - y + z = 3$$ of the plane for $$z$$ to obtain:
$z = 3 - x + y$
Substitute $$z$$ in $$f$$ by $$3 - x + y$$ .
$F(x,y) = (x - 1)^2 + (y - 2)^2 + (- x + y + 4)^2$
We now find the first order partial derivatives:
$F_x(x,y) = 2(x - 1) + 2(-1)(-x + y + 4)$ $F_y(x,y) = 2(y - 2) + 2(-x + y + 4)$
We now need to find the critical points by setting the first partial derivatives equal to zero.
$2(x - 1) + 2(-1)(-x + y + 4) = 0$ $2(y - 2) + 2(-x + y + 4) = 0$
We now solve the system of equations to obtain:
$\left( \frac{8}{3}, \frac{1}{3}, \frac{2}{3} \right)$
We now calculate the second order derivatives:
$F_{xx}(x,y) = 4$ $F_{yy}(x,y) = 4$ $F_{xy}(x,y) = -2$
We now need to find the sign of $$D = F_{xx}\left(\frac{8}{3},\frac{1}{3}\right) F_{yy}\left(\frac{8}{3},\frac{1}{3}\right) - F_{xy}^2\left(\frac{8}{3},\frac{1}{3}\right)$$ in order to use the theorem on minima and maxima of functions with 2 variables
$D = F_{xx}\left(\frac{8}{3},\frac{1}{3}\right) F_{yy}\left(\frac{8}{3},\frac{1}{3}\right) - F_{xy}^2\left(\frac{8}{3},\frac{1}{3}\right) = 12$
Since $$D$$ is positive and $$F_{xx}$$ is positive, $$F$$ has a minimum at the point $$\left(\frac{8}{3},\frac{1}{3}\right)$$ which corresponds to a point on the plane given by
$\left( \frac{8}{3},-\frac{1}{3},\frac{2}{3} \right)$
The distance $$d$$ between the given point and the plane is given by
$d = \sqrt{ (1 - 8/3)^2 + (2 - 1/3)^2 + (-1 - 2/3)^2 }$ $= \frac{5}{\sqrt{3}}$

More on partial derivatives and multivariable functions. Multivariable Functions