KKT conditions with equality max(|x1|,|x2|)

I'm learning how to solve optimization problems with constraints, but im confused about applying the KKT conditions for the following problem

$$\begin{array}{ll} \text{minimize} & f(x_1, x_2)\\ \text{subject to} & \max \left( |x_1|,|x_2| \right) = 3\end{array}$$

I guess the Lagrangian will be

$$L = f(x_1,x_2) - \lambda (\max(|x_1|,|x_2|)-3)$$

I am not sure how to continue with taking the derivative w.r.t x1, x2, and $$\lambda$$.

I know that $$\max(|x_1|,|x_2|)=3$$ is a square with $$-3 \leq x_1 \leq 3$$ and $$-3 \leq x_2 \leq 3$$.

• If the constraint is an equality, why use KKT? Commented Jun 22, 2020 at 11:50
• Are you sure that $\max(|x_1|,|x_2|)=3$ is a square? Commented Jun 22, 2020 at 11:56
• Yes, it is a square of lines so to say (only the boundaries count) Commented Jun 22, 2020 at 12:01
• The $-3 \leq x_1 \leq 3$ and $-3 \leq x_2 \leq 3$ part suggests the interior matters, too. You can rewrite the constraint using the $\infty$-norm. Commented Jun 22, 2020 at 12:06

Solve it in four parts (the $$\pm$$ gives two choices for both ways of $$\{j, k\} = \{1,2\}$$):
$$\begin{array}{ll} \text{minimize} & f(x_1, x_2)\\ \text{subject to} & x_j = \pm 3 \\ & x_k \leq 3 \\ & -x_k \leq 3 \end{array}$$
Actually, since you have the condition, for example in the first case, that $$x_1=3$$ and $$-3 \leq x_2 \leq 3$$, you might just want to plug $$x_1=3$$ into $$f$$ and get a single variable function to minimize on $$[-3, 3]$$.