\section{Global Extrema on Restricted Domains}
\begin{enumerate}[1.]
\item {\it 
Find the largest and smallest values of the function $f(x,y)=x^3-3xy+3y^2$ on the closed triangle with vertices
$(0,0), (1,0), (1,1)$.}


\medskip



We first look for critical points.
We have $\nabla f=\langle 3x^2-3y,- 3x+6y\rangle $. At a critical point we get
$$ 0=-3x+6y\ \Rightarrow \ x=2y,
$$
$$3x^2-3y=12y^2-3y=0\ \Rightarrow\ 4y^2-y=y(4y-1)=0,$$
which gives $y=0$ or $y=1/4$. We get two critical points $(0,0)$ and
$(\frac{1}{2},\frac{1}{4})$. We evaluate $f$ at these points:
$$
f(0,0)=0, f\Big( \frac{1}{2},\frac{1}{4}\Big) = \frac{1}{8}-\frac{3}{8} + \frac{3}{16} =-\frac{1}{16}.
$$
Note that $(0,0)$ is one of the vertices and $(\frac{1}{2},\frac{1}{4})$ is inside the triangle.


Next, we look for the largest and smallest values on the boundary. We consider each of the three line segments:

\medskip

\begin{itemize}

\item If $y=0$, $0\leq x\leq 1$, then $f(x,0)=x^3$ has the minimum $f(0,0)=0$ and maximum $f(1,0)=1$.

\item If $y=x$, $0\leq x\leq 1$, then $f(x,x)=x^3-3x^2+3x^2=x^3$ has the minimum $f(0,0)=0$ and maximum $f(1,1)=1$.


\item If $x=1$, $0\leq y\leq 1$, then $f(1,y)=1-3y+3y^2$. To find the extremal values, we compute the derivative:
$$
\frac{d}{dy}f(1,y)=-3+6y.
$$
This is 0 when $-3+6y=0$, so that $y=1/2$, $f(1,\frac{1}{2})=1-\frac{3}{2}+\frac{3}{4} = \frac{1}{4}$.
We already computed $f(1,0)=1$ and $f(1,1)=1$.

\end{itemize}

\medskip

Finally, we choose the largest and smallest of these values. The largest value is $f(1,0)=f(1,1)=1$,
and the smallest value is $f( \frac{1}{2},\frac{1}{4}) =-\frac{1}{16}$.

\bigskip


\item {\it Find the largest and smallest values of the function $f(x,y)=4x-2xy+y^2$
on the square $\{(x,y):\ 0\leq x\leq 2,\ 0\leq y\leq 2\}$.}


\medskip

We first look for critical points inside the region. We have $f_x=4-2y$ and $f_y=-2x+2y$,
hence if $f_x=f_y=0$, then $y=2$ and $x=2$. At the critical point, $f(2,2)=8-8+4=4$.

\smallskip

Next, we look for possible minima and maxima on the boundary:

\medskip

\begin{itemize}
\item $f(x,0)=4x$ with $0\leq x\leq 2$ has the minimum value $f(0,0)=0$ and maximum value $f(2,0)=8$;
\item $f(x,2)=4x-4x+4=4$;
\item $f(0,y)=y^2$ with $0\leq x\leq 2$ has the minimum value $f(0,0)=0$ and maximum value $f(0,2)=4$;
\item $f(2,y)=8-4y+y^2$. To find its extrema on $[0,2]$, we look for critical points: $-4+2y=0$,
$y=2$. We have already evaluated $f(2,2)=4$ and $f(2,0)=8$.


\end{itemize}

\medskip

Thus the smallest value is $f(0,0)=0$ and the largest value is $f(2,0)=8$.


\bigskip



\item {\it 
Find, with proof, the global minimum and maximum of the function $f(x,y)=\frac{xy}{x^4+y^4+32}$ defined
for all $x,y$, by following the steps listed below.

\medskip

(a) Find all critical points of $f$, evaluate $f(x,y)$ at these points, and choose the largest and
smallest value, $M$ and $m$.}

\medskip

We have
$$f_x(x,y)=\frac{y(x^4+y^4+32)-xy(4x^3)}{(x^4+y^4+32)^2} = 
\frac{y(y^4+16-3x^4)}{(x^4+y^4+16)^2},
$$
$$f_y(x,y)=\frac{x(x^4+y^4+32)-xy(4y^3)}{(x^4+y^4+32)^2} = 
\frac{x(x^4+16-3y^4)}{(x^4+y^4+16)^2}.
$$
For a critical point, we should have $f_x(x,y)=f_y(x,y)=0$. From $f_x(x,y)=0$, we get that
either $y=0$ or $y^4+32=3x^4$. From $f_y(x,y)=0$, 
either $x=0$ or $x^4+32=3y^4$.

If $y=0$, then $x^4+32=3y^4=0$ has no solutions, so we must have $x=0$. Similarly, if
$x=0$, then $y=0$. If on the other hand $y^4+32=3x^4$ and $x^4+32=3y^4$, then we can
combine the two equations to get $x^4=3y^4-32 = 3(3x^4 -32)-32 = 9x^4 -128$, so that
$$
8x^4=128,\ \ x^4=16,\ \ 
x=\pm 2,
$$
and $y^4=3x^4-32 = 3\cdot 16-32 =16$, $y=\pm 2$. This gives
us 5 critical points, with the corresponding values of $f$ as follows:
\begin{align*}
&f(0,0)=0,
\\
&f(2,2)  = f(-2,-2) = \frac{4}{16+16+32}= \frac{1}{16},
\\
&f(2,-2)  = f(-2,2)  
= -\frac{1}{16}.
\end{align*}
Thus $M=\frac{1}{16}$ and $m=-\frac{1}{16}$.

\medskip

{\it (b) Prove that $x^4+y^4 \geq \frac{1}{2}(x^2+y^2)^2$.}

\medskip

We have $x^4+y^4-2x^2y^2 = (x^2-y^2)^2 \geq 0$, so that $x^4+y^4\geq 2x^2y^2$.
Therefore
$$
2(x^4+y^4) = x^4+y^4 + (x^4+y^4) \geq x^4+y^4+2x^2y^2= (x^2+y^2)^2,
$$
and the inequality we want follows when we divide by 2.



\medskip

{\it (c) Use (b) to prove that $|f(x,y)|\leq \frac{2}{x^2+y^2}$. Based on this, prove that
the values $M$ and $m$ from (a) are in fact the global minimum and maximum values. }

\medskip


Using (b), we get
\begin{align*}
|f(x,y)| &= \frac{|xy|}{x^4+y^4+32} \leq \frac{|xy|}{x^4+y^4}
\leq \frac{|xy|}{\frac{1}{2}(x^2+y^2)^2} 
\\
&= \frac{2|xy|}{(x^2+y^2)^2} \leq \frac{2 \sqrt{x^2+y^2}\sqrt{x^2+y^2}}{(x^2+y^2)^2}
=  \frac{2 }{x^2+y^2},
\end{align*}
when we used that $|x|,|y|\leq \sqrt{x^2+y^2}$. (Alternatively, one could use that
$2|x||y|\leq x^2+y^2$ by completing the square as in (b), and then we get a similar estimate without 
the factor of 2.)

Now to finish the problem, consider a large enough disc, e.g. $D=\{(x,y):\ x^2+y^2\leq 100\}$.
The only critical points in that disc are those found in (a). On the other hand, if $(x,y)$ is
either on the boundary of $D$ or outside of it, then we have $|f(x,y)|\leq \frac{2 }{x^2+y^2}
\leq \frac{2}{100}=\frac{1}{50}< \frac{1}{16}$. Therefore $M$ and $m$ from (a) are the actual
global maximum and minimum, respectively.

\medskip



\item {\it  Let $ f(x,y)=2x^2-7x-xy+y^2$. Find the global minimum of $f(x,y)$ on $\rr^2$,  by following the procedure below.

\medskip

(a) Find all critical points of $f$. Evaluate $f$ at these points.

\medskip

(b) Prove that if $|x|$ and $|y|$ are large enough, then $f(x,y)$ is greater than the values you found in (a). 
\medskip

(c) Conclude that the global minimum is attained at a point found in (a).}


\medskip

(a) The partial derivatives are 
$$f_1(x,y)=4x-7-y,\ \ f_2(x,y) = -x+2y.
$$
For a critical point, we must have $f_2=0$ so that $x=2y$, and then $f_1=0$ implies $0=4x-7-y=7y-7$, so that $y=1$ and $x=2$. At the critical point $(2,1)$, we have
$$
f(2,1)=2\cdot 4-7\cdot 2-2+1=8-14-2+1=-7.
$$
Now we need to check that this is a global minimum. The proof below is just one of many ways that this can be done, so that if you are using a different inequality, that should be fine as long as you are doing it correctly.

\medskip

(b) We rewrite $f(x,y)$ as
\begin{align*}
f(x,y) & = \frac{x^2}{2}+ (x^2-7x) + \left( \frac{x^2}{2}-xy + \frac{y^2}{2} \right) + \frac{y^2}{2}
\\
&=  \frac{x^2+y^2 }{2}+ \left(x^2-7x+\frac{49}{4}\right)^2 - \frac{49}{4} + \frac{(x-y)^2}{2}
\\
&=  \frac{x^2+y^2 }{2}+ \left(x-\frac{7}{2}\right)^2 - \frac{49}{4} + \frac{(x-y)^2}{2}
\\
&\geq \frac{x^2+y^2 }{2} - \frac{49}{4} .
\end{align*}
If $x^2+y^2\geq 100$, then $f(x,y)\geq 50 -  \frac{49}{4} >0 > f(2,1)$. 

\medskip

(c) Combining (a) and (b), we see that the minimum of $f$ on the compact region $x^2+y^2\leq 100$ is $f(2,1)=-7$, and that $f(x,y)>0>f(2,1)$ outside of the region. Therefore $f(2,1)=-7$ is the global minimum on $\rr^2$.












\bigskip

\item {\it Find the global minimum and maximum of $f(x,y)=(2x^2-y^2)e^{-x^2-y^2}$
on $\rr^2$, with proof.}


\medskip
We first find the critical points.  The partials are:
$$f_x=4xe^{-x^2-y^2}+(2x^2-y^2)e^{-x^2-y^2}\cdot(-2x)
=2x(2-2x^2+y^2)e^{-x^2-y^2},$$
$$f_y=-2ye^{-x^2-y^2}+(2x^2-y^2)e^{-x^2-y^2}\cdot(-2y)
=-2y(1+2x^2-y^2)e^{-x^2-y^2}.$$
If $f_x=0$, then either $x=0$ or $2-2x^2+y^2=0$, and if 
$f_y=0$, then either $y=0$ or $1+2x^2-y^2=0$.

\smallskip
\begin{itemize}
\item For $x=0$, we get $y=0$ or $1-y^2=0$, so that $y=\pm 1$.
\item For
$y=0$, we get $x=0$ or $2-2x^2=0$, so that $x=\pm 1$.  
\item Finally,
we cannot have $2-2x^2+y^2=0$ and
$1+2x^2-y^2=3-(2-2x^2+y^2)=0$ at the same time. 
\end{itemize}

\smallskip
This gives us 5 critical points: $(0,0),(0,\pm 1),(\pm 1,0)$.
We have $f(0,0)=0$, $f(0,\pm 1)=-e^{-1}$, $f(\pm 1,0)=2e^{-1}$.

\medskip

Next, we have
$$
\lim_{(x,y)\to\infty }f(x,y)=0.
$$
To prove this, we use single-variable calculus. Let $r=\sqrt{x^2+y^2}$ (as in polar coordinates),
then
$|2x^2-y^2|\leq 2x^2+y^2\leq 3r^2$ and 
$e^{-x^2-y^2}= e^{-r^2}$, so that
$$|f(x,y)|=|2x^2-y^2|e^{-x^2-y^2}
\leq 3r^2e^{-r^2}.$$
To see that this tends to 0 as $r\to\infty$, we use l'H\^opital's Rule:
$$
\lim_{r\to\infty} \frac{3r^2}{e^{r^2}}=\lim_{r\to\infty} \frac{6r}{2re^{r^2}}
=\lim_{r\to\infty} \frac{3}{e^{r^2}}=0.
$$
In particular, if we take $R$ large enough, then we have 
$|f(x,y)|\leq (2e)^{-1}$ for all $(x,y)$ with $r=\sqrt{x^2+y^2}\geq R$.
Let 
$$X=\{(x,y):\ x^2+y^2\leq R^2\}$$
(a closed disc of radius $R$ centered at the origin).   Then on
the boundary of $X$ we have 
$|f(x,y)|\leq (2e)^{-1}$, hence the maximal and minimal values of $f$
on $X$ are, respectively, $f(\pm 1,0)=2e^{-1}$ and $f(0,\pm 1)=-e^{-1}$.
But outside of $X$ we also have
$|f(x,y)|\leq (2e)^{-1}$.
Therefore, $f(\pm 1,0)=2e^{-1}$ and $f(0,\pm 1)=-e^{-1}$ are in fact the
global extrema of $f$.


\bigskip



\item {\it Let $ f(x,y)=x^2y-2xy^2+3y$. Find the largest and smallest values of $f(x,y)$ on the following sets,
or else prove that they do not exist:

(a)  $D_1=\{(x,y):\ x\geq 0, 0\leq y\leq 2\}$, 

(b)  $D_2=\{(x,y):\ x\geq 0, y\geq 0, xy\leq 16\}$. 

Make sure that you account for both regions being unbounded. }


\medskip

The partial derivatives are 
$$f_1(x,y)=2xy-2y^2=2y(x-y),\ \ f_2(x,y) = x^2-4xy+3.
$$
For a critical point, we must have $f_1=0$, so that $y=0$ or $x=y$.

\begin{itemize}

\item If $y=0$, then $f_2=0$ implies $x^2+3$, which has no solutions.

\item If $x=y$, then $f_2=0$ implies $x^2-4x^2+3=0$, so that $x=\pm 1$. We have 
$$
f(1,1)=1-2+3=2,
$$
and the point $(-1,-1)$ is not in $D_1$ or $D_2$.

\end{itemize}


\medskip

(a) 
We check the boundary of $D_1$. When $y=0$, we have $f(x,0)=0$. 
When $y=2$, we have
$$
f(x,2)=2x^2-8x+6=2(x-2)^2 -2,
$$
which has a minimum $f(2,2)=-2$ and goes to $\infty$ as $x\to\infty$. Finally, 
when $x=0$ and $0\leq y\leq 2$, we have $f(0,y)=3y$, with minimum $f(0,0)=0$ and maximum $f(0,2)=6$.

This already tells us that no maximum value exists (since $f(x,2)\to\infty$ as $x\to\infty$), and the smallest value we found so far if $f(2,2)=-2$. We just need to check that $f$ does not have any smaller values at the ``unbounded end'' of $D_1$. One way to do that is to notice that
$$
f(x,y)=xy(x-2y)+3y.
$$
For $x\geq 4$ and $(x,y)\in D_1$, we have $x\geq 4\geq 2y$, so that $f(x,y)\geq 0$. Thus any values of $f$ that are smaller than $-2$ would have to lie in the compact region $\{(x,y):\ 0\leq  x\leq 4,\ 0\leq y\leq 2$. But we just checked that the smallest value in that region is $f(2,2)=-2$, so that this is also the global minimum of $f$ on $D_1$.

\medskip

(b) We now check the boundary of $D_2$. We have $f(x,0)=0$ and $f(0,y)=3y$. Since $3y\to\infty$ as $y\to\infty$, there is no global maximum on $D_2$.

On the hyperbola $xy=16$, we have
$$
f(x,y)=xy(x-2y)+3y=16(x-2y)+3y= \frac{16^2}{y}-32y+3y=\frac{16^2}{y}-29y.
$$
When $y\to \infty$ (therefore $x\to 0$), we have $\frac{16^2}{y}\to 0$, so that $f(\frac{16}{y},y)\to -\infty$ as $y\to\infty$. Hence $f$ attains all values from $-\infty$ to $\infty$ on $D_2$, with no global minimum and no global maximum.

(Notice that as $y\to\infty$, $f\to\infty$ along the line $x=0$ and $f\to -\infty$ along the hyperbola that approaches the same line! That's how polynomial functions can behave.)











\end{enumerate}

