# How do you minimize and maximize f(x,y)=x^2y-xy constrained to 3<x+y<5?

Jun 17, 2016

There are local maxima at
$\left\{2.21525 , y = 0.78475\right\}$ and $\left\{x = 3.52753 , y = 1.47247\right\}$

and local minima at
$\left\{x = 0.451416 , y = 2.54858\right\}$ and $\left\{x = 0.472475 , y = 4.52753\right\}$

#### Explanation:

Introducing the so called slack variables ${s}_{1} , {s}_{2}$ the optimization problem is transformed into an equivalent one

Find local minima, maxima of

$f \left(x , y\right) = {x}^{2} y - x y$

subject to

${g}_{1} \left(x , y , {s}_{1}\right) = x + y - {s}_{1}^{2} - 3 = 0$
${g}_{2} \left(x . y , {s}_{2}\right) = x + y + {s}_{2}^{2} - 5 = 0$

The lagrangian is

$L \left(x , y , {s}_{1} , {s}_{2} , {\lambda}_{1} , {\lambda}_{2}\right) = f \left(x , y\right) + {\lambda}_{1} {g}_{1} \left(x , y , {s}_{1}\right) + {\lambda}_{2} {g}_{2} \left(x , y , {s}_{2}\right)$

$L$ is analytical so the stationary points include the relative maxima and minima.

The determination of stationary points is done solving for $x , y , {s}_{1} , {\lambda}_{1} , {s}_{2} , {\lambda}_{2}$ the system of equations given by

$\nabla L \left(x , y , {s}_{1} , {\lambda}_{1} , {s}_{2} , {\lambda}_{2}\right) = \vec{0}$

or

{(lambda_1 + lambda_2 - y + 2 x y=0), (lambda_1 + lambda_2 - x + x^2=0), ( -3 - s_1^2 + x + y=0), (-2 lambda_1 s_1=0), (-5 + s_2^2 + x + y=0) ,(2 lambda_2 s_2=0) :}

Solving we get

((x = 0.451416, y = 2.54858, lambda_1 = 0.24764, s_1 = 0., lambda_2 = 0., s_2 = 1.41421), (x = 2.21525, y= 0.78475, lambda_1 = -2.69208, s_1= 0., lambda_2= 0., s_2= -1.41421), (x = 0.472475, y= 4.52753, lambda_1= 0., s_1 = -1.41421, lambda_2 = 0.249242, s_2= 0.), (x = 3.52753, y = 1.47247, lambda_1= 0., s_1= -1.41421, lambda_2 = -8.91591, s_2 = 0.))

The first and second points are at the boundaries of ${g}_{1} \left(x , y , 0\right) = 0$ and the third and fourth at ${g}_{2} \left(x , y , 0\right) = 0$ respectively.

Their qualification must be done with ${f}_{{g}_{1}}$ and ${f}_{{g}_{2}}$ respectively. So,

${f}_{{g}_{1}} \left(x\right) = - \left(x - 3\right) \left(x - 1\right) x$
${f}_{{g}_{2}} \left(x\right) = - \left(x - 5\right) \left(x - 1\right) x$

${d}^{2} / \left({\mathrm{dx}}^{2}\right) {f}_{{g}_{1}} \left(0.451416\right) = 5.2915$ qualifying this point as a local minimum
${d}^{2} / \left({\mathrm{dx}}^{2}\right) {f}_{{g}_{1}} \left(2.21525\right) = - 5.2915$ qualifying this point as a local maximum
${d}^{2} / \left({\mathrm{dx}}^{2}\right) {f}_{{g}_{2}} \left(0.472475\right) = 9.2915$ qualifying this point as a local minimum
${d}^{2} / \left({\mathrm{dx}}^{2}\right) {f}_{{g}_{2}} \left(3.52753\right) = - 1.2915$ qualifying this point as a local maximum

Attached a figure with a contour mapping with the points found.