Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Lagrangians and KKT practice

Original practice questions (PDF)

Lagrangians, duals, and Slater’s condition

For each primal problem, give its Lagrangian, dual function, and dual problem (including its feasible set). Determine whether the primal is convex, whether Slater’s condition holds, and whether the optimal values agree. For Slater’s condition, use the course refinement that allows affine inequalities to hold with equality.

1. Minimum-norm point with linear inequalities

Minimize 12∥x∥22\tfrac12\|x\|_2^2 over x∈ℝnx\in\mathbb R^n subject to Ax≥bAx\ge b, where A∈ℝm×nA\in\mathbb R^{m\times n} and b∈ℝmb\in\mathbb R^m.

Solution to exercise 1

With λ≥0\lambda\ge0, L(x,λ)=12∥x∥22+λ⊺(b−Ax),g(λ)=b⊺λ−12∥A⊺λ∥22. L(x,\lambda)=\tfrac12\|x\|_2^2+\lambda^\intercal(b-Ax), \qquad g(\lambda)=b^\intercal\lambda-\tfrac12\|A^\intercal\lambda\|_2^2. The infimum is attained at x=A⊺λx=A^\intercal\lambda. The dual maximizes gg over λ≥0\lambda\ge0. The primal is convex and all constraints are affine, so feasibility suffices for the refined Slater condition and equal optimal values. The unrefined strict test would require Ax>bAx>b, which depends on A,bA,b.

2. Minimizing a concave quadratic

Minimize −x2-x^2 over x∈ℝx\in\mathbb R subject to x2≤1x^2\le1.

Solution to exercise 2

For λ≥0\lambda\ge0, L=(λ−1)x2−λL=(\lambda-1)x^2-\lambda. Thus g(λ)=−λg(\lambda)=-\lambda if λ≥1\lambda\ge1, and g(λ)=−∞g(\lambda)=-\infty otherwise. The dual maximizes −λ-\lambda over λ≥1\lambda\ge1, attaining −1-1 at λ=1\lambda=1. The concave objective makes the problem nonconvex. The point x=0x=0 is strictly feasible, and the primal attains −1-1 at x=±1x=\pm1, so the two values agree by direct calculation.

3. Entropy on a constrained simplex

Minimize ∑i=1nxilog⁡xi\sum_{i=1}^n x_i\log x_i subject to Ax≤bAx\le b and 𝟏⊺x=1\mathbf 1^\intercal x=1. Nonnegativity is included among the inequalities. Use the closed entropy convention 0log⁡0=00\log0=0, with domain x≥0x\ge0.

Solution to exercise 3

Let F(x)=∑ixilog⁡xiF(x)=\sum_i x_i\log x_i on the nonnegative orthant. For λ≥0\lambda\ge0 and ν∈ℝ\nu\in\mathbb R, L=F(x)+λ⊺(Ax−b)+ν(𝟏⊺x−1). L=F(x)+\lambda^\intercal(Ax-b)+\nu(\mathbf 1^\intercal x-1). For a scalar coefficient aa, the minimum of ulog⁡u+auu\log u+au on u≥0u\ge0 is −e−1−a-e^{-1-a} at u=e−1−au=e^{-1-a}. The dual therefore maximizes g(λ,ν)=−b⊺λ−ν−∑iexp⁡(−1−(A⊺λ)i−ν) g(\lambda,\nu)=-b^\intercal\lambda-\nu-\sum_i\exp\!\big(-1-(A^\intercal\lambda)_i-\nu\big) over those multiplier domains. The primal is convex. A feasible x>0x>0 satisfies refined Slater because the constraints are affine and xx lies in the relative interior of the entropy domain. Such a point depends on the data. For any feasible instance the optimal values agree even if every feasible point has a zero coordinate. The convex perturbation value function is closed at zero because the perturbed sum constraint bounds all nearby feasible nonnegative vectors. Boundary-only feasibility can prevent attainment of the dual supremum.

4. A redundant quadratic inequality

Minimize xx over x∈ℝx\in\mathbb R subject to x2≥0x^2\ge0.

Solution to exercise 4

For λ≥0\lambda\ge0, L=x−λx2L=x-\lambda x^2 and g(λ)=−∞g(\lambda)=-\infty for every λ\lambda, so the dual has empty effective domain. The feasible set is all of ℝ\mathbb R. The displayed constraint function −x2-x^2 is concave, though dropping the redundant constraint gives an equivalent convex problem. Any x≠0x\ne0 is strictly feasible. The primal is unbounded below and both extended-real values are −∞-\infty.

5. The domain of a quotient

Minimize exe^x subject to x4/y≤1x^4/y\le1 on its written domain x∈ℝx\in\mathbb R, y≠0y\ne0. What changes if the intended domain is y>0y>0?

Solution to exercise 5

For either domain L=ex+λ(x4/y−1)L=e^x+\lambda(x^4/y-1), λ≥0\lambda\ge0. On y≠0y\ne0, a fixed nonzero xx and y→0−y\to0^- give g(λ)=−∞g(\lambda)=-\infty for λ>0\lambda>0. At λ=0\lambda=0, g(0)=0g(0)=0. The dual effective domain is {0}\{0\}, and both optimal values are 0, since any xx is feasible with y<0y<0. The primal domain is disconnected and the feasible set is nonconvex. A strictly feasible point exists, such as (0,1)(0,1).

With y>0y>0, the constraint is equivalent to x4−y≤0x^4-y\le0, a convex inequality, and (0,1)(0,1) satisfies Slater. For the original quotient Lagrangian restricted to y>0y>0, the dual function is −λ-\lambda because both nonnegative terms exe^x and λx4/y\lambda x^4/y can approach zero. The dual maximizes −λ-\lambda over λ≥0\lambda\ge0 and again gives the primal infimum 0. Neither primal infimum is attained.

6. Minimum norm with a residual bound

Minimize 12∥x∥22\tfrac12\|x\|_2^2 over x∈ℝnx\in\mathbb R^n subject to ∥Ax−b∥2≤r\|Ax-b\|_2\le r.

Solution to exercise 6

For λ≥0\lambda\ge0, L=12∥x∥22+λ(∥Ax−b∥2−r)L=\tfrac12\|x\|_2^2+\lambda(\|Ax-b\|_2-r). Use λ∥z∥2=max⁡∥v∥2≤λv⊺z\lambda\|z\|_2=\max_{\|v\|_2\le\lambda}v^\intercal z and minimize the resulting quadratic in xx at −A⊺v-A^\intercal v. The quadratic-plus-norm minimizer has a norm subgradient giving a maximizing vv, so g(λ)=−λr+max∥v∥2≤λ{−12∥A⊺v∥22−b⊺v}. g(\lambda)=-\lambda r+\max_{\|v\|_2\le\lambda} \big\{-\tfrac12\|A^\intercal v\|_2^2-b^\intercal v\big\}. The dual can maximize the displayed expression jointly subject to ∥v∥2≤λ\|v\|_2\le\lambda. For r≥0r\ge0, one can eliminate λ\lambda by taking λ=∥v∥2\lambda=\|v\|_2.

The primal is convex. Slater holds exactly when some residual has norm less than rr. If the instance is feasible, the optimal values also agree at a boundary-only radius. The convex perturbation value function is closed at zero since the squared norm bounds any sequence of near-minimizers. A finite dual multiplier need not exist at that boundary.

7. Entropy with equality constraints

Minimize ∑i=1nxilog⁡xi\sum_{i=1}^n x_i\log x_i subject to Ax=bAx=b and x≥0x\ge0, with 0log⁡0=00\log0=0.

Solution to exercise 7

Keep x≥0x\ge0 in the entropy domain. With free multiplier ν∈ℝm\nu\in\mathbb R^m, L=∑ixilog⁡xi+ν⊺(Ax−b)L=\sum_i x_i\log x_i+\nu^\intercal(Ax-b). The dual maximizes g(ν)=−b⊺ν−∑iexp⁡(−1−(A⊺ν)i) g(\nu)=-b^\intercal\nu-\sum_i\exp\!\big(-1-(A^\intercal\nu)_i\big) over ℝm\mathbb R^m. The primal is convex. A feasible x>0x>0 satisfies the relative-interior qualification, which depends on A,bA,b. If the instance is feasible, the values agree even without that qualification because the entropy objective is continuous and coercive on the orthant. Thus bounded near-minimizers of perturbed equality problems have a feasible limit. The dual supremum need not be attained when the constraints force a zero coordinate.

KKT conditions and constraint qualification

For each problem, write the first-order KKT conditions and check Slater’s condition. Explain what the conditions imply about local or global optimality.

8. A quadratic on the simplex

Minimize 12(x12+x22)\tfrac12(x_1^2+x_2^2) subject to x1+x2=1x_1+x_2=1 and x≥0x\ge0.

Solution to exercise 8

Use free ν\nu for the equality and λ≥0\lambda\ge0 for −x≤0-x\le0. Stationarity is x+ν𝟏−λ=0x+\nu\mathbf 1-\lambda=0. Include primal feasibility and λixi=0\lambda_i x_i=0. The point (1/2,1/2)(1/2,1/2) is strictly feasible for the inequalities. Convexity makes KKT sufficient for global optimality, and Slater makes the conditions necessary. The unique solution is (1/2,1/2)(1/2,1/2).

9. A nonconvex objective on the disk

Minimize x14+x24−3x12x_1^4+x_2^4-3x_1^2 subject to x12+x22≤1x_1^2+x_2^2\le1.

Solution to exercise 9

Use λ≥0\lambda\ge0. The conditions are 4x13−6x1+2λx1=0,4x23+2λx2=0,∥x∥22≤1,λ(∥x∥22−1)=0. 4x_1^3-6x_1+2\lambda x_1=0,\quad 4x_2^3+2\lambda x_2=0,\quad \|x\|_2^2\le1,\quad \lambda(\|x\|_2^2-1)=0. The origin is strictly feasible for the disk, but the convex Slater theorem needs a convex objective. The active constraint has nonzero gradient on the boundary, so KKT is necessary at a local minimizer. The origin satisfies KKT and f(ε,0)<f(0,0)f(\varepsilon,0)<f(0,0) for small nonzero ε\varepsilon, demonstrating that KKT alone is insufficient.

10. A singleton feasible set

Minimize xx subject to x2≤0x^2\le0.

Solution to exercise 10

KKT would require 1+2λx=01+2\lambda x=0, x2≤0x^2\le0, λ≥0\lambda\ge0, and λx2=0\lambda x^2=0. The only feasible point is x=0x=0, which is globally optimal. There is no strictly feasible point and stationarity reads 1=01=0 there, so the optimum has no KKT multiplier.

11. An affine objective and affine inequalities

Minimize x1x_1 subject to x≥0x\ge0 and x1+x2≥1x_1+x_2\ge1.

Solution to exercise 11

With λ≥0\lambda\ge0 for −x≤0-x\le0 and θ≥0\theta\ge0 for 1−x1−x2≤01-x_1-x_2\le0, stationarity is e1−λ−θ𝟏=0e_1-\lambda-\theta\mathbf 1=0. Include primal feasibility, λixi=0\lambda_i x_i=0, and θ(1−x1−x2)=0\theta(1-x_1-x_2)=0. The point (1,1)(1,1) is strictly feasible. KKT characterizes global optima, which are all points (0,x2)(0,x_2) with x2≥1x_2\ge1.

12. A nonlinear equality

Minimize x1x_1 subject to x12+x22=2x_1^2+x_2^2=2.

Solution to exercise 12

With free ν\nu, KKT is e1+2νx=0e_1+2\nu x=0 together with ∥x∥22=2\|x\|_2^2=2. The equality is nonlinear, so the convex Slater theorem does not apply. Its gradient 2x2x is nonzero on the circle, making KKT necessary for a local optimum. Both (2,0)(\sqrt2,0) and (−2,0)(-\sqrt2,0) satisfy stationarity, and the first maximizes x1x_1 while the second minimizes it.

13. A strictly convex constrained quadratic

Minimize (x1−1)2+(x2+2)2(x_1-1)^2+(x_2+2)^2 subject to x1≥0x_1\ge0 and x2+3≥0x_2+3\ge0.

Solution to exercise 13

With λ≥0\lambda\ge0 for the two sign-adjusted inequalities, stationarity is 2(x1−1)−λ1=0,2(x2+2)−λ2=0. 2(x_1-1)-\lambda_1=0,\qquad 2(x_2+2)-\lambda_2=0. Include primal feasibility and λ1x1=λ2(x2+3)=0\lambda_1 x_1=\lambda_2(x_2+3)=0. The unconstrained minimizer (1,−2)(1,-2) is strictly feasible, so Slater holds. It satisfies KKT with zero multipliers, giving the unique global optimum.