# How do you minimize and maximize f(x,y)=xy^2e^y-e^x constrained to xy=1?

May 27, 2017

Use a Lagrange multiplier
Solve the system of equations.

#### Explanation:

The constraint function, $g \left(x , y\right)$ must be written in a form that is equal to zero:

$g \left(x , y\right) = x y - 1 = 0$

Write the Lagrange function:

$\setminus m a t h c a l L \left(x , y , \lambda\right) = f \left(x , y\right) + \lambda g \left(x , y\right)$

$\setminus m a t h c a l L \left(x , y , \lambda\right) = x {y}^{2} {e}^{y} - {e}^{x} + \lambda \left(x y - 1\right)$

$\setminus m a t h c a l L \left(x , y , \lambda\right) = x {y}^{2} {e}^{y} - {e}^{x} + \lambda x y - \lambda$

Compute the partial derivatives:

$\frac{\partial \setminus m a t h c a l L \left(x , y , \lambda\right)}{\partial x} = {y}^{2} {e}^{y} - {e}^{x} + \lambda y$

$\frac{\partial \setminus m a t h c a l L \left(x , y , \lambda\right)}{\partial y} = 2 x y {e}^{y} + x {y}^{2} {e}^{y} + \lambda x$

$\frac{\partial \setminus m a t h c a l L \left(x , y , \lambda\right)}{\partial \lambda} = x y - 1$

Set the partial derivatives equal to 0 and solve as a system of non-linear equations:

$0 = {y}^{2} {e}^{y} - {e}^{x} + \lambda y \text{ [1]}$

$0 = 2 x y {e}^{y} + x {y}^{2} {e}^{y} + \lambda x \text{ [2]}$

$0 = x y - 1 \text{ [3]}$

Write equation [1] as ${e}^{x} = \ldots$

${e}^{x} = {y}^{2} {e}^{y} + \lambda y \text{ [4]}$

Because $g \left(x , y\right)$ stipulates that $x \ne 0$, we can divide equation [2] by x:

$0 = 2 y {e}^{y} + {y}^{2} {e}^{y} + \lambda$

Solve for lambda

$\lambda = - 2 y {e}^{y} - {y}^{2} {e}^{y} \text{ [5]}$

Substitute into equation [4]:

${e}^{x} = {y}^{2} {e}^{y} + y \left(- 2 y {e}^{y} - {y}^{2} {e}^{y}\right) \text{ [6]}$

Write equation [3] and as y in terms of x:

$y = \frac{1}{x} \text{ [7]}$

Here is a graph of equations [6] and [7]:

graph{(y^2e^y+y(-2ye^y- y^2e^y)-e^x)(xy-1)=0 [-10, 10, -5, 5]}

The intersection points are:

$\left(- 0.459806 , - 2.17483\right)$ and $\left(- 0.224898 , - 4.44647\right)$

$f \left(- 0.459806 , - 2.17483\right) = - 0.87853$

$f \left(- 0.224898 , - 4.44647\right) = - 0.85071$