Unit 1, lesson 7

Convex optimization and duality

How the Lagrangian of a convex problem gives lower bounds by weak duality, why KKT conditions certify a global minimum, when Slater's condition gives strong duality, and what a binding constraint's multiplier measures.

  • Video 7
  • Calculus, linear algebra, optimization and probability

A trading desk would like to hold 33 units of an exposure, but a risk limit allows at most 11 unit, and in a constructed model the cost of holding xx units is 12(x−3)2\tfrac12 (x - 3)^2, half the squared distance from the target. The capped position of 11 unit looks best, yet a picture is not a proof, and an optimizer that stops there gives no guarantee either. Convex duality supplies a proof that can be checked by hand, in the form of a multiplier attached to the limit, and the same multiplier says how fast the cost falls when the limit is relaxed. This lesson builds the Lagrangian and the lower bounds it produces, proves that the KKT conditions certify a global minimum of a convex problem, and states when Slater’s condition guarantees that such a certificate exists.

Key terms

Convex function

Definition A set C⊆RnC \subseteq \mathbb{R}^n is convex if it contains the segment between any two of its points, that is, tx+(1−t)y∈Ctx + (1 - t)y \in C whenever x,y∈Cx, y \in C and 0≤t≤10 \le t \le 1. A function ff from a convex set CC to R\mathbb{R} is convex if

f(tx+(1−t)y)≤tf(x)+(1−t)f(y)\begin{aligned} &f\bigl(tx + (1 - t)y\bigr) \\[0.4em] &\quad \le t f(x) + (1 - t) f(y) \end{aligned}

for all x,y∈Cx, y \in C and 0≤t≤10 \le t \le 1, and strictly convex if the inequality is strict whenever x≠yx \ne y and 0<t<10 < t < 1. A differentiable ff on Rn\mathbb{R}^n is convex if and only if it lies above each of its tangent planes,

f(y)≥f(x)+∇f(x)⊤(y−x)\begin{aligned} f(y) &\ge f(x) \\[0.4em] &\quad + \nabla f(x)^{\top}(y - x) \end{aligned}

for all xx and yy, and a twice continuously differentiable ff on Rn\mathbb{R}^n is convex if and only if its Hessian is positive semidefinite at every point. So a quadratic 12w⊤Σw+c⊤w\tfrac12 w^{\top} \Sigma w + c^{\top} w with symmetric Σ\Sigma is convex exactly when Σ\Sigma is positive semidefinite.

In this lesson the standard problem is to minimize f(x)f(x) over x∈Rnx \in \mathbb{R}^n subject to gi(x)≤0g_i(x) \le 0 for i=1,…,mi = 1, \dots, m and Ax=bAx = b, where AA is a p×np \times n matrix and b∈Rpb \in \mathbb{R}^p. It is a convex problem when ff and every gig_i are convex and finite on all of Rn\mathbb{R}^n. Its feasible set is then convex, because each set {x:gi(x)≤0}\{x : g_i(x) \le 0\} and the affine set {x:Ax=b}\{x : Ax = b\} are convex and an intersection of convex sets is convex. For a convex problem every local minimizer is a global minimizer. If x∗x^* were a local minimizer and a feasible yy had f(y)<f(x∗)f(y) < f(x^*), then every point x∗+t(y−x∗)x^* + t(y - x^*) with 0<t≤10 < t \le 1 would be feasible with objective at most (1−t)f(x∗)+tf(y)<f(x∗)(1 - t) f(x^*) + t f(y) < f(x^*), and these points come arbitrarily close to x∗x^* as t→0t \to 0. Strict convexity of ff allows at most one minimizer. Neither property guarantees that a minimizer exists, which needs a further argument, for example a continuous objective on a nonempty compact feasible set.

In plain words A convex function never rises above the chord between two of its values. If no small feasible step away from a point lowers the objective, then no large step can, because the segment toward a better point would already lower the objective near its start. Convexity settles which minima count, not whether a minimum exists.

Example The desk’s cost 12(x−3)2\tfrac12 (x - 3)^2 has second derivative 11, so it is strictly convex, and its only minimizer over R\mathbb{R} is x=3x = 3. The function exe^{x} is strictly convex on R\mathbb{R} but has no minimizer, since its infimum 00 is never attained. A portfolio variance w⊤Σww^{\top} \Sigma w is convex because a covariance matrix is positive semidefinite, but a matrix assembled from separately chosen correlations need not be. In a constructed example with correlations 0.90.9, 0.90.9 and −0.9-0.9,

M=[10.90.90.91−0.90.9−0.91]M = \begin{bmatrix} 1 & 0.9 & 0.9 \\ 0.9 & 1 & -0.9 \\ 0.9 & -0.9 & 1 \end{bmatrix}

has eigenvalues −0.8-0.8, 1.91.9 and 1.91.9. The direction w=(1,−1,−1)w = (1, -1, -1) gives w⊤Mw=−2.4w^{\top} M w = -2.4, so along it the quadratic is concave and unbounded below. Even with the budget constraint w1+w2+w3=1w_1 + w_2 + w_3 = 1, moving along d=(2,−1,−1)d = (2, -1, -1), which keeps the budget, has d⊤Md=−3d^{\top} M d = -3, so the quadratic has no minimum over budget portfolios and its infimum there is −∞-\infty. The KKT certificate of this lesson does not apply to such a problem.

Lagrangian

Definition For the standard problem, attach a multiplier λi\lambda_i to each inequality gi(x)≤0g_i(x) \le 0 and a vector ν∈Rp\nu \in \mathbb{R}^p to the equalities Ax=bAx = b. The Lagrangian is

L(x,λ,ν)=f(x)+∑i=1mλigi(x)+ν⊤(Ax−b),\begin{aligned} &L(x, \lambda, \nu) \\[0.4em] &= f(x) + \sum_{i=1}^{m} \lambda_i g_i(x) \\[0.4em] &\quad + \nu^{\top}(Ax - b), \end{aligned}

with λ=(λ1,…,λm)≥0\lambda = (\lambda_1, \dots, \lambda_m) \ge 0 componentwise and ν\nu unrestricted in sign. The sign restriction belongs to the direction of the inequalities, so a constraint h(x)≥0h(x) \ge 0 must first be written as −h(x)≤0-h(x) \le 0. In this lesson the letter qq denotes the dual function,

q(λ,ν)=inf⁡x∈RnL(x,λ,ν),q(\lambda, \nu) = \inf_{x \in \mathbb{R}^n} L(x, \lambda, \nu),

which may equal −∞-\infty. For each fixed xx the Lagrangian is affine in (λ,ν)(\lambda, \nu), so the dual function, an infimum of affine functions, is concave whether or not the standard problem is convex.

In plain words The Lagrangian charges each constraint at a rate set by its multiplier. At a feasible point every inequality term is zero or negative and the equality term vanishes, so there the Lagrangian is at most the true objective. Minimizing it over all xx, feasible or not, gives the dual function.

Example The desk problem is to minimize 12(x−3)2\tfrac12 (x - 3)^2 subject to x−1≤0x - 1 \le 0, with xx in units of exposure. Its Lagrangian is L(x,λ)=12(x−3)2+λ(x−1)L(x, \lambda) = \tfrac12 (x - 3)^2 + \lambda (x - 1) with λ≥0\lambda \ge 0. At the feasible point x=0x = 0 with λ=2\lambda = 2 it equals 4.5−2=2.54.5 - 2 = 2.5, below the cost 4.54.5 of that point. For fixed λ\lambda the Lagrangian is a convex quadratic in xx whose derivative x−3+λx - 3 + \lambda vanishes at x=3−λx = 3 - \lambda, and substituting this point gives

q(λ)=12λ2+λ(2−λ)=2λ−12λ2\begin{aligned} q(\lambda) &= \tfrac12 \lambda^2 + \lambda (2 - \lambda) \\[0.4em] &= 2\lambda - \tfrac12 \lambda^2 \end{aligned}

for every λ≥0\lambda \ge 0.

Weak duality

Definition The dual problem is to maximize q(λ,ν)q(\lambda, \nu) over λ≥0\lambda \ge 0 and ν∈Rp\nu \in \mathbb{R}^p. Let p∗p^* be the optimal primal value, the infimum of ff over the feasible set, with p∗=+∞p^* = +\infty when no point is feasible, and let d∗d^* be the optimal dual value, the supremum of qq over λ≥0\lambda \ge 0 and all ν\nu. Weak duality is the inequality d∗≤p∗d^* \le p^*. For any feasible x~\tilde x, any λ≥0\lambda \ge 0 and any ν\nu,

q(λ,ν)≤L(x~,λ,ν)=f(x~)+∑iλigi(x~)≤f(x~).\begin{aligned} &q(\lambda, \nu) \le L(\tilde x, \lambda, \nu) \\[0.4em] &= f(\tilde x) + \sum_{i} \lambda_i g_i(\tilde x) \\[0.4em] &\le f(\tilde x). \end{aligned}

The first step holds because an infimum is at most each of its values, the equality because Ax~=bA \tilde x = b, and the last step because λi≥0\lambda_i \ge 0 and gi(x~)≤0g_i(\tilde x) \le 0. Taking the supremum on the left and the infimum on the right gives d∗≤p∗d^* \le p^*. The argument needs no convexity, no differentiability and no attained minimum. The difference p∗−d∗p^* - d^*, when it is defined, is the duality gap, and it is never negative.

In plain words Every choice of nonnegative multipliers gives a floor under all feasible objective values, and the dual problem looks for the highest floor. Every feasible point gives a ceiling. When a floor and a ceiling meet, the optimal value is known exactly and the feasible point attaining it is optimal, without any search of the feasible set.

Example In the desk problem q(1)=2−0.5=1.5q(1) = 2 - 0.5 = 1.5, so no position with x≤1x \le 1 costs less than 1.51.5, while the feasible position x=0x = 0 costs 4.54.5. These two numbers alone place the optimal cost between 1.51.5 and 4.54.5. The best floor maximizes q(λ)=2λ−12λ2q(\lambda) = 2\lambda - \tfrac12 \lambda^2, whose derivative 2−λ2 - \lambda vanishes at λ=2\lambda = 2, so d∗=q(2)=2d^* = q(2) = 2. The feasible position x=1x = 1 costs 12(1−3)2=2\tfrac12 (1 - 3)^2 = 2, the ceiling meets the floor, and p∗=d∗=2p^* = d^* = 2.

KKT conditions

Definition Consider the standard problem with ff and every gig_i convex and differentiable on all of Rn\mathbb{R}^n and affine equality constraints Ax=bAx = b. A point x∗x^* with multipliers λ∗\lambda^* and ν∗\nu^* satisfies the Karush-Kuhn-Tucker (KKT) conditions if it has primal feasibility, dual feasibility and complementary slackness,

gi(x∗)≤0,Ax∗=b,λi∗≥0,λi∗gi(x∗)=0\begin{gathered} g_i(x^*) \le 0, \qquad A x^* = b, \\[0.4em] \lambda_i^* \ge 0, \qquad \lambda_i^* g_i(x^*) = 0 \end{gathered}

for i=1,…,mi = 1, \dots, m, together with stationarity,

∇f(x∗)+∑i=1mλi∗∇gi(x∗)+A⊤ν∗=0.\begin{aligned} &\nabla f(x^*) + \sum_{i=1}^{m} \lambda_i^* \nabla g_i(x^*) \\[0.4em] &\quad + A^{\top} \nu^* = 0 . \end{aligned}

Under these hypotheses the conditions are sufficient. If (x∗,λ∗,ν∗)(x^*, \lambda^*, \nu^*) satisfies them, then x∗x^* is a global minimizer, (λ∗,ν∗)(\lambda^*, \nu^*) is optimal for the dual problem, and p∗=d∗=f(x∗)p^* = d^* = f(x^*). Because λ∗≥0\lambda^* \ge 0, the function x↦L(x,λ∗,ν∗)x \mapsto L(x, \lambda^*, \nu^*) is convex and differentiable, stationarity says its gradient vanishes at x∗x^*, and the tangent plane inequality makes x∗x^* a global minimizer of it. Complementary slackness and feasibility remove the constraint terms, so

q(λ∗,ν∗)=L(x∗,λ∗,ν∗)=f(x∗).\begin{aligned} q(\lambda^*, \nu^*) &= L(x^*, \lambda^*, \nu^*) \\[0.4em] &= f(x^*). \end{aligned}

By weak duality every feasible xx has f(x)≥q(λ∗,ν∗)=f(x∗)f(x) \ge q(\lambda^*, \nu^*) = f(x^*), and every λ≥0\lambda \ge 0 and ν\nu have q(λ,ν)≤p∗≤f(x∗)q(\lambda, \nu) \le p^* \le f(x^*). No constraint qualification is needed in this direction. Complementary slackness forces λi∗=0\lambda_i^* = 0 for every inactive constraint, one with gi(x∗)<0g_i(x^*) < 0, while an active constraint, one with gi(x∗)=0g_i(x^*) = 0, may also have a zero multiplier. Without convexity the same four conditions can hold at a maximum or a saddle point.

In plain words A KKT point carries its own proof of optimality. The multipliers build a lower bound, and stationarity and complementary slackness show that this bound equals the objective at the candidate, so no feasible point can do better. Checking the four conditions takes a few lines of arithmetic, which is stronger evidence than a small gradient reported by a numerical method.

Example For the desk problem take x∗=1x^* = 1 and λ∗=2\lambda^* = 2. Primal feasibility holds since 1−1=0≤01 - 1 = 0 \le 0, dual feasibility since 2≥02 \ge 0, complementary slackness since 2⋅0=02 \cdot 0 = 0, and stationarity since (1−3)+2=0(1 - 3) + 2 = 0. The problem is convex, so the capped position is a global minimizer with cost 22, the value the dual bound already gave. If the limit is raised to 44, the target x=3x = 3 is feasible with 3−4=−1<03 - 4 = -1 < 0, complementary slackness forces the multiplier to be 00, and stationarity 3−3+0=03 - 3 + 0 = 0 holds, so x∗=3x^* = 3 with cost 00.

Strong duality and Slater’s condition

Definition Strong duality holds when d∗=p∗d^* = p^*. Equal values do not by themselves say that either optimum is attained. A constraint qualification is a condition on the constraints, not on the objective, that guarantees strong duality or the existence of KKT multipliers at a minimizer. For a convex standard problem, Slater’s condition asks for a strictly feasible point, an xˉ\bar x with Axˉ=bA \bar x = b and gi(xˉ)<0g_i(\bar x) < 0 for every ii. A refined version lets affine inequality constraints hold with equality at xˉ\bar x. The following result is stated here without proof. If the standard problem is convex, Slater’s condition holds and p∗p^* is finite, then d∗=p∗d^* = p^* and the dual problem has an optimal solution (λ∗,ν∗)(\lambda^*, \nu^*). If in addition a primal minimizer x∗x^* exists and ff and the gig_i are differentiable, then (x∗,λ∗,ν∗)(x^*, \lambda^*, \nu^*) satisfies the KKT conditions. That last step is elementary, since strong duality with both optima attained gives

f(x∗)=q(λ∗,ν∗)≤L(x∗,λ∗,ν∗)=f(x∗)+∑iλi∗gi(x∗)≤f(x∗),\begin{aligned} &f(x^*) = q(\lambda^*, \nu^*) \\[0.4em] &\le L(x^*, \lambda^*, \nu^*) \\[0.4em] &= f(x^*) + \textstyle\sum_i \lambda_i^* g_i(x^*) \\[0.4em] &\le f(x^*), \end{aligned}

so both inequalities are equalities. The nonpositive terms λi∗gi(x∗)\lambda_i^* g_i(x^*) then add to zero, which is complementary slackness, and x∗x^* minimizes L(⋅,λ∗,ν∗)L(\cdot, \lambda^*, \nu^*) over Rn\mathbb{R}^n, so its gradient there is zero. Hence, for a differentiable convex problem that satisfies Slater’s condition, a feasible point is optimal if and only if some multipliers satisfy the KKT conditions with it. Slater’s condition is sufficient for strong duality, not necessary, and it does not guarantee that a primal minimizer exists.

In plain words Weak duality always gives floors, and strong duality says the floors rise all the way to the optimal value. Slater’s condition asks for one point that satisfies every inequality with room to spare. For a convex problem with a finite optimal value, that one point is enough for the best floor to be reached exactly and for multipliers to exist at any minimizer.

Example The desk problem satisfies Slater’s condition, since x=0x = 0 has 0−1<00 - 1 < 0, and indeed p∗=d∗=2p^* = d^* = 2 with the dual optimum attained at λ=2\lambda = 2. Now minimize xx subject to x2≤0x^2 \le 0. The only feasible point is x=0x = 0, so p∗=0p^* = 0, but no point has x2<0x^2 < 0 and Slater’s condition fails. Stationarity would need 1+2λ⋅0=01 + 2\lambda \cdot 0 = 0, which no λ\lambda satisfies, so this minimizer has no KKT multipliers. The dual function has q(0)=−∞q(0) = -\infty, and for λ>0\lambda > 0 the Lagrangian x+λx2x + \lambda x^2 is smallest at x=−1/(2λ)x = -1/(2\lambda), which gives

q(λ)=−14λ.q(\lambda) = -\frac{1}{4\lambda}.

These values approach 00 as λ→∞\lambda \to \infty but never reach it, so d∗=p∗=0d^* = p^* = 0 while no dual optimum exists. Without a constraint qualification a convex problem can even have a positive gap. Minimize e−x1e^{-x_1} over x∈R2x \in \mathbb{R}^2 subject to ∥x∥−x2≤0\lVert x \rVert - x_2 \le 0, with the Euclidean norm. The constraint forces x1=0x_1 = 0, so p∗=1p^* = 1. Both terms of the Lagrangian are nonnegative, and along x=(t,t3)x = (t, t^3) both tend to 00 as t→∞t \to \infty, so q(λ)=0q(\lambda) = 0 for every λ≥0\lambda \ge 0 and the gap is 11.

Binding constraint

Definition An inequality constraint gi(x)≤0g_i(x) \le 0 is active at a feasible point xx when gi(x)=0g_i(x) = 0, and inactive, or slack, when gi(x)<0g_i(x) < 0. In this lesson a constraint is binding at the optimum when it is active there and relaxing it alone lowers the optimal value. Many texts use binding as a synonym for active, and the two differ only for an active constraint whose relaxation changes nothing. To measure relaxation, replace gi(x)≤0g_i(x) \le 0 by gi(x)≤uig_i(x) \le u_i and let p∗(u)p^*(u) be the optimal value of the perturbed problem, so ui>0u_i > 0 relaxes constraint ii and ui<0u_i < 0 tightens it. If strong duality holds at u=0u = 0 with a dual optimum (λ∗,ν∗)(\lambda^*, \nu^*), then for every uu

p∗(u)≥p∗(0)−λ∗⊤u.p^*(u) \ge p^*(0) - \lambda^{*\top} u .

Indeed, any xx with gi(x)≤uig_i(x) \le u_i for all ii and Ax=bAx = b has f(x)≥L(x,λ∗,ν∗)−λ∗⊤uf(x) \ge L(x, \lambda^*, \nu^*) - \lambda^{*\top} u, and the Lagrangian is at least q(λ∗,ν∗)=p∗(0)q(\lambda^*, \nu^*) = p^*(0). So relaxing constraint ii by ui>0u_i > 0 lowers the optimal value by at most λi∗ui\lambda_i^* u_i, tightening it by ∣ui∣\lvert u_i \rvert raises the value by at least λi∗∣ui∣\lambda_i^* \lvert u_i \rvert, and a constraint with λi∗=0\lambda_i^* = 0 is not binding. If moreover p∗p^* is differentiable at u=0u = 0, then

λi∗=−∂p∗∂ui(0),\lambda_i^* = -\frac{\partial p^*}{\partial u_i}(0),

and a constraint with λi∗>0\lambda_i^* > 0 is binding, its relaxation lowering the value at the rate λi∗\lambda_i^*. Without differentiability a positive multiplier does not settle the question. If one constraint is written twice, the multipliers of the two copies need only add up to the multiplier of the single constraint, so one dual optimum can give a copy a positive multiplier although relaxing that copy alone changes nothing.

In plain words A multiplier prices a constraint in units of objective per unit of constraint. When strong duality holds, loosening a constraint can lower the optimal value by at most its multiplier times the amount of loosening, and when the optimal value depends differentiably on the limits it falls at exactly that rate at first. A slack constraint costs nothing at the margin.

Example Give the desk a limit cc, so the constraint is x−c≤0x - c \le 0 and raising cc relaxes it. For c≤3c \le 3 the optimal position is x=cx = c with cost p∗=12(c−3)2p^* = \tfrac12 (c - 3)^2, and for c≥3c \ge 3 it is x=3x = 3 with cost 00. At c=1c = 1 the derivative of the cost with respect to cc is c−3=−2c - 3 = -2, which is −λ∗-\lambda^* for λ∗=2\lambda^* = 2, measured in cost units per unit of the limit. Raising the limit to 1.11.1 gives the cost 12(1.9)2=1.805\tfrac12 (1.9)^2 = 1.805, just above the bound 2−2⋅0.1=1.82 - 2 \cdot 0.1 = 1.8, and lowering it to 0.90.9 gives 2.2052.205, just above 2+2⋅0.1=2.22 + 2 \cdot 0.1 = 2.2. So the limit 11 is binding. At c=3c = 3 the optimal position x=3x = 3 makes the constraint active, but stationarity gives the multiplier 00 and every higher limit leaves the cost at 00, so the constraint is active and not binding. At c=4c = 4 it is slack.

Check yourself

  1. Minimize 12(x−3)2\tfrac12 (x - 3)^2 subject to x≥4x \ge 4. Write the constraint in standard form, find the KKT point and the dual function, and explain what goes wrong if the Lagrangian is written as 12(x−3)2+λ(x−4)\tfrac12 (x - 3)^2 + \lambda (x - 4) with λ≥0\lambda \ge 0.
Show the answer

In standard form the constraint is 4−x≤04 - x \le 0, so the Lagrangian is 12(x−3)2+λ(4−x)\tfrac12 (x - 3)^2 + \lambda (4 - x) with λ≥0\lambda \ge 0, and stationarity gives x−3−λ=0x - 3 - \lambda = 0. The unconstrained minimizer 33 is infeasible, so try the active constraint x=4x = 4. It gives λ=1≥0\lambda = 1 \ge 0, and complementary slackness holds because 4−4=04 - 4 = 0. The problem is convex, so x∗=4x^* = 4 is the global minimizer, with cost 12\tfrac12. For the dual, the Lagrangian is smallest at x=3+λx = 3 + \lambda, which gives

q(λ)=12λ2+λ(1−λ)=λ−12λ2.\begin{aligned} q(\lambda) &= \tfrac12 \lambda^2 + \lambda (1 - \lambda) \\[0.4em] &= \lambda - \tfrac12 \lambda^2 . \end{aligned}

Its maximum is q(1)=12q(1) = \tfrac12, equal to the primal cost, so there is no gap. The Lagrangian with +λ(x−4)+\lambda (x - 4) and λ≥0\lambda \ge 0 belongs to the opposite constraint x≤4x \le 4. Its KKT system yields x=3x = 3 with λ=0\lambda = 0, which violates x≥4x \ge 4, and forcing x=4x = 4 in it gives λ=−1\lambda = -1, which fails dual feasibility. The sign of a multiplier is tied to the direction of its inequality, so every constraint must be written as g(x)≤0g(x) \le 0 before the Lagrangian is formed.

  1. Minimize −12x2-\tfrac12 x^2 subject to −1≤x≤1-1 \le x \le 1, written as x−1≤0x - 1 \le 0 and −1−x≤0-1 - x \le 0. Show that x=0x = 0 with both multipliers equal to 00 satisfies all four KKT conditions. Is x=0x = 0 a minimizer, and which hypothesis of the sufficiency result fails?
Show the answer

At x=0x = 0 both constraints hold strictly, the zero multipliers are nonnegative, complementary slackness holds trivially, and stationarity holds because the derivative −x-x of the objective is 00 there. Yet the objective is 00 at x=0x = 0 and −12-\tfrac12 at x=1x = 1 and x=−1x = -1, so x=0x = 0 is the global maximizer on the feasible set, not a minimizer. The objective is concave, not convex, so the step from stationarity to a minimizer of the Lagrangian fails. With both multipliers 00 the Lagrangian is −12x2-\tfrac12 x^2, which has a maximum at 00. For every choice of nonnegative multipliers the Lagrangian is a concave quadratic in xx, so the dual function is −∞-\infty and d∗=−∞<p∗=−12d^* = -\infty < p^* = -\tfrac12. Weak duality still holds but says nothing useful. The true minimizers also satisfy the KKT conditions, x=1x = 1 with multipliers (1,0)(1, 0) and x=−1x = -1 with multipliers (0,1)(0, 1), so in a nonconvex problem the conditions cannot tell a maximum from a minimum.

  1. In a constructed model two assets have uncorrelated returns with annual variances 0.040.04 and 0.090.09, so Σ=diag⁡(0.04,0.09)\Sigma = \operatorname{diag}(0.04, 0.09). Minimize 12w⊤Σw\tfrac12 w^{\top} \Sigma w subject to the budget w1+w2=1w_1 + w_2 = 1. Find the KKT point, the dual function and the dual optimum, and check that there is no duality gap. Must the multiplier be nonnegative?
Show the answer

The budget is the equality 1⊤w−1=0\mathbf{1}^{\top} w - 1 = 0 with an unrestricted multiplier ν\nu, and

L(w,ν)=12w⊤Σw+ν(1⊤w−1).\begin{aligned} L(w, \nu) &= \tfrac12 w^{\top} \Sigma w \\[0.4em] &\quad + \nu (\mathbf{1}^{\top} w - 1). \end{aligned}

Stationarity Σw+ν1=0\Sigma w + \nu \mathbf{1} = 0 gives 0.04w1=−ν0.04 w_1 = -\nu and 0.09w2=−ν0.09 w_2 = -\nu, so w1=−25νw_1 = -25\nu and w2=−1009νw_2 = -\tfrac{100}{9}\nu. The budget then gives −3259ν=1-\tfrac{325}{9}\nu = 1, so

ν∗=−9325,w∗=(913,413).\begin{gathered} \nu^* = -\frac{9}{325}, \\[0.4em] w^* = \left(\frac{9}{13}, \frac{4}{13}\right). \end{gathered}

The objective is convex because Σ\Sigma is positive definite and the constraint is affine, so this KKT point is the global minimizer. Its variance is 0.04⋅81169+0.09⋅16169=9325≈0.02770.04 \cdot \tfrac{81}{169} + 0.09 \cdot \tfrac{16}{169} = \tfrac{9}{325} \approx 0.0277, so p∗=9650≈0.0138p^* = \tfrac{9}{650} \approx 0.0138. For fixed ν\nu the Lagrangian is smallest at w=−νΣ−11w = -\nu \Sigma^{-1} \mathbf{1}, and with 1⊤Σ−11=25+1009=3259\mathbf{1}^{\top} \Sigma^{-1} \mathbf{1} = 25 + \tfrac{100}{9} = \tfrac{325}{9} the dual function is

q(ν)=−32518 ν2−ν.q(\nu) = -\frac{325}{18}\,\nu^2 - \nu .

Its derivative −3259ν−1-\tfrac{325}{9}\nu - 1 vanishes at ν=−9325\nu = -\tfrac{9}{325}, where q=9650q = \tfrac{9}{650}. The primal and dual values agree, so there is no gap. The multiplier is negative, and that is allowed, because only inequality multipliers carry a sign restriction. Changing the budget to 1+v1 + v scales the optimal weights by 1+v1 + v, so the optimal value is 9650(1+v)2\tfrac{9}{650}(1 + v)^2, whose derivative at v=0v = 0 is 9325=−ν∗\tfrac{9}{325} = -\nu^*.

How this lesson connects