Consider the scalar field defined by
$$f(x,y)=\begin{cases}{(x+2y)}^2&\text{if}&(x,y)\neq(1,1)\\2&\text{if}&(x,y)=(1,1)\end{cases}.$$
Analyze the existence of extremes in the square $$R=\left\{(x,y)\in\mathbb R^2\mid-2\leq x\leq 2,\quad -2\leq y\leq 2\right\}.$$
First of all: The domain of $f$ is $\mathbb R^2$. For $(x,y)\neq(1,1) \;f$ is $C^\infty(\mathbb R^2)$ because is a polynomial. However, in the point $(x,y)=(1,1)$ the function is not continouos because $f(1,1)=2$ but $\lim_{(x,y)\to(1,1)}{f(x,y)}=\lim_{(x,y)\to(1,1)}{(x+2y)^2}=9\neq 2$, hence $f$ is not differentiable at $(1,1)$ and therefore the function has no stationary critical points there. $\color{red}{\text{(Is a maximum, minimum?)}}$
Then evaluating in $(x,y)\neq(1,1)$ $$\nabla f(x,y)=(0,0)\quad\Rightarrow\qquad(2x+4y,\;2y+4x)=(0,0)\quad\Rightarrow\quad y=-\dfrac x2,$$
so in the points of the form $(x,-\frac x2)$ (especially in $[-2,2]$) there are infinite absolute minimums, of value $f(x,-\frac x2)={\left(x+2(-\frac x2)\right)}^2=(x-x)^2=0.$
Then the ends of the square must be evaluated:
- If $y=2$:
$$g_1(x)=x^2+8x+16,\quad x\in[-2,2]\quad\Rightarrow\quad g'_1(x)=2x+8\quad\Rightarrow\quad g'_1(x)=0\quad\Rightarrow\quad x=-4\not\in[-2,2].$$
- If $y=-2$:
$$g_2(x)=x^2-8x+16,\quad x\in[-2,2]\quad\Rightarrow\quad g'_2(x)=2x+8\quad\Rightarrow\quad g'_2(x)=0\quad\Rightarrow\quad x=4\not\in[-2,2].$$
- If $x=2$:
$$g_3(y)=4y^2+8y+4,\quad y\in[-2,2]\quad\Rightarrow\quad g'_3(y)=8y+8\quad\Rightarrow\quad g'_3(y)=0\quad\Rightarrow\quad y=-1\in[-2,2].$$
So $\quad\begin{cases}g_3(-1)=0\\g_3(-2)=4\\g_3(2)=36\end{cases}\quad\Rightarrow\quad$ note that $-1$ is the minimum and $2$ is the maximum of $g_3(y)$. Hence $$(2,-1,f(2,-1))=(2,-1,0)\text{ is the minimum over }x=2\\(2,2,f(2,2))=(2,2,36)\text{ is the maximum over }x=2.$$
- If $x=-2$:
$$g_4(y)=4y^2-8y+4,\quad y\in[-2,2]\quad\Rightarrow\quad g'_4(y)=8y-8\quad\Rightarrow\quad g'_4(y)=0\quad\Rightarrow\quad y=1\in[-2,2].$$
So $\quad\begin{cases}g_4(1)=0\\g_4(-2)=36\\g_4(2)=4\end{cases}\quad\Rightarrow\quad$ note that $1$ is the minimum and $-2$ is the maximum of $g_4(y)$. Hence $$(-2,1,f(-2,1))=(-2,1,0)\text{ is the minimum over }x=-2\\(-2,-2,f(-2,-2))=(-2,-2,36)\text{ is the maximum over }x=-2.$$
$\color{red}{\text{Hence, I have }4\text{ points that I don't know what to do:}}$ $$(2,-1,0)\\(2,2,36)\\(-2,1,0)\\(-2,-2,36)$$
Which is the absolute MIN and which is the absolute MAX of the function $f$?
Are my reasoning OK? Can you answer the highlighted text please?
Thank you so much!
