Finding min and max of $f(x,y)=-(x-y)^2+x$ in the region $(x,y)\in [0,1]\times[0,1]$.

123 Views Asked by At

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

3

There are 3 best solutions below

0
On BEST ANSWER

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$$

0
On

Simply evaluate the function in the corners points $f(0,0),f(0,1),f(1,0),f(1,1)$ and compare those values with the others possible max/min values you have found on the edge boundaries $E_1,E_2,E_3,E_4$. Finally select the maximum and minimum among them.

3
On

This problem can be handled easily without the contributuin of the Lagrange multipliers making the substitution

$$ x =\frac{1}{2}(\sin(u)+1)\\ y =\frac{1}{2}(\sin(v)+1) $$

and then the new problem is in the variables $u,v$ now without restrictions

$$ \min/\max f(u,v) = \frac{1}{4} \left(2 \sin (u) (\sin (v)+1)-\sin ^2(u)-\sin ^2(v)+2\right) $$

In the variables $x, y$ can be handled introducing four slack variables to avoid the inequality restrictions.

$$ L(x,y,\lambda,\epsilon) = f(x,y)+\sum_k \lambda_k g_k(x,y,\epsilon_k) $$

with

$$ \lambda =(\lambda_1,\cdots,\lambda_4)\\ \epsilon = (\epsilon_1,\cdots,\epsilon_4)\ \ \mbox{(slack)}\\ f(x,y) = -(x-y)^2+x\\ g_1(x,y,\epsilon_1) = x -\epsilon_1^2=0\\ g_2(x,y,\epsilon_2) = x-1+\epsilon_2^2=0\\ g_3(x,y,\epsilon_3)=y-\epsilon_3^2=0\\ g_4(x,y,\epsilon_4) = y-1+\epsilon_4^2=0 $$

giving the solutions

$$ \begin{array}{ccccccccccc} x & y & \lambda_1 &\lambda_2 & \lambda_3 & \lambda_4&\epsilon_2 &\epsilon_2&\epsilon_3&\epsilon_4&f(x,y)\\ 0 & 0 & -1 & 0 & 0 & 0 & 0 & -1 & 0 & -1 & 0 \\ 0 & 1 & -3 & 0 & 0 & 2 & 0 & -1 & -1 & 0 & -1 \\ 1 & 1 & 0 & -1 & 0 & 0 & -1 & 0 & -1 & 0 & 1 \\ \frac{1}{2} & 0 & 0 & 0 & -1 & 0 & -\frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 0 & -1 & \frac{1}{4} \\ \end{array} $$

Note that the minimum is located at the corner $(0,1)$ and the maximum is located at $(1,1)$ Note also that when the restriction is active the corresponding $\epsilon$ is null