I want to find the maximum of $$f(x_1, x_2)=-(x_1+3)^2-(x_2-2)^2$$ under the constraints $x_1, x_2\geq 0$.
I thought to calculate the extrema as we would not have constraints and we pink only the positive $x_i$'s.
Is this correct?
I want to find the maximum of $$f(x_1, x_2)=-(x_1+3)^2-(x_2-2)^2$$ under the constraints $x_1, x_2\geq 0$.
I thought to calculate the extrema as we would not have constraints and we pink only the positive $x_i$'s.
Is this correct?
For this problem (due to convexity as pointed out by Alex) the KKT conditions are necessary and sufficient. The Lagrangian is: $$L(x,y) = -(x_1+3)^2-(x_2-2)^2+y_1 x_1 + y_2 x_2$$ The KKT conditions are therefore: $$-2(x_1+3) + y_1 = 0$$ $$- 2(x_2-2) + y_2 = 0$$ $$x_1 y_1 = 0$$ $$x_2 y_2 = 0$$ $$x,y \geq 0$$ If $y_1=0$, $x_1 = -3<0$, so $y_1 > 0$, which is a contradiction. Therefore $x_1=0$ and $y_1=6$. If $x_2=0$, $y_2=-4<0$, which is a contradiction. Therefore, $x_2 > 0$, $y_2=0$, $x_2 = 2$. So, $x=(0,2)$ is the optimal solution.
Let $g(x_1,x_2) = -f(x_1,x_2) = (x_1 +3)^2 +(x_2 -2)^2$. Maximize $f(x_1,x_2)$ is equivalent to minimize $g(x_1,x_2)$.
Notice that $g(x_1,x_2) \geq 0, \forall x_1,x_2 \in \mathbb{R}.$ Because $g$ is strictly convex, you can solve the unconstrained problem and project the negative solutions to the zero value. The minimum of $g$ is zero when $x_1 = -3$ and $x_2 = 2$.
Thus, the maximum value of $f$ under the constraints $x_1,x_2 \geq 0$ is attained when $x_1 = 0$ and $x_2 = 2.$