How could I solve the following optimization problem using Lagrangian multipliers?
$$\min_{a \le x \le b} f(x)$$
Can I just rewrite it as the Lagrangian as following?
$$\min f(x)+y_{1}(a-x)+y_{2}(x-b)$$
If I differentiate with respect to $y_{1},y_{2}$ and make them equal to $0$, I got $x=a,x=b$. Can anyone help me? Thanks very much in advance!
Since $a \leq x \leq b$ is equivalent to the conjunction of $x - a \geq 0$ and $b - x \geq 0$, we introduce slack variables $s_1$ and $s_2$ such that
$$x - a = s_1^2$$
$$b - x = s_2^2$$
Assuming that $f$ is differentiable, we define the Lagrangian
$$\mathcal L (x, s_1, s_2, \mu_1, \mu_2) := f (x) + \mu_1 (x - s_1^2 - a) + \mu_2 (-x - s_2^2 + b)$$
Taking the partial derivatives and finding where they vanish, we eventually obtain the following system of equations
$$\begin{array}{rl} f ' (x) &= \mu_2 - \mu_1\\ \mu_1 s_1 &= 0\\ \mu_2 s_2 &= 0\\ x &= a + s_1^2\\ x &= b - s_2^2\end{array}$$
Note that, unless $a = b$, the slack variables $s_1$ and $s_2$ cannot simultaneously be zero. However, whenever $s_i \neq 0$, we have $\mu_i = 0$. Hence, if $a < x < b$, then $\mu_1 = \mu_2 = 0$.