Find the maximum and minimum values of this function.
Solution 1:
Since $$ \nabla f(x,y)=(0.0) \iff (x,y) =(\pm2.0) \notin D, $$ the maximum and minimum of $f$ on $D$ can only be achieved on the boundary $\partial D$.
The consists of $$ L=\{(x,y): x-1, -1 |y| \le 1\} $$ and $$ C=\{(x,y): (x-1)^2+y^2=1, 0\le x\le 1\}=\varphi\left(\left[\frac{3\pi}{2}m\frac{\pi}{2}\right]\right), $$ with $$ \varphi(t)=(1+\cos t, \sin t). $$ THe restrection, $f_{|L}$ of $f$ on $L$ given by $$ f(1,y)=y^2-22, $$ satisfies $$ f(1,0)=-22=f(1,0)\le f_{|L}*x,y)\le -21=f(1,\pm1) \quad \forall (x,y)\in L. $$
To find the maximum/minimum of $f$ ob $C$, we can use the method of Lagrange multipliers.
Consider the function defined by
$$ F(x,y,\lambda)=f(x,y)-\lambda [(x-1)^2+y^2-1]. $$ At a critical point $(x,y) \in C$, the gradient of $F$ [w.r.t $(x,y)$] must be $(0,0)$, i.e.
\begin{eqnarray} 6x^2-24 &=& 2\lambda(x-1)\cr 2y&=&2\lambda y \end{eqnarray} We have $$ 2y=2\lambda y \iff \lambda=1 \quad or \quad y=0. $$
If $\lambda =1$, thrn $$ 6x^2-24=2(x-1) \iff x=\frac{-1\pm\sqrt{133}}{6} \notin [0,1] $$
If $y=0$, then thanks to the constraint we get $x=0$ or $x=1$. In particular, if $x=0$, then $\lambda=12$.
Since $f(0.0)=0$, we have $$ \min_{D}f=-22,\qyad \max_{D}f=0. $$