Finding extrema with a constraint of the function So I have a hard time understanding these kinds of problems. For example:
$$f(x,y)=ye^{-x^2-2y^2}$$ with constraint $D$ given by $x^2+y^2\leq 1$ and $y\geq0$. So I understand that I must find the partial derivative and then find out if there are any extremas on the boundary.But it is the last part I struggle with. What is the boundary? My book also says I should rearrange D and set $x^2=1-y^2$ in $f(x,y)$ and get a new function  $g(y)$ with $0\leq y\leq1$. And then I must differentiate this function and set it equal to zero. I then have to plug the y-values I get back in to $g(y)$, and the values I get is my extremas.
Does this work for every function: rearrange and make a function with one variable and then my new function gives me the extremas? This confusses me. And when should I use Lagrange multiplieres, is it only for constraints with equal sign?
 A: To find the local extrema of a function subject to inequality constraints, we can't just carelessly split the problem into the boundary and the interior as stated by @Alexandra. To demonstrate why, let's consider one of the points found by @Alexanda, namely $P = \left(\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}}\right)$. If this was a local maxima subject to the constraints, then there should be some neighbourhood around this point that's in the feasible region decribed by the constraints where $f$ is always less than it's value at $P$. Notice that at point $P$ the gradient of $f$ is:
$$\nabla f_P = - \left[\begin{matrix}e^{- \frac{3}{2}}\\e^{- \frac{3}{2}}\end{matrix}\right]$$
which points towards the interior of the circle (since it points radially inwards). Therefore, we can move in that direction to increase $f$ and so $f$ does not attain a local maximum at $P$.
You can always turn inequality constraints to equality constraints and use regular Lagrange multipliers. In your example, you have the objective function $f(x,y) = ye^{-x^2-2y^2}$ and constraints $g_1(x,y):= x^2 + y^2 -1 \leq 0$ and $g_2(x,y):= -y \leq 0$. If we bump up dimensions from say 2 dimensions to 4 dimensions, we can look at the constraints as $g_1(x,y,a,b):= x^2 + y^2 -1 + a^2 = 0$ and $g_2(x,y,a,b):= -y + b^2 = 0$. Now we can use the regular Lagrange multiplier method to get our solutions in this $4$-D space:
$$\Lambda(x,y,a,b,\lambda_1,\lambda_2) = f - \lambda_1g_1 - \lambda_2g_2$$
$\nabla \Lambda = 0$ gives us the solutions: $(x,y,a,b,\lambda_1,\lambda_2) = (-1, 0, 0, 0, 0, -e^{-1}) \left( 0,  \frac{1}{2},  \pm \frac{\sqrt{3}}{2},  \mp \frac{\sqrt{2}}{2}, 0, 0\right), \left(0, 1, 0, \pm1, - \frac{3}{2 e^{2}}, 0\right), \left( 1,0, 0, 0, 0, - \frac{1}{e}\right)$
You can use the bordered hessian to check minima or maxima. Turns out first $(-1,0)$ is a saddle, $\left(0,\frac{1}{2}\right)$ is a max, $(0,1)$ is a min and $(1,0)$ is a saddle.
A: When working with this kind of problems we have to take advantage of the constrain. We can decompose the region $\text{D}$ into the inner part $\text{I}= \{ x, y \in \mathbb{R} \ : \ x^2+y^2< 1, \ y>0 \}$ and the boundary $\text{B}$. Furthermore, we can divide $\text{B}$ into two sections:
$$ \text{P}_{1} = \{ x,y \in \mathbb{R} \ : \ y=0, \ x \in [-1,1] \} \text{ and}$$
$$ \text{P}_{2} = \{ x,y \in \mathbb{R} \ : \ x^2+y^2=1 , \ y>0 \}. $$
We see that this decomposition satisfies the following condition $\text{D} = \text{B} \cup \text{P}_1 \cup \text{P}_2$ and that the regions $\text{D}, \ \text{P}_1 , \ \text{P}_2$ are pairwise disjoint.
On $\text{I}$ we find extrema of $f$ by computing partial derivatives $f_{x}$ and $f_{y}$ and then solving the system of equations: $f_{x}=0, \ f_{y}=0$. To determine whether the solution is a maximum or a minimum we use Hessian matrix of the function $f$.
On $\text{P}_{1}$ and $\text{P}_{2}$ we can use the fact that one of the variables is now dependent on the other one; hence, the function becomes a function of one variable. On region $\text{P}_{1}$ we denote it $f_1$ and the region $\text{P}_{2}$ we denote it $f_2$. Next, we see that:
$$ f_1 (x) = 0, \ x \in [-1, 1 ] \text{ and } f_2 (y) = y \ e^{-1-y^2} , \ y \in (0, 1]. $$
On $\text{I}$ there is only one maximum at $ (0, 0.5)$ and on $\text{P}_{2}$ there are two maxima at $ ( \pm 1/ \sqrt{2}, 1/ \sqrt{2} )$ and one minimum at $(0,1)$.
One can always use the method of Lagrange multipliers. However, the computation are difficult and it is better to find these kind of workarounds.
