I have the following optimization problem:
\begin{align*} \min_{x} \quad & f(x) = x^2 - 2x + 3 \\ \text{s.t.} \quad & g_1(x) = x - 1 \geq 0 \\ & g_2(x) = -x + 2 \geq 0 \end{align*}
Since there are inequalities in both constraints function I have to use KKT conditions.
The Lagrangian for this problem is:
$$L(x,\lambda_1,\lambda_2)=x^2-2x+3+\lambda_1(x-1)+\lambda_2(-x+2)$$
where $\lambda_1$ and $\lambda_2$ are the Lagrange multipliers for the two constraints.\ \ The KKT conditions for this problem are:
1) Stationarity: $\frac{\partial L}{\partial x} = 2x - 2 + \lambda_1 - \lambda_2 = 0$
2) Primal feasibility: $g_1(x) = x - 1 \geq 0$ and $g_2(x) = -x + 2 \geq 0$
3) Dual feasibility: $\lambda_1 \geq 0$ and $\lambda_2 \geq 0$
4) Complementary slackness: $\lambda_1 g_1(x) = 0$ and $\lambda_2 g_2(x) = 0$
I can use the stationarity condition to solve for $x$ in terms of $\lambda_1$ and $\lambda_2$:
\begin{align*} 2x - 2 + \lambda_1 - \lambda_2 &= 0 \\ 2x &= 2 - \lambda_1 + \lambda_2 \\ x &= 1 - \frac{1}{2} \lambda_1 + \frac{1}{2} \lambda_2 \end{align*}
I can substitute this expression for $x$ into the primal feasibility constraints to get:
\begin{align*} g_1(x) &= x - 1 \geq 0 \\ 1 - \frac{1}{2} \lambda_1 + \frac{1}{2} \lambda_2 - 1 &\geq 0 \\ -\frac{1}{2} \lambda_1 + \frac{1}{2} \lambda_2 &\geq 0 \\ \end{align*}
and
\begin{align*} g_2(x) &= -x + 2 \geq 0 \\ -1 + \frac{1}{2} \lambda_1 - \frac{1}{2} \lambda_2 + 2 &\geq 0 \\ \frac{1}{2} \lambda_1 - \frac{1}{2} \lambda_2 &\geq -1 \\ \end{align*}
Next, i can use the complementary slackness condition to simplify the primal feasibility constraints:
\begin{align*} \lambda_1 g_1(x) &= 0 \\ \lambda_1 (1 - \frac{1}{2} \lambda_1 + \frac{1}{2} \lambda_2 - 1) &= 0 \\ \lambda_1 (\frac{1}{2} \lambda_2 - \frac{1}{2} \lambda_1) &= 0 \\ \end{align*}
If $\lambda_1 = 0$, then we have $\frac{1}{2} \lambda_2 \geq 0$ and $\frac{1}{2} \lambda_1 \leq 0$, which implies that $\lambda_2 \geq 0$ and $\lambda_1 = 0$. This means that the first constraint is inactive and the second constraint is active.
If $\lambda_2 = 0$, then i have $\frac{1}{2} \lambda_1 \leq 0$ and $-\frac{1}{2} \lambda_2 \geq 0$, which implies that $\lambda_1 \leq 0$ and $\lambda_2 = 0$. This means that the first constraint is active and the second constraint is inactive.
If $\lambda_1 > 0$ and $\lambda_2 > 0$, then we have $\frac{1}{2} \lambda_2 > 0$ and $\frac{1}{2} \lambda_1 > 0$, which implies that $\lambda_2 > 0$ and $\lambda_1 > 0$. This means that both constraints are active.
Putting everything together, i have three cases to consider:
Case 1: $\lambda_1 = 0$, $\lambda_2 > 0$
In this case, the objective function is minimized at $x = 1$, and the minimum value is $f(1) = 2$. The first constraint is inactive and the second constraint is active.
Case 2: $\lambda_1 > 0$, $\lambda_2 = 0$
In this case, the objective function is minimized at $x = 2$, and the minimum value is $f(2) = 3$. The first constraint is active and the second constraint is inactive.
Case 3: $\lambda_1 > 0$, $\lambda_2 > 0$
In this case, the objective function is minimized at $x = 1$, and the minimum value is $f(1) = 2$. Both constraints are active.
Therefore, the optimal solution is: \begin{align*} x^* &= 1 \quad \text{if} \quad \lambda_1 > 0 \quad \text{and} \quad \lambda_2 > 0 \\ &= 2 \quad \text{if} \quad \lambda_1 > 0 \quad \text{and} \quad \lambda_2 = 0 \\ &= 1 \quad \text{if} \quad \lambda_1 = 0 \quad \text{and} \quad \lambda_2 > 0 \end{align*}
and the optimal Lagrange multipliers are:
\begin{align*} \lambda_1^* &= 0 \quad \text{if} \quad x^* = 1 \\ &> 0 \quad \text{otherwise} \\ \lambda_2^* &= 0 \quad \text{if} \quad x^* = 2 \\ &> 0 \quad \text{otherwise} \end{align*}
This completes the solution of the optimization problem using the KKT conditions.
Am I correct ? (I don't know why the begin{align*} don't work here and I apologize for it)