I have a two variable function: $$f(x,y)=-(x-y)^2+x\, .$$ I need to find its absolute minimum and maximum under the constraints: $(x,y)\in [0,1]\times[0,1]$. The partial derivatives of$f$ do not vanish in the same points and then the maximum (and minimum) have to be to find on the edge: $E_1=\{x\in[0,1], y=0\}$, $E_2=\{x\in[0,1], y=1\}$, $E_3=\{y\in[0,1], x=0\}$, $E_4=\{y\in[0,1], x=1\}$. Then we must consider $f(x,0)$, $f(x,1)$ etc and find min and max of them.
My problems are in the corners of the square $(x,y)\in [0,1]\times[0,1]$. What shall I say about $(0,0)$, $(0,1)$, $(1,0)$ and $(1,1)$?
Thanks in advance
Maximum is attained at $(1,1)$ with $f(1,1) = 1$.
Indeed, if $x < 1$ then $$f(x,y) = \underbrace{-(x-y)^2}_{\le 0} + \underbrace{x}_{< 1} < 1$$ If $x = 1$ and $y < 1$ then $$f(x,y) = \underbrace{-(1-y)^2}_{< 0} + 1 < 1$$
Minimum is attained at $(0,1)$ with $f(0,1) = -1$.
Indeed, if $y < 1$ then
$$f(x,y) = \underbrace{-(x-y)^2}_{> -1} + \underbrace{x}_{\ge 0} > -1$$
If $y = 1$ and $x > 0$ then
$$f(x,y) = \underbrace{-(x-1)^2}_{\ge -1} + \underbrace{x}_{> 0} > -1$$