$$\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:
$$L=(-x^2-y^2+4x-6y)+a(6-x-y)+b(2-y).$$
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:
$$-2x+4-a=-2y+6-a-b.$$
But I don't know what to do next?
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.
Similarly:
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.