Let \begin{align*} \mathcal{P} : &\min_{x}~& (x + a)^2 \\ & s.t. & x + b \leq 0 \end{align*}
where $ a, b \in \mathbb{R} $. I would like to find $ x $.
My attempt: The Lagrangian is $ L_\pi = |x + a|^2 + \pi (x + b) $.
Stationarity: $ x + a + \pi = 0 $
Complementary slackness: $ \pi (x + b) = 0 $
- Replacing $ x = -\pi - a $ in $ \pi (x + b) = 0 $, we obtain that $ \pi (-\pi - a + b) = 0 $.
This is the point where I am not able to continue. I get two roots por $ \pi $ but I am unable to realize which one I should use to get $ x $.
No need for big words and complicated methods.
Clearly, the minimum of $(x+a)^2$ with no conditions is reached at $x=-a$, since $(-a+a)^2=0$, and $(x+a)^2\geq 0$.
Now, simply separate two cases. One where $-a+b\leq 0$, and another where $-a+b>0$.
Case $1$: If $a\geq b$, then $x_0=-a$ satisfies the condition $x+b\leq 0$, and the minimum is $0$.
Case $2$: If $a<b$, then $(x+a)^2$ is a strictly decreasing function on $(-\infty, -b]$ (i.e., where $x+b\leq 0$), which means that the minimum is reached at $x_0=-b$.