$$\begin{array}{ll} \text{maximize} & −x^2−y^2+4x+6y\\ \text{subject to} & x+y \le 6\\ & y \le 2\\ & x ,y \geq 0\end{array}$$

I tried using the Lagrange multiplier method and set:


And differentiated to get:

$$\frac{dL}{dx}=-2x+4-a$$ $$\frac{dL}{dy}=-2y+6-a-b$$ $$\frac{dL}{da}=6-x-y$$ $$\frac{dL}{DB}=2-y$$

Then by complementary slackness:


But I don't know what to do next?

  • $\begingroup$ You should add some information about what you have tried to solve and not just post a question. Refer to math.meta.stackexchange.com/questions/9959/… $\endgroup$ – user May 7 '18 at 20:56
  • $\begingroup$ I edited your post with more proper mathematical typesetting using MathJax (something you should learn too). But there are still some inconsistencies due to several typos that you made, such your function starting with "$-x^2$" in one line and "$x^2$" in another. Please make your post consistent, so that we can help you. $\endgroup$ – zipirovich May 8 '18 at 15:18
  • $\begingroup$ Sorry, thank you! $\endgroup$ – Kate May 8 '18 at 19:25
  • $\begingroup$ I think your Lagrange function should have a term $+6y$, not $-6y$. $\endgroup$ – Per Manne May 8 '18 at 21:42

Note that you have really four constraints, and not two, but it is customary to treat them differently, and to speak of two functional constraints and two nonnegativity constraints.

There are several different ways that the Lagrange conditions can be phrazed. With the constraints and the Lagrange function that you give, I would write them as four pairs of inequalitites: $${\partial L \over \partial x} \leq 0, \qquad x\geq 0 \\ {\partial L \over \partial y} \leq 0, \qquad y\geq 0 \\ {\partial L \over \partial a}\geq 0,\qquad a\geq 0 \\ {\partial L \over \partial b} \geq 0, \qquad b \geq 0$$ Now, complementary slackness is not the condition that you have given, but the condition that there is at least one equality in each pair of inequalities. In particular, any strict inequality must be matched with an equality.

One (unimaginative) way of solving this system is to divide into $2^4=16$ different cases according to whether the four variables $x,y,a,b$ are $=0$ or $>0$, and to see if there are any candidates in each of the $16$ cases. But you will probably get a more readable solution if you consider the four cases (i) $a=b=0$, (ii) $a=0, b>0$, (iii) $a>0, b=0$, (iv) $a>0, b>0$, and look for solutions in each of them. It is when you consider each of these cases that you will need to use complementary slackness.

  • $\begingroup$ You have to deal with the points where the boundary isn’t differentiable separately. $\endgroup$ – Michael Hoppe May 9 '18 at 8:37

As $f(x,y)=-(x-2)^2-(y-3)^2+13$, there’s no stationary point in the interior of the function’s domain. Now consider the critical points on the boundary.

First take a look at the vertices. For $x=0$ we have to find the critical points of $-y^2+6y$, that is $y=3$, but that’s not on the boundary.


For $y=0$ we find $x=2$ and $f(2,0)=4$.

For $y=2$ we find $x=2$ and $f(2,2)=12$.

For $y=6-x$ we find $x=2.5$ and $y=3.5$ which is out of bounds.

Now consider the edges, ie, the points where the boundary isn’t differentiable, namely $(0,0)$, $(0,2)$, $(4,2)$ and $(6,0)$. By comparison we find the minimum in $(6,0)$, its value is $-12$.

No need for Lagrange.

  • $\begingroup$ Note that the constraints are given with inequalities, so you do not know how many of them will be active in the solution. $\endgroup$ – Per Manne May 8 '18 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.