Minimize $x^2$ such that $x\leq3$

299 Views Asked by At

I am confused about the solution to this constrained optimization problem.

$$\text{Minimize } x^2 \text{ such that } x\leq3$$

$$x\leq3 \iff x-3\leq0$$

Hence we want $x-3$ to be small.

Therefore, we need to minimize $$p=x^2 + \lambda(x-3)$$

$$\dfrac{\partial p}{\partial x} = 2x + \lambda $$

$$\dfrac{\partial p}{\partial x} =0 \iff x=\dfrac{-\lambda}{2}$$

Define $$d = \left (\dfrac{-\lambda}{2}\right )^2 + \lambda\left(\dfrac{-\lambda}{2}-3\right) = -3\lambda -\dfrac{\lambda^2}{4}$$

$$\dfrac{\partial d}{\partial \lambda}=-3-\dfrac{\lambda}{2}$$

$$\dfrac{\partial d}{\partial \lambda}=0 \iff \lambda=-6$$

$$\lambda=-6 \implies x=-3$$

The correct solution however is $x=0$. What am I missing? Using the same method and reversing the constraint to $x\geq3$ gives the correct answer for that case. Is it that we needed $\lambda \geq0$? In such a case must that also be reflected by a Lagrange term in the primal?

2

There are 2 best solutions below

1
On

One mistake is in the very beginning: "$x\leq3 \iff 3-x\color{red}{\leq}0$" is not true; instead, it must be "$x\leq3 \iff 3-x\geq0$".

0
On

While you can use Lagrange multipliers to solve problems of this type, in this case the solution is almost trivial. The global minimum of $f(x)=x^2$ is achieved at $x=0$. Your constraint $x \leq 3$ is clearly satisfied by $x=0$, so you have your answer.

By adding a slack variable $\lambda \geq 0$, we can rewrite the problem as $\min x^2$ subject to $x+\lambda=3$. Now we can write the Lagrangian as:

$L(x,\lambda) = x^2 + \lambda(x-3)$.

$\frac{\partial}{\partial x} L(x,\lambda) = 2x + \lambda = 0$, i.e. $\lambda = -2x$.

By complementary slackness, $\lambda(x-3)=0$, implying $-2x(x-3)=0$. The solutions to this equation are $x=0$ and $x=3$. Setting $x=3$ would make $\lambda=6<0$. Since $\lambda \geq 0$, the only viable solution is $x=0$.