Lagrangian Duality

A large class of constrained optimization problems can be written in the primal form

p^* = \min_{x \in X} \quad & f_0(x) \\ \text{s.t.} \quad & f_i(x) \le 0, \quad i=1,\ldots,m, \\ & h_j(x) = 0, \quad j=1,\ldots,k. \end{aligned}$$ Even when this problem is convex, the constraints may make it difficult to solve directly. **Lagrangian duality** handles constraints by embedding them into the objective using multipliers. The **Lagrangian** is defined as $$\mathcal{L}(x,\lambda,\mu) = f_0(x) + \sum_{i=1}^m \lambda_i f_i(x) + \sum_{j=1}^k \mu_j h_j(x),$$ where $\lambda_{i} \ge 0$ are multipliers for inequality constraints and $\mu_{j}$ are unrestricted multipliers for equality constraints. For fixed $(\lambda,\mu)$, minimizing $\mathcal{L}$ over $x$ produces a **lower bound** on the primal objective. This gives the **dual function** $$g(\lambda,\mu) = \inf_{x \in X} \mathcal{L}(x,\lambda,\mu),$$

and the Lagrangian dual problem,

A fundamental property is weak duality, where , meaning the dual problem always provides a lower bound on the primal problem. Any feasible dual variables therefore act as a certificate of optimality.

When the primal problem is convex, stronger results are possible. Slater’s condition ensures that the feasible set has “room” inside its boundary by requiring the existence of some such that for all inequality constraints, while satisfying all equality constraints.

If Slater’s condition holds, then strong duality applies (i.e., ), and optimal dual variables exist.

Under strong duality, optimality can be characterized entirely through the Karush–Kuhn–Tucker (KKT) conditions. A triple is optimal if and only if it meets the following conditions:

  1. Primal feasibility: .
  2. Dual feasibility: .
  3. Complementary slackness: .
  4. Stationarity: .

Complementary slackness encodes the idea that a constraint is either active or its multiplier is zero, while stationarity balances the objective gradient against the gradients of active constraints.

In the unconstrained convex case, the KKT conditions reduce to , which is both necessary and sufficient for global optimality. For non-convex problems, KKT conditions remain necessary but are no longer sufficient; they become first-order necessary optimality conditions.

Lagrangian duality is closely related to convex relaxation. If the feasible set is non-convex, replacing it with a convex superset yields a relaxed problem whose optimal value lower-bounds the original. Duality formalizes this idea: the dual problem searches over the best possible convex lower bounds.

KKT Examples

KKT Conditions I

Consider the convex problem

\min_{x \in \mathbb{R}^4} \quad & x_1^2 + x_2^2 + x_3^2 + x_4^2 \\\ \text{s.t.} \quad & x_1 + x_2 + x_3 + x_4 = 1. \end{aligned}$$ >[!example]- Write down the KKT conditions and compute the optimal solution. >We have that >$$\mathcal{L}(x, \mu) = x_{1}^2 + x_2^2 + x_3^2 + x_4^2 + \mu(x_1 + x_2 + x_3 + x_4-1)$$. >Therefore, >$$\nabla \mathcal{L} = \begin{bmatrix}2x_{1}+\mu \\ 2x_{2}+\mu \\ 2x_{3} + \mu \\ 2x_{4} + \mu\end{bmatrix}=0,$$ >such that $x_{1}^*=x_{2}^*=x_{3}^*=x_{4}^*=-\mu^* / 2$. >Substituting into the equality constraint, we obtain >$$4 \cdot (-\mu^* / 2) = 1 \iff \mu^* = -\frac{1}{2}.$$ >Therefore, $x_{1}^*=x_{2}^*=x_{3}^*=x_{4}^*=1 / 4$.

KKT Conditions II

Consider the convex problem

Equality-Constrained Least Squares (KKT Conditions III)

Consider the equality constrained least-squares problem

where with and with .

KKT Conditions IV

Consider the optimization problem

Markov Transition Probabilities (KKT Conditions V)

Consider the optimization problem

\max_{x \in \mathbb{R}^n} \quad & \sum_{i=1}^n \alpha_i \log(x_i) \\ \text{s.t.} \quad & x_i \ge 0, \quad i = 1,2,\ldots,n, \\ & \sum_{i=1}^n x_i = c . \end{aligned}$$ where $\alpha_{1}, \ldots, \alpha_{n}$ and $c$ are strictly positive constants. Problems of this form arise in maximum-likelihood estimation of the transition probabilities of discrete-time Markov chains. >[!example]- Show that Slater's condition holds. >We can set each $x_{i}=c / n$. Then, both constraints are strictly satisfied since $c>0$. >[!example]- Write the KKT conditions for this problem. >We know that $\log$ is concave. As such, $-\log$ is convex. We have: >$$\begin{align} >f_{0}(x)&=-\sum_{i=1}^{n}\alpha_{i}\log(x_{i}) \\ >f_{i}(x)&=-x_{i}, \quad i=1,2,\ldots,n \\ >h(x) &= 1^Tx-c. >\end{align}$$ >The gradients become: >$$\begin{align} >\nabla f_{0}(x) &= \begin{bmatrix}-\alpha_{1} / x_{1} & \ldots & -\alpha_{n} / x_{n}\end{bmatrix}^T &\\ >\nabla f_{i}(x) &= -e_{i}, & i = 1,2,\ldots, n \\ >\nabla h_{i}(x) &= 1. >\end{align}$$ >Here, $-e_{i}$ is the negative of the standard basis vector with $1$ at position $i$ and zeros everywhere else. Now, let $x^* \in \mathbb{R}^n$ be a global minimum of the convex problem. Then, $x^*$ must satisfy: >$$\begin{align} >(1) & \quad f_{i}(x) \leq 0 \quad \text{and} \quad h(x)=0 \\ >(2) & \quad \lambda_{i}^* \geq 0 \\ >(3) & \quad \lambda_{i}^{*}f_{i}(x)=0 \\ >(4) & \quad \nabla \mathcal{L}(x, \lambda, \mu)=0 >\end{align}$$ >We check that stationarity is satisfied: >$$\nabla \mathcal{L}(x, \lambda, \mu) =-\alpha_{i} / x_{i}-\lambda_{i}+\mu \quad i=1,\ldots,n.$$ >[!example]- Show that the Lagrange multipliers for the inequality constraints are all zero while the Lagrange multiplier for the equality constraint is equal to $-\frac{{\alpha_{1}+\ldots+\alpha_{n}}}{c}$ (note that depending on your choice of $h$ you may also get $\frac{{\alpha_{i}+\ldots+\alpha_{n}}}{c}$). >Take a look at $(3)$ stationarity from the previous subpart. Either $f_{i}(x)=-x_{i}=0$ or $\lambda_{i}^*=0$. However, $x_{i}=0$ is not valid if you take a look at condition $(4)$, since each $x_{i}$ is a denominator, and therefore the stationary condition will be undefined. As such, all $\lambda_{i}^{*}=0$. Stationarity then simplifies to: >$$-\alpha_{i} / x_{i}+\mu=0 \iff x_{i}=\alpha_{i} / \mu.$$ >Plug this into $h$: >$$\sum^{n}_{i=1}\alpha_{i} / \mu - c = 0 \iff \mu = \frac{1}{c}\sum^{n}_{i=1}\alpha_{i}.$$ >[!example]- By solving the KKT conditions, find all optimal solutions $x^*$ of the optimization problem, and calculate the optimal objective.

Duality Examples

Strong or Weak Duality?

Consider the optimization problem

\min_{(x,y)\in \mathcal{D}} \quad & e^{-x} \
\text{s.t.} \quad & \frac{x^2}{y} \le 0,
\end{aligned}$$

where .

Show that the problem is convex. are convex by design. For the objective, we compute the gradient:

Exponential functions