# How do you minimize and maximize f(x,y)=x^3-y constrained to x-y=4?

Jul 15, 2016

we'll do it first as a problem in single variable calculus.

we have $f \left(x , y\right) = {x}^{3} - y$ but also the constraint $x - y = 4$ so we can sub the constraint in to get

$f \left(x\right) = {x}^{3} - \left(x - 4\right)$

it's all the usual stuff from here on

$f ' = 3 {x}^{2} - 1$
$f ' ' = 6 x$

so $f ' = 0 \implies x = \pm \frac{1}{\sqrt{3}}$

and $f ' ' \left(\frac{1}{\sqrt{3}}\right) > 0$ so min

$f ' ' \left(- \frac{1}{\sqrt{3}}\right) < 0$ so a max

i'll do a Lagrange Multiplier next to compare. the basic premise is that with

$f \left(x , y\right) = {x}^{3} - y$ to optimise

plus the constraint $g \left(x , y\right) = x - y = c o n s t$

we can say that $\nabla f = \lambda \nabla g$

or

$\left(\begin{matrix}3 {x}^{2} \\ - 1\end{matrix}\right) = \lambda \left(\begin{matrix}1 \\ - 1\end{matrix}\right)$

$\implies \lambda = \frac{3 {x}^{2}}{1} = - \frac{1}{-} 1$

So $3 {x}^{2} = 1$ with same conclusion, stationary points at $x = \pm \frac{1}{\sqrt{3}}$ and from the constraint $y = \pm \frac{1}{\sqrt{3}} - 4$

I'm asking for a second opinion on this next bit.

Because there is no simple way to explore the nature of the turning points, especially with more complex problems, when using the LM approach. You can often play with the physical reality and reason a solution but there is no quick second derivative check, sadly, that i am aware of.

I am just wondering if the Hessian for let's say $L \left(x y\right) = {x}^{3} - y + \lambda \left(x - y\right) = c o n s t$

would be of any use here.