M3 · Convexity and duality, from zero

Chapter 7 (+ the LP duality he reuses in Ch 8) · about 2 hours · Goal: derive the dual of any LP or small convex QP he gives you, recover the primal answer, and state exactly what weak duality, Slater, the KKT-equivalence theorem, primal recovery and the LP duality theorem do and do not give. He said: different form of linear program I will give and ask you to derive the dual.

How this page works

It's a story: each section uses only what came before. Every idea comes first in plain words, then with numbers or a picture, then in the exact form the course uses, then a worked example, then the trap. Small Check boxes let you test yourself as you go (answers hidden). The one-page summary is at the very end; use it for revision, not for learning.

Notation used on this page (one letter = one meaning):

  • $x\in\mathbb{R}^n$: the decision variable (a column vector). $x^T$ = transpose (row vector), so $a^Tx=a_1x_1+\dots+a_nx_n$.
  • Vector inequalities are entry by entry: $x\ge0$ means every $x_j\ge0$.
  • The primal problem (the original one): $\min f(x)$ s.t. ("subject to") $h(x)=0$, $g(x)\le0$. Here $f:\mathbb{R}^n\to\mathbb{R}$ is the cost, $h=(h_1,\dots,h_m)$ are the $m$ equality constraints, $g=(g_1,\dots,g_r)$ the $r$ inequality constraints.
  • $\Omega=\{x: h(x)=0,\ g(x)\le0\}$: the feasible set (points that satisfy every constraint). A point in it is "feasible".
  • $\lambda\in\mathbb{R}^m$: one price (multiplier) per equality, any sign ("free"). $\mu\in\mathbb{R}^r$: one price per inequality, $\mu\ge0$. Quiz 4 packs them as $\eta=(\lambda,\mu)$; the notes write $y=(u,v)$. Same thing.
  • $L(x,\lambda,\mu)=f(x)+\lambda^Th(x)+\mu^Tg(x)$: the Lagrangian. $q(\lambda,\mu)$: the dual function; $\mathbb{D}$: where $q\gt-\infty$ (sections D–E).
  • $\inf$ ("infimum") = the greatest lower bound: the lowest value a function gets down to, even if no point actually reaches it (e.g. $\inf_{x}e^x=0$, never reached). $\sup$ = the same for "highest". A value is attained if some point actually reaches it.
  • $p^*=\inf\{f(x):x\in\Omega\}$: the primal optimal value. $d^*=\sup\{q(\lambda,\mu):\mu\ge0\}$: the dual optimal value. A star on a point ($x^*$, $\lambda^*$, $\mu^*$) means "optimal".
  • $\nabla f(x)$: gradient, a column vector. $\nabla^2f$: Hessian. $J_h=[\nabla h_1\cdots\nabla h_m]$, $J_g=[\nabla g_1\cdots\nabla g_r]$: gradients stacked as columns (the course's Jacobian convention).
  • "PSD" = positive semidefinite ($v^THv\ge0$ for all $v$); "PD" = positive definite ($\gt0$ for $v\ne0$).
  • LP sections: $c\in\mathbb{R}^n$ cost vector, $A$ an $m\times n$ matrix, $b\in\mathbb{R}^m$; $a_i^T$ = row $i$ of $A$; $(A^T\lambda)_j$ = entry $j$ of the vector $A^T\lambda$. In mixed-form LPs (L3 on): $\lambda_i$ = price of an equality row (free), $\mu_i\ge0$ = price of an inequality row, $\sigma_j\ge0$ = price of a sign constraint on $x_j$ (an inequality price too; its own letter only so the indices don't clash).
  • $y$ (in sections A–C): "another point", usually another feasible point. $\alpha\in[0,1]$: a mixing weight.

0. Why this topic exists

Chapter 6 gave you the KKT conditions: equations that a constrained minimum must (usually) satisfy. Two questions were left open:

  1. When is a KKT point really the best point? In Ch 6, KKT was only necessary (and only under a constraint qualification). A point could satisfy KKT and still be a maximum or a saddle. Chapter 7's answer: if the problem is convex, a KKT point is the global minimum. Sections A–C.
  2. How do I know how good my answer is, without knowing the true minimum? Suppose you found a feasible point with cost 9.5. Is the best possible 9.4 or 2? Chapter 7's answer: build a second problem, the dual, whose every value is a guaranteed lower bound on the best cost. If you find a dual value of 9.5 too, you've proved 9.5 is optimal. Sections D–L.
The whole idea of duality in one sentence

Instead of forbidding constraint violations, charge a price for them; the cheapest you can do under any fair prices is a lower bound on the true optimum, and the dual problem looks for the prices that make this bound as high as possible.

For linear programs (LPs) this gives a famous pair: $\min c^Tx$ s.t. $Ax=b,\ x\ge0$ has dual $\max b^T\lambda$ s.t. $A^T\lambda\le c$. He will give an LP in a different form and ask you to derive its dual (section L).

Roadmap: A–B convexity basics; C what convexity buys (proofs he asked in Midterm 2); D–F Lagrangian, dual function, weak duality; G–J when the bound is exact and when it isn't; K a full QP dual by hand; L LP duality; M the exam recipe.

A. Convex sets and convex functions (recap of Ch 1, only what we need)

A1. Convex set: "the straight path between any two points stays inside"

A set $C\subseteq\mathbb{R}^n$ is convex if for any two points $x,y\in C$ the whole segment between them is in $C$:

$$x,y\in C,\ \alpha\in[0,1]\ \Longrightarrow\ \alpha x+(1-\alpha)y\in C.$$

($\alpha x+(1-\alpha)y$ is the point a fraction $1-\alpha$ of the way from $x$ to $y$: $\alpha=1$ gives $x$, $\alpha=0$ gives $y$, $\alpha=\frac12$ the midpoint.)

xy convex: segment stays inside xy not convex: segment leaves the set
Left (blue): an ellipse, convex. Right (red): a half-ring; the dashed segment between two of its points passes through the hole, so it is not convex.

Convex examples you'll meet: all of $\mathbb{R}^n$; a line or plane $\{x:a^Tx=b\}$; a half-space $\{x:a^Tx\le b\}$; a ball $\{x:\|x\|\le r\}$; and any intersection of convex sets (if $x,y$ are in every set, the segment is in every set). Not convex: a circle $\{x_1^2+x_2^2=1\}$ (just the curve), a ring, two separate intervals.

Check A1. Is $\{x\in\mathbb{R}:x\le-1\}\cup\{x:x\ge1\}$ convex? Is $\{x\in\mathbb{R}^2:x_1\ge0,\ x_2\ge0,\ x_1+x_2\le1\}$ convex?
Show answer

First: no. $-1$ and $1$ are in it, but their midpoint $0$ is not. Second: yes. It is the intersection of three half-spaces (a triangle).

A2. Convex function: "every chord lies on or above the graph"

$f$ is convex (on a convex set) if for all $x,y$ and $\alpha\in[0,1]$:

$$f(\alpha x+(1-\alpha)y)\le\alpha f(x)+(1-\alpha)f(y).$$

Left side: the height of the graph at a point between $x$ and $y$. Right side: the height of the straight chord joining $(x,f(x))$ and $(y,f(y))$ at that same point. So "graph below chord" = bowl shape.

f(x)f(y) graph ≤ chord tangent ≤ graph f
Blue: a convex $f$. Red: the chord between $x$ and $y$; the graph (blue dot) is below it. Green dashed: the tangent line at the bottom; the graph is everywhere above its tangent lines.

Words you need:

  • Concave: $-f$ is convex (chord on or below the graph, a dome). Example: $\ln x$, $\sqrt x$ on $x\gt0$.
  • Affine: $f(x)=a^Tx+\beta$ (linear plus a constant). Affine functions are both convex and concave (chord = graph).
  • Strictly convex: the inequality is strict ($\lt$) whenever $x\ne y$ and $0\lt\alpha\lt1$. Example $x^2$; $|x|$ and affine functions are convex but not strictly.

Two tests (from Ch 1):

  • Second-order: twice-differentiable $f$ is convex iff $\nabla^2f(x)$ is PSD at every point (in 1D: $f''\ge0$). Example: $x_1^2+x_2^2$ has Hessian $2I$, PSD ✓. $e^x$: $f''=e^x\gt0$ ✓.
  • First-order (the one used in every proof below): differentiable $f$ is convex iff the graph lies above every tangent: $$f(y)\ge f(x)+\nabla f(x)^T(y-x)\quad\text{for all }x,y.$$
Trap: convex along a set, not everywhere (Quiz 4 Q1)

$f=x_1^2-x_2^2$ is not convex on $\mathbb{R}^2$ (Hessian $\mathrm{diag}(2,-2)$ is indefinite). But on the line $\{(t,at):t\in\mathbb{R}\}$ it becomes $\phi(t)=f(t,at)=(1-a^2)t^2$, which is convex iff $1-a^2\ge0$, i.e. $|a|\le1$. Only the curvature along the set matters. At $a=\pm1$ the restriction is the constant 0, which still counts as convex (just not strictly).

Chord test: convex or not?

Pick a function or a set, then drag the two points $x$ and $y$. Watch the chord: green where it passes the test, red where it fails. The α slider moves the in-between point $\alpha x+(1-\alpha)y$.

What to notice: for $x^2$ and $x^4$ no pair ever fails. For $x^3$, pairs with both points $\ge0$ pass, but put one point on the left and the graph pokes above the chord: one failing pair is enough to say "not convex". $|x|$ passes, but the chord can lie on the graph (convex, not strictly). In the trap, slide $a$: for $|a|\le1$ the restriction $(1-a^2)t^2$ is a bowl (flat at $a=\pm1$), for $|a|\gt1$ a dome. For sets: the half-ring, the two discs and the circle curve each have a pair whose segment leaves; the disc and the triangle never do.
Check A2. Convex, concave, both or neither on $\mathbb{R}$: (i) $3x-5$ (ii) $x^4$ (iii) $x^3$ (iv) $-x^2$?
Show answer

(i) both (affine). (ii) convex ($f''=12x^2\ge0$). (iii) neither ($f''=6x$ changes sign). (iv) concave.

B. Which constraints give a convex feasible set

Plain words: each constraint cuts out a set; the feasible set $\Omega$ is the intersection of these sets. Intersections of convex sets are convex (A1). So we just need each single constraint to cut out a convex set.

Rule 1: $g(x)\le0$ with $g$ convex gives a convex set. Proof (two lines): take $x,y$ with $g(x)\le0$, $g(y)\le0$. By convexity of $g$, $$g(\alpha x+(1-\alpha)y)\le\alpha\underbrace{g(x)}_{\le0}+(1-\alpha)\underbrace{g(y)}_{\le0}\le0,$$ so the in-between point also satisfies the constraint. ✓

Rule 2: $g(x)\ge0$ with $g$ concave is the same thing: it says $-g(x)\le0$ and $-g$ is convex.

Rule 3: $h(x)=0$ with $h$ affine gives a convex set (a line, plane, …). Why affine and not just convex: $h=0$ means $h\le0$ and $-h\le0$, so we need both $h$ and $-h$ convex, i.e. $h$ both convex and concave, i.e. affine.

Thm 7.2.1 (convex feasible set) and the definition of a convex problem

The feasible set is convex if every equality is affine $=0$, every "$\le0$" constraint has a convex function, every "$\ge0$" constraint has a concave function.

The problem $\min f(x)$ s.t. $h(x)=0$, $g(x)\le0$ is a convex optimization problem if $f$ is convex, every $g_j$ is convex and $h$ is affine.

Worked example: which constraints keep the feasible set convex?
  1. $x_1^2+x_2^2-4\le0$: convex function $\le 0$ ✓ (a disc).
  2. $-x_1\le0$ (i.e. $x_1\ge0$): affine, hence convex ✓.
  3. $\ln x_1\ge 0$ (on $x_1\gt0$): concave function $\ge0$ ✓ (it is just $x_1\ge1$).
  4. $x_1^2+x_2^2=1$: equality with a non-affine function ✗ (a circle, not convex).
  5. $x_1^2-x_2\ge0$: convex function $\ge0$ ✗ (the region outside a parabola, not convex: $(1,1)$ and $(-1,1)$ are in it, their midpoint $(0,1)$ is not).
Traps (he was explicit)
  • Be sure that you don't write concave optimization problem. Never, exam. Maximising a concave function is still called a convex problem (it equals minimising the convex $-f$). And there is nothing called concave set.
  • Write the constraint in the right direction before judging it: $x_1\ge2$ is $2-x_1\le0$ (affine ✓). "$g\ge0$ with $g$ convex" is the bad case.
  • The rules are sufficient, not necessary: $\{x^3\le0\}=\{x\le0\}$ happens to be convex although $x^3$ is not convex. For the exam, judge by the rules.
Check B. Is $\min x_1+x_2$ s.t. $x_1x_2\ge1$, $x\ge0$ a convex problem as written? Is its feasible set convex?
Show answer

Not as written: $x_1x_2$ is neither convex nor concave on $\mathbb{R}^2$, so the rules don't apply. The set $\{x_1x_2\ge1,\ x\ge0\}$ (the region above the hyperbola $x_2=1/x_1$ in the first quadrant) is in fact convex. To make it a convex problem by the rules, rewrite $x_1x_2\ge1$ as $\ln x_1+\ln x_2\ge0$ on $x\gt0$ (concave $\ge0$ ✓). This is a side remark; exam questions use the plain rules.

C. Why convex problems are nice

Plain words: a bowl over a dent-free region has no false bottoms. Every local minimum is the global one, the KKT equations are enough to prove you're at the global minimum, and if several points are optimal they form a convex set.

C1. Local minimum ⇒ global minimum (Thm 7.2.3)

Recall: $x^*\in\Omega$ is a local minimiser if $f(x^*)\le f(x)$ for all feasible $x$ near $x^*$; global if for all feasible $x$.

Proof (by contradiction, 3 steps)
  1. Suppose $x^*$ is a local minimiser but some feasible $y$ has $f(y)\lt f(x^*)$.
  2. Points on the segment $x_t=x^*+t(y-x^*)=(1-t)x^*+ty$, $t\in(0,1]$, are feasible ($\Omega$ is convex), and by convexity of $f$: $f(x_t)\le(1-t)f(x^*)+tf(y)\lt f(x^*)$.
  3. As $t\to0$, $x_t$ gets as close to $x^*$ as we like, with a smaller cost. That contradicts "local minimiser". So no such $y$ exists. ∎

C2. The set of minimisers is convex (Cor 7.2.6). If $x$ and $y$ both have the optimal value $p^*$, any in-between point is feasible and has $f\le\alpha p^*+(1-\alpha)p^*=p^*$, so it is optimal too. (So there is either 0, 1 or infinitely many minimisers, never exactly 2.)

C3. The geometric first-order condition (Thm 7.2.4)

For convex differentiable $f$ on a convex $\Omega$: $x^*$ is a global minimiser iff $$\nabla f(x^*)^T(y-x^*)\ge0\quad\text{for every feasible }y.$$ In words: from $x^*$, every direction that points into the feasible set goes uphill (or flat) at first order. Proof of "⇐": the first-order test gives $f(y)\ge f(x^*)+\nabla f(x^*)^T(y-x^*)\ge f(x^*)$. Note: $\nabla f(x^*)$ need not be 0 at a constrained minimum. Example: $\min x$ s.t. $x\ge1$: $x^*=1$, $f'(1)=1\ne0$, but $f'(1)(y-1)\ge0$ for all $y\ge1$ ✓.

C4. KKT ⇒ global minimum (Thm 7.2.8): the proof chain (Midterm 2 Q I)

Recall the KKT conditions at $x^*$ with multipliers $\lambda^*,\mu^*$ (all five parts, he insists):

$$\underbrace{\nabla f(x^*)+J_h(x^*)\lambda^*+J_g(x^*)\mu^*=0}_{\text{stationarity of }L}\quad h(x^*)=0\quad g(x^*)\le0\quad\mu^*\ge0\quad\underbrace{\mu_j^*g_j(x^*)=0\ \forall j}_{\text{complementary slackness (CS)}}$$

A constraint is active at $x^*$ if $g_j(x^*)=0$, inactive if $g_j(x^*)\lt0$. CS says: inactive ⇒ $\mu_j^*=0$.

Claim: for a convex problem with $h(x)=Ax-b$, any KKT point $x^*$ is a global minimiser. No constraint qualification needed. Idea: take any feasible $y$, look at the step $d=y-x^*$, and show $f$ cannot go down along it.

The five steps (learn the reason for each: these are the Midterm 2 MCQs)
  1. Equalities: $Ad=Ay-Ax^*=b-b=0$. Since $J_h=A^T$ (each $\nabla h_i$ is row $i$ of $A$, as a column), $d^TJ_h=(Ad)^T=0^T$.
  2. Each $g_j$ is convex, so by the first-order test $\nabla g_j(x^*)^Td\le g_j(y)-g_j(x^*)$. If $j$ is active this is $\le g_j(y)\le0$. If inactive, the right side can be positive: no fixed sign.
  3. CS kills the inactive $\mu_j^*$; the active ones are $\ge0$ times something $\le0$. So $d^TJ_g\mu^*=\sum_j\mu_j^*\nabla g_j(x^*)^Td\le0$.
  4. Convex $f$ + stationarity: $f(y)-f(x^*)\ge\nabla f(x^*)^Td=-d^T[J_h\lambda^*+J_g\mu^*]$.
  5. Combine: $f(y)-f(x^*)\ge-\underbrace{d^TJ_h\lambda^*}_{=0}-\underbrace{d^TJ_g\mu^*}_{\le0}\ge0$. So $f(y)\ge f(x^*)$ for every feasible $y$: global minimum. ∎ Contrapositive: a point that is not a (local) minimiser cannot satisfy KKT.

C5. But KKT is NOT necessary without a constraint qualification

Convexity makes KKT sufficient. It does not make it necessary: a convex problem can have a minimum where no multipliers exist. (In Ch 6, necessity needed a constraint qualification (CQ) such as LICQ; for convex problems the standard CQ is Slater's condition, section G.)

Worked example: optimum exists, KKT holds nowhere

$\min (x-1)^2$ s.t. $x^2\le0$. The only feasible point is $x^*=0$, so it is the global minimiser. Stationarity would need $2(0-1)+\mu\cdot2\cdot0=0$, i.e. $-2=0$: impossible for every $\mu$. No KKT multiplier. Strict convexity does not replace a CQ. (Slater fails: no $x$ has $x^2\lt0$.)

Check C. $\min x_1^2+x_2^2$ s.t. $x_1+x_2\ge2$. The point $(1,1)$ with $\mu=2$ satisfies KKT. Is $(1,1)$ the global minimiser? Which theorem?
Show answer

$g=2-x_1-x_2\le0$ (affine), $f$ convex: a convex problem. Stationarity: $(2,2)+2(-1,-1)=0$ ✓, $g=0$ ✓, $\mu\ge0$ ✓, CS ✓. By Thm 7.2.8 (C4), $(1,1)$ is a global minimiser (and the only one, since $f$ is strictly convex).

D. The Lagrangian as "prices on constraints"

Plain words. Imagine you are allowed to break the constraints, but you pay a fine. For each inequality $g_j(x)\le0$ you pay $\mu_j\,g_j(x)$:

  • if you violate it ($g_j\gt0$) you pay a positive amount;
  • if you satisfy it with room to spare ($g_j\lt0$) you get a refund.

For this to be a fine and not a reward, the price must be $\mu_j\ge0$. For an equality $h_i(x)=0$ you pay $\lambda_ih_i(x)$; violating in either direction might be tempting, so the price $\lambda_i$ may have either sign ("free"). Your total bill is the Lagrangian:

$$L(x,\lambda,\mu)=f(x)+\lambda^Th(x)+\mu^Tg(x)=f(x)+\sum_{i=1}^m\lambda_ih_i(x)+\sum_{j=1}^r\mu_jg_j(x),\qquad\lambda\text{ free},\ \mu\ge0.$$
The key fact (everything in F–I rests on it)

At a feasible $x$ and any prices with $\mu\ge0$: $\ h(x)=0$ and $\mu^Tg(x)\le0$ (each term is $\ge0$ times $\le0$), so

$$L(x,\lambda,\mu)\le f(x).$$

On feasible points the bill is never more than the true cost.

Before writing $L$, rewrite every constraint as $h=0$ or $g\le0$. Examples: $x_1\ge2\to 2-x_1\le0$; $x\ge0\to -x\le0$; $x_1+x_2=4\to x_1+x_2-4=0$. (He said he will give constraints in non-standard form on purpose.)

With numbers (the Ch 7 tutorial problem; we finish it in section K)

$\min\ \tfrac12(2x_1^2+x_2^2)$ s.t. $x_1+x_2=4$, $x_1\ge2$. Write $h=x_1+x_2-4$, $g=2-x_1\le0$:

$$L=x_1^2+\tfrac12x_2^2+\lambda(x_1+x_2-4)+\mu(2-x_1).$$

Take the feasible point $x=(3,1)$: $f=\frac12(18+1)=9.5$. With prices $\lambda=-1$, $\mu=1$: $h=0$, $g=2-3=-1$, so $L=9.5+(-1)(0)+(1)(-1)=8.5\le9.5$ ✓.

Check D. Write the Lagrangian of $\min x^2$ s.t. $x\ge1$.
Show answer

$g=1-x\le0$, so $L(x,\mu)=x^2+\mu(1-x)$, $\mu\ge0$. (Writing $\mu(x-1)$ would be the wrong direction.)

E. The dual function $q$: the best cost when constraints are priced instead of enforced

Plain words. Fix the prices $(\lambda,\mu)$. Now you may choose any $x$ at all (no constraints any more; you just pay the fines). The lowest bill you can get is $q(\lambda,\mu)$:

Definitions (course form) $$q(\lambda,\mu)=\inf_{x\in\mathbb{R}^n}L(x,\lambda,\mu),\qquad \mathbb{D}=\{(\lambda,\mu):q(\lambda,\mu)\gt-\infty\}.$$

Dual problem: $\ \max\ q(\lambda,\mu)$ s.t. $\mu\ge0$, $(\lambda,\mu)\in\mathbb{D}$. Its optimal value is $d^*$.

The infimum is over all $x\in\mathbb{R}^n$: the constraints are not put back. (Only a function domain stays: if a formula is only defined for some $x$, e.g. a constraint $x_1^2/x_2\le0$ only makes sense for $x_2\gt0$, then the infimum runs over $x_2\gt0$. Example J5 below is such a case.)

Why it can be $-\infty$: some prices let you get an unboundedly low bill. Those prices are useless as bounds, so the dual only looks inside $\mathbb{D}$.

E1. First example, every step

$\min x^2$ s.t. $x\ge1$ (answer obviously $x^*=1$, $p^*=1$). From Check D: $L=x^2+\mu(1-x)$.

  1. Fix $\mu\ge0$ and minimise over all $x\in\mathbb{R}$: $L$ is a parabola in $x$, derivative $2x-\mu=0$, so $x=\mu/2$.
  2. Plug in: $q(\mu)=\frac{\mu^2}{4}+\mu\big(1-\frac{\mu}{2}\big)=\mu-\frac{\mu^2}{4}$. Finite for every $\mu$, so $\mathbb{D}=\mathbb{R}$.
  3. Dual: $\max_{\mu\ge0}\ \mu-\frac{\mu^2}{4}$. Derivative $1-\frac{\mu}{2}=0$: $\mu^*=2$, $d^*=2-1=1$.
  4. Compare: $d^*=1=p^*$. And the $x$ that minimised $L$ at $\mu^*=2$ is $x=\mu^*/2=1=x^*$. The dual found the answer.

E2. The linear-in-$x$ rule (the whole LP dual rests on it)

If, after collecting terms, $L=r^Tx+\beta$ (with $r$ and $\beta$ not depending on $x$), then

$$\inf_{x\in\mathbb{R}^n}(r^Tx+\beta)=\begin{cases}\beta,&r=0\\-\infty,&r\ne0.\end{cases}$$

Why: if $r\ne0$, walk along $x=-tr$: the value is $-t\|r\|^2+\beta\to-\infty$ as $t\to\infty$. If $r=0$, $L$ is the constant $\beta$. In his words: The infimum is finite if and only if the coefficients of x vanishes.

Worked example (notes Example 7.4.2)

$\min x$ s.t. $-x\le0$ (i.e. $x\ge0$; answer $x^*=0$). $L=x-\mu x=(1-\mu)x$. Linear in $x$ with coefficient $1-\mu$: $q(\mu)=0$ if $\mu=1$, $-\infty$ otherwise. So $\mathbb{D}=\{1\}$ and $d^*=q(1)=0=p^*$.

E3. The picture: $q$ is the lower envelope of straight lines, so it is concave

Take Quiz 4's problem $\min_{x\in\mathbb{R}}x^2+1$ s.t. $(x-2)(x-4)\le0$ (feasible set $[2,4]$, so $x^*=2$, $p^*=5$). $L=x^2+1+\mu(x-2)(x-4)$.

Freeze $x$: then $L$ is a straight line in $\mu$, intercept $x^2+1$, slope $(x-2)(x-4)$. E.g. $x=0$: $1+8\mu$; $x=1$: $2+3\mu$; $x=2$: the flat line 5; $x=3$: $10-\mu$. $q(\mu)$ is "the lowest of all these lines" at each $\mu$:

x=0 x=1 x=3 x=2: L = 5 = p* q(μ) = lowest line max q = 5 at μ* = 2 μ 0246 510
Grey lines: $L(x,\mu)$ as a function of $\mu$ for a few fixed $x$. Blue: $q(\mu)=10-\mu-\frac{9}{1+\mu}$, the lowest value over all $x$; it touches each line once. Green dashed: the line for the feasible point $x=2$, which is the true optimum $p^*=5$. The blue curve never goes above it (that's weak duality, section F) and touches it at $\mu^*=2$.

Computing $q$ here: $L=(1+\mu)x^2-6\mu x+1+8\mu$. For $\mu\ge0$ the $x^2$ coefficient is positive, so set $\partial L/\partial x=2(1+\mu)x-6\mu=0$: $x_\mu=\frac{3\mu}{1+\mu}$. Plugging in: $q(\mu)=1+8\mu-\frac{9\mu^2}{1+\mu}=10-\mu-\frac{9}{1+\mu}$. Then $q'(\mu)=-1+\frac{9}{(1+\mu)^2}=0$ gives $\mu^*=2$, $q(2)=10-2-3=5=p^*$.

$q$ is always concave and $\mathbb{D}$ is always convex (even for nonconvex problems)

Why: for each fixed $x$, $L(x,\cdot,\cdot)$ is affine in the prices. Write $\eta=(\lambda,\mu)$ and take $\eta_0,\eta_1$, $\alpha\in[0,1]$:

$$\begin{aligned}q(\alpha\eta_0+(1-\alpha)\eta_1)&=\inf_x\big[\alpha L(x,\eta_0)+(1-\alpha)L(x,\eta_1)\big]\\&\ge\alpha\inf_xL(x,\eta_0)+(1-\alpha)\inf_xL(x,\eta_1)=\alpha q(\eta_0)+(1-\alpha)q(\eta_1).\end{aligned}$$

(The "$\ge$": minimising the two parts separately can only do better than minimising their sum together.) That is the definition of concave. And if $\eta_0,\eta_1\in\mathbb{D}$, the right side is $\gt-\infty$, so the mix is in $\mathbb{D}$: $\mathbb{D}$ is convex. No convexity of $f$, $g$, $h$ was used. So the dual is always a convex problem (maximise a concave function = minimise the convex $-q$).

Dual function = lowest of the lines

Move μ (slider, or drag in the right panel). Left: the red bill $L(x,\mu)$ and its lowest point $x(\mu)$, found over all $x$. Right: that lowest value $q(\mu)$, traced out as μ changes.

What to notice: (1) the red dot on the right never goes above the green $p^*$ line: that is weak duality (section F). (2) Each grey line is $L$ for one fixed $x$; $q$ is the lowest of them, so it bends downward (concave). The red dashed line belongs to $x(\mu)$ and touches $q$ at the current μ. (3) At $\mu^*$ the red dot touches $p^*$ (zero gap), and on the left $x(\mu^*)$ lands exactly on $x^*$: primal recovery (section I). (4) J1: $q$ creeps up to 1 but never reaches it (dual not attained). J2: any $\mu\gt0$ sends $L$ down to $-\infty$, so only $\mu=0$ gives a bound.

E4. How to compute the infimum in practice

  • $L$ linear in some variable: its coefficient must be $0$, else $q=-\infty$ (E2).
  • $L$ a positive definite quadratic in $x$: set $\nabla_xL=0$, solve for $x(\lambda,\mu)$, substitute back (or complete the square).
  • A coefficient that can be $\le0$, or exponential terms: check the edge cases separately. Example: $e^x+\mu x$ with $\mu\gt0$ goes to $-\infty$ as $x\to-\infty$.
Check E. (1) $\min x_1+x_2$ s.t. $x_1+x_2=1$: find $q(\lambda)$ and $\mathbb{D}$. (2) Why can't you restrict the inner minimisation in E3 to $x\in[2,4]$?
Show answer

(1) $L=x_1+x_2+\lambda(x_1+x_2-1)=(1+\lambda)x_1+(1+\lambda)x_2-\lambda$. Coefficients vanish iff $\lambda=-1$: $q(-1)=1$, $q=-\infty$ otherwise; $\mathbb{D}=\{-1\}$, $d^*=1=p^*$. (2) Because $q$ is defined with $\inf$ over all $x$; the constraint is already "inside" $L$ as a price. Restricting $x$ gives a different function (it would be the constant 5 here, Quiz 4 Q4's wrong option (d)).

F. Weak duality: every dual value is below every feasible primal value

He said: it's used frequently. You should always remember this.

Weak duality, with its 3-line proof

For any feasible $\bar x$ and any prices $(\bar\lambda,\bar\mu)$ with $\bar\mu\ge0$:

$$q(\bar\lambda,\bar\mu)\ \overset{(1)}{\le}\ L(\bar x,\bar\lambda,\bar\mu)\ \overset{(2)}{=}\ f(\bar x)+\bar\lambda^T\underbrace{h(\bar x)}_{=0}+\underbrace{\bar\mu^Tg(\bar x)}_{\le0}\ \overset{(3)}{\le}\ f(\bar x).$$

(1) $q$ is the infimum over all $x$, so it is $\le$ the value at the particular $\bar x$. (2) definition of $L$. (3) feasibility and $\bar\mu\ge0$. Taking the sup on the left and the inf on the right: $\boxed{d^*\le p^*}$.

With numbers (tutorial problem from D)

For that problem, minimising $L$ over $x$ (gradient zero gives $x_1=\frac{\mu-\lambda}{2}$, $x_2=-\lambda$; full algebra derived in K below) gives $q(\lambda,\mu)=-\frac14(\lambda-\mu)^2-\frac12\lambda^2-4\lambda+2\mu$. Then $q(0,0)=0$ and $q(-1,1)=-1-\frac12+4+2=4.5$. The feasible point $(3,1)$ has $f=9.5$. So without solving anything: $4.5\le d^*\le p^*\le9.5$. (The true value is $6$.)

d*p* gap ≥ 0 q at any prices (μ ≥ 0) f at feasible x
Every dual value (blue) sits left of $d^*$; every feasible cost (red) sits right of $p^*$; and $d^*\le p^*$. The distance $p^*-d^*$ is the duality gap (section G).

Consequence: the optimality certificate. If a feasible $\bar x$ and dual-feasible prices have equal values, $f(\bar x)=q(\bar\lambda,\bar\mu)$, then both are optimal: nothing can lie strictly between them. This is how you prove an answer is optimal in LPs (section L).

Check F. A feasible $\hat x$ has $f(\hat x)=10$ and some prices with $\mu\ge0$ give $q=10$. What can you conclude? What if $q$ were $12$?
Show answer

$10\le d^*\le p^*\le10$: both optimal, $p^*=d^*=10$. A value $q=12\gt f(\hat x)$ is impossible: it would break weak duality, so there's an algebra mistake (usually a sign error in $L$, or $\mu\lt0$).

G. Duality gap, strong duality, and Slater's condition

Definitions. The duality gap is $p^*-d^*\ge0$. Strong duality (or "zero gap") means $p^*=d^*$. Separately, each side may or may not be attained: "primal attained" = some feasible $x^*$ has $f(x^*)=p^*$; "dual attained" = some $(\lambda^*,\mu^*)$ with $\mu^*\ge0$ has $q(\lambda^*,\mu^*)=d^*$.

Plain words: four separate things can each be true or false: (1) zero gap; (2) primal attained; (3) dual attained; (4) the Lagrangian at the dual optimum has a unique minimiser. Each theorem below gives a specific subset. Exam MCQs test exactly which.

A gap can happen even for a convex problem. Example (worked in J5 below): $\min e^{-x}$ s.t. $x^2/y\le0$ on the domain $y\gt0$ has $p^*=1$ but $d^*=0$. It is convex: $e^{-x}$ is convex, and $x^2/y$ has Hessian $\begin{pmatrix}2/y&-2x/y^2\\-2x/y^2&2x^2/y^3\end{pmatrix}$, whose diagonal entries are $\ge0$ and whose determinant is $\frac{4x^2}{y^4}-\frac{4x^2}{y^4}=0$ on $y\gt0$, so it is PSD there. The most used guarantee against a gap:

Slater's theorem (Thm 7.4.3)

Assume: $f$ and all $g_j$ convex, $h$ affine, there is a Slater point $x^0$ with $h(x^0)=0$ and $g_j(x^0)\lt0$ for every $j$ (strictly inside every inequality), and $p^*$ is finite.

Then: $p^*=d^*$ and the dual optimum is attained (some $\mu^*\ge0$, $\lambda^*$ reach $d^*$).

Not given: that the primal optimum is attained; unique multipliers; a unique Lagrangian minimiser.

  • Finding a Slater point is usually guessing: tutorial problem $x_1+x_2=4$, $x_1\ge2$: $x^0=(3,1)$ gives $h=0$, $g=2-3=-1\lt0$ ✓. He said Slater points are "easy to guess".
  • Primal not attained under Slater: $\min e^x$ s.t. $x\le0$. Slater point $x=-1$. $p^*=\inf e^x=0$ but no $x$ reaches 0. (Dual: $q(0)=0$, attained.)
  • Slater as a constraint qualification: if Slater holds and a primal optimum $x^*$ exists (and everything is differentiable), then KKT multipliers exist at $x^*$ (combine Slater with section H). That's why Slater is "the CQ for convex problems".
Check G. Give a Slater point or say why none exists: (1) $x_1^2+x_2^2\le1$, $x_1+x_2=1$. (2) $(x-1)^2\le0$. (3) $x\ge0$, $x\le0$.
Show answer

(1) $(0.5,0.5)$: $h=0$, $0.5-1\lt0$ ✓. (2) None: $(x-1)^2\lt0$ is impossible. (3) None: no $x$ has $-x\lt0$ and $x\lt0$ at once.

H. KKT pair ⇔ zero gap and both optima attained (Thm 7.4.1)

Setting: differentiable convex problem ($f,g$ convex, $h$ affine), $x$ ranging over all of $\mathbb{R}^n$. A KKT pair is $(x^*,(\lambda^*,\mu^*))$ satisfying all five KKT conditions.

Theorem 7.4.1

A KKT pair exists $\iff$ $p^*=d^*\in\mathbb{R}$ and both are attained. In that case every primal optimum together with every dual optimum is a KKT pair.

Proof, both directions (it is only weak duality's chain read carefully)

(⇐) zero gap + both attained ⇒ KKT. Let $x^*$ be primal optimal and $(\lambda^*,\mu^*)$ dual optimal, with $q(\lambda^*,\mu^*)=f(x^*)$. Weak duality's chain at this pair reads

$$q(\lambda^*,\mu^*)\le L(x^*,\lambda^*,\mu^*)\le f(x^*),$$

and the two ends are equal, so both "$\le$" are "$=$".

  1. First equality: $L(x^*,\lambda^*,\mu^*)=\inf_xL(x,\lambda^*,\mu^*)$, so $x^*$ minimises $L(\cdot,\lambda^*,\mu^*)$ over all of $\mathbb{R}^n$, hence $\nabla_xL=0$ there: stationarity.
  2. Second equality: $(\mu^*)^Tg(x^*)=0$. Each term $\mu_j^*g_j(x^*)$ is $\le0$, and they add to 0, so each is 0: CS.
  3. Feasibility of $x^*$ and $\mu^*\ge0$ are given. All five conditions hold.

(⇒) KKT ⇒ zero gap + both attained. With $\mu^*\ge0$, $L(\cdot,\lambda^*,\mu^*)=f+\lambda^{*T}h+\mu^{*T}g$ is convex in $x$ (convex + affine + nonnegative multiples of convex). Stationarity says its gradient is 0 at $x^*$, so $x^*$ is a global minimiser of $L$ (first-order test). Hence

$$q(\lambda^*,\mu^*)=L(x^*,\lambda^*,\mu^*)=f(x^*)+\lambda^{*T}\underbrace{h(x^*)}_{0}+\underbrace{\mu^{*T}g(x^*)}_{0\text{ by CS}}=f(x^*).$$

By weak duality $q(\lambda^*,\mu^*)\le d^*\le p^*\le f(x^*)$, and the ends are equal: zero gap, $x^*$ attains $p^*$, $(\lambda^*,\mu^*)$ attains $d^*$. ∎

Why "full space" matters: step 1 of (⇐) used "minimiser over all of $\mathbb{R}^n$ ⇒ gradient 0". If $x$ is restricted to a domain like $y\gt0$, that step can fail (section J, last example).

Check H. In $\min(x-1)^2$ s.t. $x^2\le0$: only $x=0$ is feasible, so $p^*=1$; minimising $L=(x-1)^2+\mu x^2$ over $x$ gives $q(\mu)=\frac{\mu}{1+\mu}$ (worked in J1 below), which rises towards 1 as $\mu\to\infty$, so $d^*=1$. Why does the theorem not give a KKT pair?
Show answer

Zero gap alone is not enough: the theorem also needs both optima attained, and here the dual sup $1$ is never reached. Consistent with C5: no KKT multiplier exists.

I. Primal recovery: getting $x^*$ back from the dual

Plain words: once you know the optimal prices, minimise the bill $L(x,\lambda^*,\mu^*)$ over $x$. If there is exactly one minimiser, it is the answer. (That's what happened in E1: $x=\mu^*/2=1$.)

Corollary 7.4.2 (primal recovery)

Suppose a KKT pair exists, $\bar\eta=(\bar\lambda,\bar\mu)$ is dual optimal, and $L(\cdot,\bar\eta)$ has a unique minimiser $\bar x$. Then $\bar x$ is the unique primal optimum. Feasibility and CS come for free.

Proof (2 lines): by Thm 7.4.1, any primal optimum $x^*$ together with $\bar\eta$ is a KKT pair, so (as in H, ⇒) $x^*$ minimises $L(\cdot,\bar\eta)$. The minimiser is unique, so $x^*=\bar x$. ∎ (A primal optimum exists because a KKT pair exists.)

  • Hypothesis is uniqueness, not strict convexity. Strict convexity of $L(\cdot,\bar\eta)$ in $x$ (e.g. $f$ strictly convex) is just one convenient way to get uniqueness.
  • Without uniqueness it can fail: in $\min x$ s.t. $-x\le0$, $\mu^*=1$ and $L(x,1)=(1-1)x\equiv0$. Every $x$ minimises it, including $x=-1$ (infeasible) and $x=1$ (feasible but not optimal). Then use CS to pick out $x^*$ (here $\mu^*=1\gt0$ forces $-x=0$, so $x^*=0$).
ResultAssumesGivesDoes NOT give
Weak dualitynothing (any problem)$d^*\le p^*$zero gap
Thm 7.4.1 (KKT equivalence)differentiable convex, full spaceKKT pair ⇔ zero gap + both attaineduniqueness; KKT from zero gap alone
Slater (Thm 7.4.3)convex, affine $h$, strictly feasible $x^0$, $p^*$ finitezero gap + dual attainedprimal attained; unique multipliers; unique Lagrangian minimiser
Slater + a primal optimum existsas above + differentiablea KKT pair; then $x$ optimal ⇔ KKT multipliers exist at $x$
Recovery (Cor 7.4.2)KKT pair exists + $L(\cdot,\bar\eta)$ unique minimiser $\bar x$$\bar x$ = unique primal optimum, feasible, CS holdsanything if minimiser not unique
Check I. In E3 ($x^2+1$, $(x-2)(x-4)\le0$), recover $x^*$ from $\mu^*=2$.
Show answer

$L(x,2)=3x^2-12x+17$, a strictly convex parabola with unique minimiser $x=12/6=2$ (same as $x_\mu=\frac{3\mu}{1+\mu}$ at $\mu=2$). So $x^*=2$, $f=5=d^*$ ✓.

J. The strange examples (each one is a past MCQ)

Each shows one of the four properties from G failing. Learn the table, then the working underneath.

ProblemSlater?GapPrimal attained?Dual attained?Lesson
J1. $\min(x-1)^2$ s.t. $x^2\le0$No0 ($p^*=d^*=1$)Yes ($x=0$)Nono KKT despite convexity
J2. $\min e^x$ s.t. $x\le0$Yes0 ($p^*=d^*=0$)NoYes ($\mu=0$)Slater ⇏ primal attained
J3. $\min-2u+(v-1)^2$ s.t. $u\le1$Yes0 ($-2$)Yes $(1,1)$Yes ($\mu^*=2$)Lagrangian minimiser not unique
J4. $\min x$ s.t. $-x\le0$Yes0Yes ($0$)Yes ($\mu^*=1$)a minimiser of $L$ can be infeasible
J5. $\min e^{-x}$ s.t. $x^2/y\le0$, domain $y\gt0$No1YesYesa positive gap
J1. $\min(x-1)^2$ s.t. $x^2\le0$ (Quiz 4 Q7)

Only $x=0$ is feasible: $p^*=1$, attained. $L=(x-1)^2+\mu x^2$. Complete the square: $(1+\mu)x^2-2x+1=(1+\mu)\big(x-\frac{1}{1+\mu}\big)^2+1-\frac{1}{1+\mu}$, so $q(\mu)=\frac{\mu}{1+\mu}$. This is below 1 for every finite $\mu$ and tends to 1 as $\mu\to\infty$: $d^*=1$ (zero gap) but never attained. No KKT multiplier (C5).

p* = d* = 1 (never reached) q(μ) = μ/(1+μ) μ 10 510
J1: the dual function climbs towards 1 but never reaches it, so the dual optimum is not attained.
J2. $\min e^x$ s.t. $x\le0$

Slater point $x=-1$. $p^*=\inf_{x\le0}e^x=0$, not attained. $L=e^x+\mu x$. If $\mu=0$: $\inf e^x=0$. If $\mu\gt0$: as $x\to-\infty$, $e^x\to0$ and $\mu x\to-\infty$, so $q=-\infty$. So $\mathbb{D}\cap\{\mu\ge0\}=\{0\}$, $d^*=q(0)=0$: zero gap, dual attained, primal not.

J3. $\min-2u+(v-1)^2$ s.t. $u-1\le0$ (Quiz 4 Q10, tutorial III)

Slater point $(0,1)$. $L=(\mu-2)u+(v-1)^2-\mu$. Linear in $u$: finite only if $\mu=2$; then $\inf_v$ gives $q(2)=-2$, so $\mu^*=2$, $d^*=-2$. Primal: $f+2=2(1-u)+(v-1)^2\ge0$ on the feasible set, zero only at $(1,1)$: $p^*=-2$. But $L(u,v,2)=(v-1)^2-2$ doesn't depend on $u$: its minimisers are the whole line $v=1$. Recovery doesn't apply; CS $2(u-1)=0$ selects $u=1$. Note $(0,1)$ is feasible and minimises $L$ but is not optimal ($f=1$).

J4. $\min x$ s.t. $-x\le0$ (notes Example 7.4.2)

Done in E2 and I: $\mu^*=1$, $L(\cdot,1)\equiv0$, $x=-1$ minimises $L$ but is infeasible.

J5. $\min_{x\in\mathbb{R},\,y\gt0}e^{-x}$ s.t. $x^2/y\le0$ (Quiz 4 Q8, Ch 7 problem 5)

$y\gt0$ and $x^2/y\le0$ force $x=0$: $p^*=e^0=1$ at every $(0,y)$. Slater fails (no point with $x^2/y\lt0$). The domain $y\gt0$ stays in the inner infimum: $q(\mu)=\inf_{x,\,y\gt0}\big(e^{-x}+\mu x^2/y\big)$. $L\gt0$ always, and along $x=k$, $y=k^4$: $L=e^{-k}+\mu/k^2\to0$. So $q(\mu)=0$ for every $\mu\ge0$, never reached inside. $d^*=0$ (attained by any $\mu\ge0$). Gap $=1$, both attained. Thm 7.4.1 doesn't apply (restricted domain).

K. A full QP dual by hand (Ch 7 tutorial problem V; "dual function by completing the square + primal recovery")

$\displaystyle\min_{x\in\mathbb{R}^2}\tfrac12(2x_1^2+x_2^2)$ s.t. $h(x)=x_1+x_2-4=0$, $g(x)=2-x_1\le0$.

Every step
  1. Convexity and a Slater point. $f$ has Hessian $\mathrm{diag}(2,1)$, PD, so $f$ is strictly convex; $h$, $g$ affine: a convex problem. $p^*$ is finite because $f\ge0$ and the feasible set is nonempty. Slater point $x^0=(3,1)$: $h=0$, $g=-1\lt0$ ✓. So (G) zero gap and a dual optimum exist; (C4) any KKT point is the global minimiser; strict convexity ⇒ unique.
  2. Lagrangian ($\lambda$ free, $\mu\ge0$): $L=x_1^2+\tfrac12x_2^2+\lambda(x_1+x_2-4)+\mu(2-x_1)$.
  3. Inner minimisation. For any $(\lambda,\mu)$, $L$ is a PD quadratic in $x$, so set $\nabla_xL=0$: $\partial_{x_1}L=2x_1+\lambda-\mu=0\Rightarrow x_1=\frac{\mu-\lambda}{2}$; $\ \partial_{x_2}L=x_2+\lambda=0\Rightarrow x_2=-\lambda$. Finite for all prices: $\mathbb{D}=\mathbb{R}^2$.
  4. Substitute, term by term: $x_1^2+\frac12x_2^2=\frac{(\mu-\lambda)^2}{4}+\frac{\lambda^2}{2}$; $\lambda(x_1+x_2-4)=\frac{\lambda(\mu-\lambda)}{2}-\lambda^2-4\lambda$; $\mu(2-x_1)=2\mu-\frac{\mu(\mu-\lambda)}{2}$. The two mixed terms combine: $\frac{\lambda(\mu-\lambda)}{2}-\frac{\mu(\mu-\lambda)}{2}=-\frac{(\mu-\lambda)^2}{2}$. Adding everything: $$q(\lambda,\mu)=-\tfrac14(\lambda-\mu)^2-\tfrac12\lambda^2-4\lambda+2\mu.$$
  5. Complete the squares. Let $t=\lambda-\mu$. Then $-4\lambda+2\mu=-2t-2\lambda$, so $q=-\frac14(t^2+8t)-\frac12(\lambda^2+4\lambda)=-\frac14\big[(t+4)^2-16\big]-\frac12\big[(\lambda+2)^2-4\big]$: $$q(\lambda,\mu)=6-\tfrac14(\lambda-\mu+4)^2-\tfrac12(\lambda+2)^2.$$
  6. Maximise over $\lambda$ free, $\mu\ge0$: both squares can be made 0: $\lambda^*=-2$, $\lambda^*-\mu^*+4=0\Rightarrow\mu^*=2\ge0$ ✓. $d^*=6$. (If the free maximiser had $\mu\lt0$, you'd have to maximise on the boundary $\mu=0$ instead; Q19(e) shows that case.)
  7. Recover (section I): $L(x,-2,2)=x_1^2-4x_1+\tfrac12x_2^2-2x_2+12=(x_1-2)^2+\tfrac12(x_2-2)^2+6$, unique minimiser $\bar x=(2,2)$, so $x^*=(2,2)$. (Note: $\lambda^*$ is negative only because of how we wrote $h$, in the $Ax-b$ form $x_1+x_2-4$; with $h=4-x_1-x_2$ it would be $+2$. See the convention table in L1.)
  8. Check everything: $x_1+x_2=4$ ✓; $x_1=2\ge2$ (active) ✓; $p^*=\tfrac12(8+4)=6=d^*$ ✓. Stationarity: $(2x_1,x_2)+\lambda(1,1)+\mu(-1,0)=(4-2-2,\,2-2)=(0,0)$ ✓. CS: $\mu(2-x_1)=2\cdot0=0$ ✓.
This QP: move the prices, watch the bound

Drag the red point in the price plane (or use the sliders). Left: where the minimiser $x(\lambda,\mu)$ of $L$ over all $x$ lands. Bottom: $q(\lambda,\mu)$ on a number line against $p^*=6$. Same $h=x_1+x_2-4$, $g=2-x_1$ as above.

What to notice: wherever you put the prices, $q$ stays left of 6 (weak duality). The blue rings are level curves of $q$; the top of the hill is $(\lambda^*,\mu^*)=(-2,2)$ with $q=6$, so $d^*=p^*=6$ (zero gap, as Slater promised). Only there does $x(\lambda,\mu)$ land on the green feasible ray, at $x^*=(2,2)$; elsewhere it is infeasible. $\lambda^*$ is negative only because $h$ is written $x_1+x_2-4$. Try $(0,0)$ and $(-1,1)$: $q=0$ and $4.5$, the numbers from section F.
Trap: two errors in older summaries The end-term guide's one-liner says "$2x_1^2+x_2^2$ … $x^*=(1,2)$". Wrong: $(1,2)$ is not even feasible ($1+2=3\ne4$, and $1\lt2$). The objective has a $\tfrac12$ and the answer is $x^*=(2,2)$, $\lambda^*=-2$, $\mu^*=2$, $p^*=d^*=6$ (checked with sympy). The handwritten tutorial solution's completed square shows $\tfrac12(\lambda-\mu+4)^2$; the correct coefficient is $\tfrac14$ (same maximiser, same value).
Check K. Use the same steps on $\min\frac12(x_1^2+x_2^2)$ s.t. $x_1+x_2=2$ (no inequality). Find $q(\lambda)$, $\lambda^*$, $x^*$.
Show answer

$L=\frac12(x_1^2+x_2^2)+\lambda(x_1+x_2-2)$; $\nabla_x L=0$: $x_1=x_2=-\lambda$. $q=\lambda^2-2\lambda^2-2\lambda=-\lambda^2-2\lambda$, max at $\lambda^*=-1$, $d^*=1$. Recover $x^*=(1,1)$, $p^*=\frac12(1+1)=1$ ✓.

L. LP duality from scratch

A linear program (LP) has a linear cost and linear constraints. Everything above applies, and it becomes very clean because the Lagrangian is linear in $x$: the rule from E2 ("coefficient of $x$ must vanish") does all the work.

L1. A tiny LP, every step

Sign convention first (used throughout L): an equality row $a_i^Tx=b_i$ can be written as $h=0$ in two ways, $a_i^Tx-b_i=0$ or $b_i-a_i^Tx=0$. Both are correct. In section L we always write $b_i-a_i^Tx$ (his derivation in Ch 7 §7.6), because then the dual comes out as "$\max b^T\lambda$". The other choice just flips the sign of that price. Pick one and don't switch mid-problem. Inequality rows have no such choice: they are always written in the course form $g_i(x)\le0$ with a price $\mu_i\ge0$, so an inequality price is always $\ge0$, everywhere on this page.

Convention table: which way round is $h$ written on this page?
WhereEquality written asEffect on the price $\lambda$
Sections D–K (incl. the QP in K), Q18, Q19$h=a^Tx-b$ (e.g. $x_1+x_2-4$)$\lambda$ = the course's plain multiplier
Section L, the conversion table, Q16, Q17, Q36$h=b-a^Tx$ (e.g. $3-x_1-x_2$)$\lambda$ is minus the one you'd get with $a^Tx-b$
Every inequality row, everywhere$g\le0$: $\ge$ row → $b_i-a_i^Tx\le0$; $\le$ row → $a_i^Tx-b_i\le0$price $\mu_i\ge0$, never flips

What flips when you switch the equality form: the sign of every equality price, nothing else. $x^*$, $p^*$, $d^*$ and the inequality prices $\mu$ are unchanged. Example: in K, $\lambda^*=-2$; had we written $h=4-x_1-x_2$, we'd get $\lambda^*=+2$.

$\min x_1+2x_2$ s.t. $x_1+x_2=3$, $x_1\ge0$, $x_2\ge0$. (Obvious answer: put everything on the cheaper $x_1$: $x^*=(3,0)$, $p^*=3$.)

  1. Constraint forms: $h=3-x_1-x_2=0$ (price $\lambda$, free); $-x_1\le0$, $-x_2\le0$ (prices $\mu_1,\mu_2\ge0$).
  2. Lagrangian, collected by $x$: $L=x_1+2x_2+\lambda(3-x_1-x_2)-\mu_1x_1-\mu_2x_2=(1-\lambda-\mu_1)x_1+(2-\lambda-\mu_2)x_2+3\lambda$.
  3. Coefficients must vanish (else $q=-\infty$): $\mu_1=1-\lambda$, $\mu_2=2-\lambda$. Then $q=3\lambda$.
  4. Eliminate the sign prices: $\mu_1\ge0\iff\lambda\le1$; $\mu_2\ge0\iff\lambda\le2$.
  5. Dual: $\max 3\lambda$ s.t. $\lambda\le1$, $\lambda\le2$. So $\lambda^*=1$, $d^*=3=p^*$ ✓.
  6. Meaning of $\lambda^*$: if the right-hand side 3 became 4, the cost would rise by $1=\lambda^*$. The price of a constraint = how much the optimum would change per unit of its right-hand side.

L2. The standard pair, LP weak duality and LP KKT

As set in L1, the equality rows are written $h(x)=b-Ax$ (using $Ax-b$ would replace $\lambda$ by $-\lambda$ everywhere).

$\min c^Tx$ s.t. $Ax=b$, $x\ge0$. Prices: $\lambda\in\mathbb{R}^m$ (free) for $b-Ax=0$; $\mu\in\mathbb{R}^n$, $\mu\ge0$ for $-x\le0$.

$$L=c^Tx+\lambda^T(b-Ax)-\mu^Tx=(c-A^T\lambda-\mu)^Tx+b^T\lambda.$$

(We used $\lambda^TAx=(A^T\lambda)^Tx$.) Linear in $x$, so by E2:

$$q(\lambda,\mu)=\begin{cases}b^T\lambda,& A^T\lambda+\mu=c\\-\infty,&\text{otherwise.}\end{cases}$$

Eliminate $\mu=c-A^T\lambda$; $\mu\ge0\iff A^T\lambda\le c$. Hence the pair he said is worth memorizing:

Standard LP pair $$\text{(P)}\ \ \min_x c^Tx\ \text{ s.t. } Ax=b,\ x\ge0\qquad\Longleftrightarrow\qquad\text{(D)}\ \ \max_\lambda b^T\lambda\ \text{ s.t. } A^T\lambda\le c\quad(\lambda\text{ free}).$$

LP weak duality in one line: for feasible $x$ and $\lambda$, $c^Tx-b^T\lambda=c^Tx-\lambda^TAx=(c-A^T\lambda)^Tx=\mu^Tx\ge0$.

LP KKT (You have to remember it):

$$A^T\lambda^*+\mu^*=c,\quad \mu^*\ge0,\quad Ax^*=b,\quad x^*\ge0,\quad (\mu^*)^Tx^*=0.$$

Where the first equation comes from: it is the general stationarity $\nabla f+J_h\lambda+J_g\mu=0$ with $f=c^Tx$ ($\nabla f=c$), $h=b-Ax$ ($J_h=-A^T$) and $g=-x$ ($J_g=-I$): $c-A^T\lambda-\mu=0$. Why no LICQ is needed: in Ch 6, LICQ was there to make sure the linearised constraints describe the feasible directions correctly. When the constraints are already linear, their linearisation is the constraints themselves, so this is automatic: every LP minimum has KKT multipliers.

Value identity: $c^Tx^*=(A^T\lambda^*+\mu^*)^Tx^*=b^T\lambda^*+0$.

Complementary slackness in LP words. $(\mu^*)^Tx^*=\sum_j\mu_j^*x_j^*=0$ with every term $\ge0$, so for each $j$: $x_j^*\gt0\Rightarrow\mu_j^*=0$, i.e. dual constraint $j$ is tight ($(A^T\lambda^*)_j=c_j$); and dual constraint $j$ slack ($\mu_j^*\gt0$) $\Rightarrow x_j^*=0$. This is how you get one solution from the other.

Worked example: Ch 7 tutorial problem II (Problem set part 2, II)

$\min 2x_1+3x_2+6x_3$ s.t. $x_1+x_2+x_3=5$, $2x_1+x_2=6$, $x\ge0$.

  1. $A=\begin{pmatrix}1&1&1\\2&1&0\end{pmatrix}$, $b=(5,6)$, $c=(2,3,6)$. Dual: $\max 5\lambda_1+6\lambda_2$ s.t. $\lambda_1+2\lambda_2\le2$, $\lambda_1+\lambda_2\le3$, $\lambda_1\le6$; $\lambda$ free. (One dual constraint per column of $A$, i.e. per primal variable.)
  2. Try $\lambda=(4,-1)$: $\mu=c-A^T\lambda=(2-2,\ 3-3,\ 6-4)=(0,0,2)\ge0$ ✓ dual feasible; dual value $20-6=14$.
  3. CS: $\mu_3=2\gt0$ ⇒ $x_3=0$. Then $x_1+x_2=5$, $2x_1+x_2=6$ ⇒ $x=(1,4,0)\ge0$ ✓. Primal value $2+12=14$.
  4. Equal values ⇒ both optimal (weak duality certificate). $p^*=d^*=14$ (checked with linprog). Since $x_1,x_2\gt0$, CS forces the first two dual constraints tight ⇒ $\lambda=(4,-1)$ is the unique dual optimum.
Check L2. Write the dual of $\min x_1+x_2+x_3$ s.t. $x_1+2x_2+3x_3=6$, $x\ge0$, and solve it.
Show answer

$\max 6\lambda$ s.t. $\lambda\le1$, $2\lambda\le1$, $3\lambda\le1$ ⇒ $\lambda^*=\frac13$, $d^*=2$. CS: only dual constraint 3 is tight, so only $x_3$ may be positive: $x^*=(0,0,2)$, $p^*=2$ ✓.

L3. Any other LP form (what he will give you)

Method: don't memorise many duals. Run the same recipe: rewrite each constraint, write $L$, collect the coefficient of each $x_j$, set it to zero, eliminate the sign prices. Three patterns:

  • Free variable $x_j$ (no sign constraint, so no sign price): its coefficient in $L$ must be exactly 0 ⇒ an equality in the dual.
  • $x_j\ge0$: write $-x_j\le0$ with price $\sigma_j\ge0$; adds $-\sigma_jx_j$; eliminating $\sigma_j\ge0$ gives "$\le$" ⇒ an inequality in the dual. ($x_j\le0$ adds $+\sigma_jx_j$ and gives "$\ge$".)
  • Inequality row: rewrite as $g_i\le0$; its price $\mu_i\ge0$. Equality row: price $\lambda_i$ free.

How each row enters $L$ (stated explicitly):

  • $=$ row ($a_i^Tx=b_i$): $h_i=b_i-a_i^Tx$, term $\lambda_i(b_i-a_i^Tx)$, $\lambda_i$ free.
  • $\ge$ row ($a_i^Tx\ge b_i$): $g_i=b_i-a_i^Tx\le0$, term $\mu_i(b_i-a_i^Tx)$, $\mu_i\ge0$. Same sign pattern as an equality row: $+b_i\mu_i$ in the dual objective.
  • $\le$ row ($a_i^Tx\le b_i$): $g_i=a_i^Tx-b_i\le0$, term $\mu_i(a_i^Tx-b_i)$, $\mu_i\ge0$. Opposite sign pattern: $-b_i\mu_i$ in the dual objective, and its column entries $a_{ij}$ enter with a minus too.

Collect: the constant term of $L$ is the dual objective $\sum_{=,\ \ge\text{ rows}}b_i\cdot(\text{price}_i)\;-\sum_{\le\text{ rows}}b_i\mu_i$, and the coefficient of $x_j$ is $c_j-R_j\mp\sigma_j$, where $R_j=\sum_{=,\ \ge\text{ rows}}a_{ij}\cdot(\text{price}_i)\;-\sum_{\le\text{ rows}}a_{ij}\mu_i$ (the same recipe with column $j$ of $A$ in place of $b$). With only $=$ rows, $R_j=(A^T\lambda)_j$, as in L2.

Conversion table for a MIN primal (a check, not a replacement for the derivation)

Table 1: each constraint ROW gives a dual VARIABLE (its sign and how it enters)

Primal row $i$Dual variable (price)Enters objective and $R_j$ as
$a_i^Tx\ge b_i$$\mu_i\ge0$$+b_i\mu_i$, $+a_{ij}\mu_i$
$a_i^Tx=b_i$$\lambda_i$ free$+b_i\lambda_i$, $+a_{ij}\lambda_i$
$a_i^Tx\le b_i$$\mu_i\ge0$$-b_i\mu_i$, $-a_{ij}\mu_i$

Table 2: each primal VARIABLE gives a dual CONSTRAINT

Primal variable $x_j$Dual constraint $j$
$x_j\ge0$$R_j\le c_j$
$x_j$ free$R_j=c_j$
$x_j\le0$$R_j\ge c_j$

Every inequality price is $\ge0$; only equality prices are free. Shortcut for a $\le$ row: multiply it by $-1$ ($-a_i^Tx\ge-b_i$), and it becomes a $\ge$ row with data $(-a_i,-b_i)$. Check: standard form ($=$ rows, $x\ge0$) gives $\lambda$ free, $A^T\lambda\le c$ ✓. Table 2 comes from "coefficient of $x_j$ = $c_j-R_j\mp\sigma_j=0$, $\sigma_j\ge0$". Other books (and some answer keys) put a $\le$ row's price on $b_i-a_i^Tx$ instead, so it appears as "$\le0$"; that variable is just $-\mu_i$, and the dual value is the same.

Worked example: mixed form (a ≥ row, an = row, a free variable)

$\min 2x_1+3x_2$ s.t. $x_1+x_2\ge4$, $x_1-x_2=1$, $x_1\ge0$, $x_2$ free.

  1. Rows: $\ge$ row → $g_1=4-x_1-x_2\le0$, term $\mu_1(4-x_1-x_2)$, $\mu_1\ge0$; $=$ row → $h_2=1-x_1+x_2$, term $\lambda_2(1-x_1+x_2)$, $\lambda_2$ free. Signs: $-x_1\le0$ → $-\sigma_1x_1$, $\sigma_1\ge0$; $x_2$ free → no term.
  2. $L=2x_1+3x_2+\mu_1(4-x_1-x_2)+\lambda_2(1-x_1+x_2)-\sigma_1x_1=(2-\mu_1-\lambda_2-\sigma_1)x_1+(3-\mu_1+\lambda_2)x_2+4\mu_1+\lambda_2$.
  3. Coefficients vanish: $\sigma_1=2-\mu_1-\lambda_2\ge0$ (so $\mu_1+\lambda_2\le2$) and $3-\mu_1+\lambda_2=0$ (so $\mu_1-\lambda_2=3$, an equality because $x_2$ is free).
  4. Dual: $\max 4\mu_1+\lambda_2$ s.t. $\mu_1+\lambda_2\le2$, $\mu_1-\lambda_2=3$, $\mu_1\ge0$, $\lambda_2$ free. (Tables 1–2 agree.)
  5. Solve: $\lambda_2=\mu_1-3$, so $2\mu_1-3\le2\Rightarrow\mu_1\le2.5$, objective $5\mu_1-3$: $(\mu_1^*,\lambda_2^*)=(2.5,-0.5)$, $d^*=9.5$.
  6. Primal check: $x_1=1+x_2$, row 1 gives $1+2x_2\ge4\Rightarrow x_2\ge1.5$, cost $2+5x_2$: $x^*=(2.5,1.5)$, $p^*=9.5=d^*$ ✓ (linprog). CS: $\mu_1\gt0$ and row 1 tight ($4=4$) ✓; $x_1\gt0$ and $\sigma_1=2-2.5+0.5=0$ ✓.
This LP: primal and dual side by side

Drag the red point along the primal feasible ray and the blue point along the dual feasible segment (or use the sliders). The number line compares $c^Tx$ with the dual value $4\mu_1+\lambda_2$.

What to notice: the blue dual value is always left of the red primal cost (LP weak duality), whichever pair you pick. Push the primal point towards lower cost and the dual point towards higher value: they meet at 9.5, at $x^*=(2.5,1.5)$ and $(\mu_1^*,\lambda_2^*)=(2.5,-0.5)$. The gap is exactly the complementary-slackness products, so zero gap ⇔ CS holds. The feasible sets are a ray and a segment (not 2-D regions) because the $=$ row and the free $x_2$ each turn into an equality.
Worked example: inequality form, $x$ free

$\min c^Tx$ s.t. $Ax\le b$, $x$ free. Rows are $\le$, so $g=Ax-b\le0$ with prices $\mu\ge0$: $L=c^Tx+\mu^T(Ax-b)=(c+A^T\mu)^Tx-b^T\mu$. $x$ free ⇒ $A^T\mu=-c$. Dual: $\max -b^T\mu$ s.t. $A^T\mu=-c$, $\mu\ge0$.

(Some books write this as $\max b^Ty$ s.t. $A^Ty=c$, $y\le0$: that is the same dual with $y=-\mu$. Same value.)

Max problems

Convert first: $\max c^Tx=-\min(-c^Tx)$. Derive the dual of the min, then flip back. For $\max c^Tx$ s.t. $Ax\le b$, $x\ge0$: the min problem $\min(-c^Tx)$ has (with $w\ge0$ the course price of $Ax-b\le0$) the dual $\max(-b^Tw)$ s.t. $A^Tw\ge c$, $w\ge0$. Flip back using $-\max(-b^Tw)=\min b^Tw$: the max primal's dual is $\min b^Tw$ s.t. $A^Tw\ge c$, $w\ge0$, and both optimal values equal $\max c^Tx$ (Q15 does every step).

Worked example: the self-dual LP (Midterm 2 Q II, summary; letters as on the paper)

Here $q\in\mathbb{R}^N$ is a given vector (not the dual function) and $M$ is a given matrix with $M^T=-M$. $\min q^Tz$ s.t. $Mz\ge-q$, $z\ge0$. Prices $\lambda\ge0$ for $-Mz-q\le0$, $\mu\ge0$ for $-z\le0$. Using $-\lambda^TMz=-(M^T\lambda)^Tz=(M\lambda)^Tz$: $L=(q+M\lambda-\mu)^Tz-q^T\lambda$. Finite iff $\mu=q+M\lambda$; $\mu\ge0\iff M\lambda\ge-q$. Dual: $\max -q^T\lambda$ s.t. $M\lambda\ge-q$, $\lambda\ge0$: the same feasible set, so $d^*=-p^*$. Since $z^TMz=0$, every feasible $z$ has $q^Tz=z^T(Mz+q)\ge0$. Feasible ⇒ bounded below by 0 ⇒ optimal (an LP that is feasible and bounded attains its minimum; stated in L4); LP strong duality ⇒ $p^*=d^*=-p^*$ ⇒ both $0$.

Check L3. Dual of $\min 3x_1+x_2$ s.t. $x_1+x_2\ge2$, $x_1-x_2=0$, $x_1\ge0$, $x_2$ free (just write it).
Show answer

$L=3x_1+x_2+\mu_1(2-x_1-x_2)+\lambda_2(0-x_1+x_2)-\sigma_1x_1=(3-\mu_1-\lambda_2-\sigma_1)x_1+(1-\mu_1+\lambda_2)x_2+2\mu_1$. Dual: $\max 2\mu_1$ s.t. $\mu_1+\lambda_2\le3$ ($x_1\ge0$), $\mu_1-\lambda_2=1$ ($x_2$ free), $\mu_1\ge0$ ($\ge$ row), $\lambda_2$ free ($=$ row). (Solving: $\lambda_2=\mu_1-1$, so $2\mu_1-1\le3$, $\mu_1^*=2$, $\lambda_2^*=1$, $d^*=4$; primal $x=(1,1)$, cost $4$ ✓.)

L4. The LP duality theorem

LP duality theorem

(i) If (P) or (D) has an optimal solution, so does the other, and the optimal values are equal (no gap, no Slater needed).

(ii) If one is unbounded (its value is $-\infty$ for a min, $+\infty$ for a max), the other is infeasible. (Reason: by weak duality any feasible point of the other side would be a finite bound.)

The converse of (ii) is FALSE. Being d infeasible doesn't imply p unbounded. Both can be infeasible.

Attainment fact (used below and in the self-dual argument): a feasible LP whose cost is bounded below (for a min) always attains its minimum. Unlike $\min e^x$ (J2), an LP can't creep towards a value without reaching it. So for an LP, "feasible and not unbounded" = "has an optimal solution".

Worked counter-example: both infeasible

$A=[0]$, $b=1$, $c=-1$ (one variable). (P): $\min -x$ s.t. $0\cdot x=1$, $x\ge0$: no $x$ satisfies $0=1$, infeasible. (D): $\max\lambda$ s.t. $0\cdot\lambda\le-1$: $0\le-1$ is false, infeasible.

So for an LP pair exactly one of these happens: both optimal with equal values; one unbounded and the other infeasible; both infeasible.

Check L4. (P) is a min LP and has a feasible point with cost 7; (D) is infeasible. What is (P)?
Show answer

(P) is feasible, so by (i) it cannot have an optimum (else (D) would too). A feasible LP without an optimum is unbounded: $p^*=-\infty$. (Infeasible (D) alone would not have told you this; you needed (P) feasible.)

M. The exam recipe

Recipe for "derive the dual" (write every step in the exam)
  1. Rewrite constraints as $h(x)=0$, $g(x)\le0$ (e.g. $x_1\ge2\to 2-x_1\le0$; $x\ge0\to -x\le0$). Name multipliers: $\lambda$ free for $h$, $\mu\ge0$ for $g$. Max problem? Convert to min first.
  2. Write $L=f+\lambda^Th+\mu^Tg$ and collect terms in $x$.
  3. Take $\inf$ over all $x\in\mathbb{R}^n$ (no constraints put back). Linear parts: coefficient $=0$. Quadratic parts: $\nabla_xL=0$.
  4. Write $q$ with its domain $\mathbb{D}$ (where it is $\gt-\infty$).
  5. Eliminate "slack" multipliers (those that appear only in the coefficient conditions, e.g. $\mu$ for $x\ge0$): $\mu=\ldots\ge0$ becomes an inequality on the rest.
  6. Dual: maximise $q$ over the remaining multipliers with their sign restrictions. LP: check against the conversion table.
  7. (QP) Maximise; check $\mu^*\ge0$ (if the unconstrained maximiser has $\mu\lt0$, maximise on the boundary $\mu=0$). Recover $\bar x=\arg\min_xL(x,\lambda^*,\mu^*)$; if unique it is $x^*$. Check $p^*=d^*$. Name a Slater point.

Theorem statements to have word-perfect (possible no-sheet short-answer part): convex feasible set rules; KKT ⇒ global min for convex problems (and not necessary without CQ); weak duality + proof; $q$ concave + proof; Slater (what it gives / doesn't); Thm 7.4.1; Cor 7.4.2; LP pair, LP KKT, LP duality theorem with the false converse. All are on the Summary card.

What the professor said about this

In class
  • different form of linear program I will give and ask you to derive the dual Ch 7 lec 3 [1:08:00] → expect a non-standard LP (free variables, $\ge$ rows, max form). Practise Q15–Q18 and Q36.
  • The infimum is finite if and only if the coefficients of x vanishes. That is very important thing. Ch 7 lec 3 [1:10:30] → this one sentence is the whole LP-dual derivation (E2).
  • Standard LP dual is worth memorizing; if you memorize, you save time Ch 7 lec 3 [1:14:00] (the guide notes he estimated 10–15 minutes lost re-deriving).
  • LP KKT system: You have to remember it. Ch 7 lec 3 [1:00:00]; in Ch 8 he said stationarity is the one part to memorise Ch 8 lec 2 [13:30].
  • Always remember that you have these five equations. Ch 7 lec 3 [53:30] → always write all five KKT parts.
  • KKT sufficiency for convex problems: this section is very important Ch 7 lec 1 [1:08:00] → became Midterm 2 Q I (section C4).
  • Weak duality: it's used frequently. You should always remember this. Ch 7 lec 2 [1:18:30]
  • Be sure that you don't write concave optimization problem. Never, exam. Ch 7 lec 2 [59:30]; there is nothing called concave set Ch 7 lec 2 [1:08:30].
  • Many students make that mistake. Being d infeasible doesn't imply p unbounded. Ch 7 lec 3 [1:38:00]
  • Tutorial: in the midterm, I will not give this form … you need to know how to build your Lagrangian Ch 6–7 tutorial 1 [35:00] → constraints come in non-standard form; convert to $h=0$, $g\le0$ yourself.
  • Tutorial problems: similar problems you can expect Ch 6–7 tutorial 1 [01:30]; Midterm 2 was mostly repetition of tutorial/problem-set problems (Ch 8 lec 1 [01:30], per the guide).
  • He mentioned a possible short-answer part written without any sheet Ch 7 lec 3 [1:14:30] → the theorem statements on the Summary card must be word-perfect, in the course's own forms (other books' forms "not accepted", Ch 7 lec 2 [41:00]).

Practice (try first, then open the answer)

Order: Quiz 4 (Q1–Q12, past paper) → new MCQs (Q13–Q16) → new descriptive (Q17–Q19, Q36) → Midterm 2 Q I and Q II (Q20–Q35, past paper). Numbers checked with sympy / scipy linprog. Letters: past-paper questions keep the letters printed on the paper (Quiz 4 writes $\eta$ or $\nu$ for multipliers; Midterm 2 Q I uses $y$ for "another feasible point", Q II uses $y$ for the LP dual variable). Each question says what its letters mean. If short on time, do at least Q1–Q12, Q17, Q18, Q19 and Q28–Q33.

Part A · Quiz 4 (all 12, past paper)

Q1 Quiz 4 Q1 (past paper)MCQ

Let $f(x_1,x_2)=x_1^2-x_2^2$ and $\Omega_a=\{(t,at):t\in\mathbb{R}\}$. For exactly which $a$ is the restriction of $f$ to $\Omega_a$ convex?

  1. (a) $|a|\le1$.
  2. (b) $|a|\lt1$.
  3. (c) $|a|\ge1$.
  4. (d) For no $a$, because the full Hessian of $f$ is indefinite.
Show answer

Answer: (a). $\phi_a(t)=f(t,at)=(1-a^2)t^2$, $\phi_a''=2(1-a^2)\ge0\iff|a|\le1$.

(b) drops $a=\pm1$, where $\phi$ is constant: constant functions are convex (just not strictly). (c) is where the restriction is concave. (d) The ambient Hessian is irrelevant; only curvature along the line counts.

Q2 Quiz 4 Q2 (past paper)MCQ

$q(\eta)=\inf_{x\in D}L(x,\eta)$ where $L$ is affine in $\eta$ for each fixed $x$; $\mathcal{D}=\{\eta:q(\eta)\gt-\infty\}$ nonempty, $q$ never $+\infty$. Which must hold?

  1. (a) $q$ is convex and $\mathcal{D}$ is convex.
  2. (b) $q$ is concave only when the primal objective is strictly convex.
  3. (c) $q$ is concave, but $\mathcal{D}$ need not be convex.
  4. (d) $q$ is concave and $\mathcal{D}$ is convex, even when the primal problem is nonconvex.
Show answer

Answer: (d). Infimum of affine functions is concave; finiteness at two endpoints plus concavity keeps the combination finite, so $\mathcal{D}$ is convex. No convexity of $f,g$ is used.

(a) $q$ is concave, not convex. (b) concavity needs nothing from the primal. (c) $\mathcal{D}$ is always convex.

Q3 Quiz 4 Q3 (past paper)MCQ

A primal-feasible $\hat x$ and a dual-feasible $\hat\eta$ satisfy $f(\hat x)=7$, $q(\hat\eta)=4$. Neither is known to be optimal. Which must hold?

  1. (a) $4\le p^*\le d^*\le7$.
  2. (b) $4\le d^*\le p^*\le7$.
  3. (c) $p^*\le4\le7\le d^*$.
  4. (d) $p^*=7$ and $d^*=4$.
Show answer

Answer: (b). $4=q(\hat\eta)\le d^*$ (sup), $d^*\le p^*$ (weak duality), $p^*\le f(\hat x)=7$ (inf).

(a) puts $p^*\le d^*$: wrong direction of weak duality. (c) reverses both bounds. (d) treats feasible values as optimal.

Q4 Quiz 4 Q4 (past paper; also Ch 7 problem 3)MCQ

$\min_{x\in\mathbb{R}}x^2+1$ s.t. $(x-2)(x-4)\le0$, $L=x^2+1+\lambda(x-2)(x-4)$. The dual function for $\lambda\ge0$ and its maximiser? (The quiz calls this inequality price $\lambda$; section E3 does the same problem with $\mu$.)

  1. (a) $q(\lambda)=10-\lambda-\frac{9}{1+\lambda}$, $\lambda^*=2$.
  2. (b) $q(\lambda)=10+\lambda-\frac{9}{1+\lambda}$, $\lambda^*=2$.
  3. (c) $q(\lambda)=10-\lambda-\frac{9}{1+\lambda}$, $\lambda^*=1$.
  4. (d) $q(\lambda)=5$ for every $\lambda\ge0$.
Show answer

Answer: (a). $L=(1+\lambda)x^2-6\lambda x+1+8\lambda$, minimiser $x_\lambda=\frac{3\lambda}{1+\lambda}$ (over all of $\mathbb{R}$), $q=1+8\lambda-\frac{9\lambda^2}{1+\lambda}=10-\lambda-\frac{9}{1+\lambda}$. $q'=-1+\frac{9}{(1+\lambda)^2}=0\Rightarrow\lambda^*=2$, $q(2)=5=f(2)$, $x^*=2$.

(b) sign error: then $q(2)=9\gt p^*=5$, violating weak duality. (c) $q'(1)=-1+\frac94\gt0$, still increasing. (d) comes from restricting the inner minimisation to $[2,4]$, which is not allowed.

Q5 Quiz 4 Q5 (past paper)MCQ

$f,g_i$ convex, $h$ affine, $\exists x^0$: $h(x^0)=0$, $g_i(x^0)\lt0$; $p^*$ finite. What does Slater's theorem guarantee?

  1. (a) Primal and dual optimal solutions both exist and are unique.
  2. (b) Zero gap and primal attainment; dual attainment need not hold.
  3. (c) Zero gap and dual attainment; primal attainment is not guaranteed.
  4. (d) Zero gap only if $f$ is strictly convex.
Show answer

Answer: (c). Exactly Thm 7.4.3.

(a) no uniqueness of anything. (b) swaps primal and dual ($e^x$, $x\le0$: Slater holds, primal not attained). (d) strict convexity is not a hypothesis.

Q6 Quiz 4 Q6 (past paper)MCQ

Differentiable convex program, affine equalities, convex inequalities, full space. Which condition is equivalent to the existence of a KKT pair?

  1. (a) Primal optimum finite and attained; nothing about the dual.
  2. (b) $p^*=d^*\in\mathbb{R}$; neither needs to be attained.
  3. (c) Dual optimum finite and attained; nothing about primal or gap.
  4. (d) $p^*=d^*\in\mathbb{R}$, and both are attained.
Show answer

Answer: (d). Thm 7.4.1. Proof idea: with zero gap and both attained, $q(\eta^*)\le L(x^*,\eta^*)\le f(x^*)$ has equal ends; the first equality gives stationarity, the second complementary slackness.

(a) fails for $(x-1)^2$, $x^2\le0$ (primal attained, no KKT). (b) same example: zero gap, still no KKT (dual not attained). (c) fails for $e^x$, $x\le0$ (dual attained, no primal optimum, so no KKT point).

Q7 Quiz 4 Q7 (past paper)MCQ

$\min(x-1)^2$ s.t. $x^2\le0$, $q(\mu)=\inf_x\big((x-1)^2+\mu x^2\big)$, $\mu\ge0$. Which is correct?

  1. (a) $p^*=d^*=1$, both attained.
  2. (b) $p^*=d^*=1$; primal attained, dual supremum not.
  3. (c) $p^*=1$, $d^*=0$, both attained.
  4. (d) $p^*=d^*=1$, neither attained.
Show answer

Answer: (b). Only feasible point $x=0$, $p^*=1$. $(x-1)^2+\mu x^2=(1+\mu)\big(x-\frac1{1+\mu}\big)^2+\frac{\mu}{1+\mu}$, so $q(\mu)=\frac{\mu}{1+\mu}\lt1$ for all finite $\mu$, $\to1$: $d^*=1$ not attained. No KKT multiplier ($-2=0$).

(a) dual not attained. (c) $d^*$ is the supremum, $1$, not $q(0)=0$. (d) the primal is attained at $x=0$.

Q8 Quiz 4 Q8 (past paper; Ch 7 problem 5)MCQ

$\min_{x\in\mathbb{R},\,y\gt0}e^{-x}$ s.t. $x^2/y\le0$. The domain $y\gt0$ stays in the inner infimum: $q(\lambda)=\inf_{x,\,y\gt0}\big(e^{-x}+\lambda x^2/y\big)$. Which is correct?

  1. (a) $p^*=1$, $d^*=0$, both attained; the inner infimum is not attained for any $\lambda\ge0$.
  2. (b) $p^*=d^*=1$, both attained; inner infimum attained at every dual optimum.
  3. (c) $p^*=1$, $d^*=0$; only the primal optimum is attained.
  4. (d) $p^*=1$, $d^*=0$, both attained; inner infimum attained for every $\lambda\ge0$.
Show answer

Answer: (a). $y\gt0$ and $x^2/y\le0$ force $x=0$: $p^*=1$ at every $(0,y)$. For any $\lambda\ge0$, along $x=k$, $y=k^4$: $L=e^{-k}+\lambda/k^2\to0$, and $L\gt0$ always, so $q(\lambda)=0$, never attained inside. $q\equiv0$ ⇒ every $\lambda\ge0$ is dual optimal, $d^*=0$ attained. Gap $=1$.

(b) $d^*=0$, not 1. (c) the dual is attained too ($q\equiv0$). (d) the inner infimum $0$ is never reached since $L\gt0$.

Q9 Quiz 4 Q9 (past paper)MCQ

Differentiable convex setting, $p^*=d^*\in\mathbb{R}$, both attained. $\bar\eta$ dual optimal and $L(\cdot,\bar\eta)$ has a unique global minimiser $\bar x$. What follows from the recovery corollary?

  1. (a) $\bar x$ is only a stationary point; primal feasibility must be assumed separately.
  2. (b) Feasibility follows, but complementary slackness must still be verified.
  3. (c) $\bar x$ is the unique primal optimum; feasibility and CS follow automatically.
  4. (d) Recovery also needs strict convexity of every $g_i$.
Show answer

Answer: (c). Any primal optimum $x^*$ with $\bar\eta$ is a KKT pair, so $x^*$ minimises the convex $L(\cdot,\bar\eta)$; uniqueness forces $x^*=\bar x$. Everything is inherited from $x^*$.

(a), (b) the extra checks are unnecessary under the corollary. (d) the hypothesis is uniqueness of the Lagrangian minimiser, not strict convexity.

Q10 Quiz 4 Q10 (past paper; tutorial III)MCQ

$\min_{u,v}-2u+(v-1)^2$ s.t. $u-1\le0$. $L=(\lambda-2)u+(v-1)^2-\lambda$, dual optimum $\lambda^*=2$. Which is correct?

  1. (a) The only minimiser of $L(\cdot,\cdot,2)$ is $(1,1)$, also the primal optimum.
  2. (b) The minimiser set is $\{(u,1):u\le1\}$, and every point in it is primal optimal.
  3. (c) The minimiser set is $\{(1,v):v\in\mathbb{R}\}$; only $(1,1)$ is primal optimal.
  4. (d) The minimiser set is $\{(u,1):u\in\mathbb{R}\}$; only $(1,1)$ is primal optimal.
Show answer

Answer: (d). $L(u,v,2)=(v-1)^2-2$, independent of $u$: minimisers are the whole line $v=1$. Primal: $f+2=2(1-u)+(v-1)^2\ge0$, zero only at $(1,1)$. CS $2(u-1)=0$ selects $u=1$.

(a) the minimiser is not unique. (b) $u$ is not restricted in the inner minimisation, and $(0,1)$ is not optimal. (c) wrong line: $v$ is fixed at 1, $u$ is free.

Q11 Quiz 4 Q11 (past paper)MCQ

$\min 2x_1+3x_2$ s.t. $x_1+x_2=1$, $x\ge0$, with $L=2x_1+3x_2+\nu(1-x_1-x_2)-\mu_1x_1-\mu_2x_2$, $\mu\ge0$. ($\nu$ is this quiz's name for the equality price, our $\lambda$.) After eliminating $\mu$, the dual is ($\nu\in\mathbb{R}$):

  1. (a) $\max\nu$ s.t. $\nu\le2,\ \nu\le3$.
  2. (b) $\max\nu$ s.t. $\nu\ge2,\ \nu\ge3$.
  3. (c) $\min\nu$ s.t. $\nu\le2,\ \nu\le3$.
  4. (d) $\max(-\nu)$ s.t. $\nu\le2,\ \nu\le3$.
Show answer

Answer: (a). $L=(2-\nu-\mu_1)x_1+(3-\nu-\mu_2)x_2+\nu$. Finite iff both coefficients vanish: $q=\nu$, $\mu_1=2-\nu\ge0$, $\mu_2=3-\nu\ge0$. $\nu^*=2=p^*$ at $x=(1,0)$ (linprog ✓).

(b) inequalities reversed. (c) a dual of a min is a max. (d) the constant term is $+\nu$.

Q12 Quiz 4 Q12 (past paper)MCQ

For (P) $\min c^Tx$, $Ax=b$, $x\ge0$ and (D) $\max b^T\nu$, $A^T\nu\le c$, which is always valid?

  1. (a) If (P) is infeasible, (D) must be unbounded above.
  2. (b) If either has an optimal solution, so does the other, with equal values.
  3. (c) If (P) is unbounded below, (D) is also unbounded above.
  4. (d) Every primal-feasible and dual-feasible pair has equal objective values.
Show answer

Answer: (b). LP duality theorem part (i).

(a) infeasible ⇏ unbounded ($A=[0]$, $b=1$, $c=-1$: both infeasible). (c) unbounded ⇒ the other is infeasible. (d) only $b^T\nu\le c^Tx$ (weak duality).

Part B · New MCQs in his style

Q13 New (based on notes Example 7.4.2)MCQ

$\min_{x\in\mathbb{R}}x$ s.t. $-x\le0$, $L=(1-\mu)x$, $\mu\ge0$. Slater holds ($x=1$) and the dual optimum is $\mu^*=1$. Which statement is correct?

  1. (a) Since Slater holds, every minimiser of $L(\cdot,1)$ is primal optimal.
  2. (b) $p^*=d^*=0$; $L(\cdot,1)\equiv0$, so every $x\in\mathbb{R}$ minimises it, and the recovery corollary cannot be used to find $x^*=0$.
  3. (c) Slater fails, because the optimum $x^*=0$ lies on the boundary of the feasible set.
  4. (d) Because $L(\cdot,1)$ has no unique minimiser, there is a positive duality gap.
Show answer

Answer: (b). $q(\mu)=0$ if $\mu=1$, $-\infty$ otherwise, so $d^*=0=p^*$. At $\mu^*=1$ the Lagrangian is identically $0$.

(a) $x=-1$ minimises $L(\cdot,1)$ but is infeasible; $x=1$ is feasible but violates CS ($1\cdot(-1)\ne0$) and is not optimal. Slater gives zero gap and dual attainment, nothing about Lagrangian minimisers. (c) Slater needs one strictly feasible point anywhere, not at the optimum. (d) the gap is zero; non-uniqueness affects recovery, not the gap.

Q14 New (Ch 7 problem set part 2, IV with t = 0)MCQ

$\min_{x\in\mathbb{R}}-3x$ s.t. $(x-1)^2\le0$, $L=-3x+\mu(x-1)^2$, $\mu\ge0$, inner infimum over all $x$. Which is correct?

  1. (a) Slater holds, so the dual optimum is attained.
  2. (b) $q(\mu)=-3-\frac{9}{4\mu}$ for $\mu\gt0$; $p^*=d^*=-3$; primal attained at $x=1$, dual not attained; no KKT multiplier exists at $x=1$.
  3. (c) $p^*=-3$ but $d^*=-\infty$, an infinite gap.
  4. (d) $L(\cdot,\mu)$ has a unique minimiser for every $\mu\gt0$, so the recovery corollary gives a KKT pair.
Show answer

Answer: (b). Only $x=1$ is feasible, $p^*=-3$. For $\mu\gt0$: $\partial_xL=-3+2\mu(x-1)=0\Rightarrow x=1+\frac{3}{2\mu}$, $q=-3-\frac9{2\mu}+\frac9{4\mu}=-3-\frac{9}{4\mu}$; $q(0)=-\infty$. Sup $=-3$ as $\mu\to\infty$, never reached. Stationarity at $x=1$: $-3+2\mu\cdot0=-3\ne0$.

(a) no $x$ has $(x-1)^2\lt0$: Slater fails. (c) $d^*$ is a supremum, $-3$. (d) the corollary needs a dual optimum (and a KKT pair) first; here no dual optimum exists.

Q15 New (max-form LP)MCQ

Which is the dual of $\ \max_x c^Tx$ s.t. $Ax\le b$, $x\ge0$? (The options call the dual variable $w$, one entry per row of $A$.)

  1. (a) $\min_w b^Tw$ s.t. $A^Tw\ge c$, $w\ge0$.
  2. (b) $\min_w b^Tw$ s.t. $A^Tw\le c$, $w\ge0$.
  3. (c) $\max_w b^Tw$ s.t. $A^Tw\ge c$, $w\ge0$.
  4. (d) $\min_w b^Tw$ s.t. $A^Tw=c$, $w\ge0$.
Show answer
  1. Convert to a min (section L3): $\max c^Tx=-\min(-c^Tx)$. So solve $\min -c^Tx$ s.t. $Ax-b\le0$, $-x\le0$.
  2. Course form $L=f+\mu^Tg$: multiplier $w\ge0$ for the rows $Ax-b\le0$, multiplier $\mu\ge0$ for $-x\le0$: $L=-c^Tx+w^T(Ax-b)-\mu^Tx=(A^Tw-c-\mu)^Tx-b^Tw$.
  3. Coefficient of $x$ must vanish: $\mu=A^Tw-c$; and $\mu\ge0\iff A^Tw\ge c$. Then $q=-b^Tw$.
  4. Dual of the min problem: $\max -b^Tw$ s.t. $A^Tw\ge c$, $w\ge0$. Undo the sign flip of step 1: the original max has dual $\min b^Tw$ with the same constraints. Answer (a).

(This is exactly the conversion table: in the min problem every row is a $\le$ row, so its price $w_i=\mu_i\ge0$ enters as $-b_iw_i$ and $-a_{ij}w_i$. Some books instead attach the price to $b_i-a_i^Tx$ and get a variable $-w\le0$; same dual, same value.)

(b) inequality direction lost. (c) the min/max flip is missing. (d) an equality would need $x$ free.

Numerical check: $c=(3,2)$, $A=\begin{pmatrix}1&1\\1&3\end{pmatrix}$, $b=(4,6)$: primal max $12$ at $x=(4,0)$; dual min $12$ at $w=(3,0)$ (linprog).

Q16 New (free variables)MCQ

Which is the dual of $\ \min_x c^Tx$ s.t. $Ax\ge b$, with $x$ free? ($\mu$ = one price per row of $A$; every row is an inequality.)

  1. (a) $\max_\mu b^T\mu$ s.t. $A^T\mu=c$, $\mu\ge0$.
  2. (b) $\max_\mu b^T\mu$ s.t. $A^T\mu\le c$, $\mu\ge0$.
  3. (c) $\max_\mu b^T\mu$ s.t. $A^T\mu=c$, $\mu$ free.
  4. (d) $\max_\mu -b^T\mu$ s.t. $A^T\mu=-c$, $\mu\ge0$.
Show answer

Answer: (a). $g=b-Ax\le0$, price $\mu\ge0$: $L=c^Tx+\mu^T(b-Ax)=(c-A^T\mu)^Tx+b^T\mu$. $x$ is free, so there is no sign multiplier $\sigma$ to absorb anything: the coefficient itself must be zero, $A^T\mu=c$. $q=b^T\mu$.

(b) is the dual when $x\ge0$ (the sign multiplier turns $=$ into $\le$). (c) is the dual of $Ax=b$ (equality rows give free prices). (d) is the dual of $Ax\le b$ (it comes from writing $Ax-b\le0$, the wrong direction for a $\ge$ constraint).

Check: $\min x_1+x_2$ s.t. $x_1+2x_2\ge2$, $2x_1+x_2\ge2$: $p^*=\frac43$ at $(\frac23,\frac23)$; dual $\mu=(\frac13,\frac13)$, $d^*=\frac43$ (linprog).

Part C · New descriptive problems (exam level)

Q17 New, in his style (≥ constraints)Descriptive

Consider $\ \min_{x\in\mathbb{R}^2}3x_1+2x_2$ s.t. $x_1+x_2\ge4$, $x_1+3x_2\ge6$, $x_1,x_2\ge0$.

(1) Rewrite the constraints in $g\le0$ form, build the Lagrangian, derive $q$ and its domain. (2) Eliminate the multipliers of $x\ge0$ and write the dual. (3) Show $x=(0,4)$ and $\mu=(2,0)$ are optimal for primal and dual. (4) Verify complementary slackness.

Hint

Rows: $4-x_1-x_2\le0$, $6-x_1-3x_2\le0$ with prices $\mu\ge0$; signs $-x\le0$ with $\sigma\ge0$. Collect the coefficient of each $x_j$.

Show answer
  1. $L=3x_1+2x_2+\mu_1(4-x_1-x_2)+\mu_2(6-x_1-3x_2)-\sigma_1x_1-\sigma_2x_2=(3-\mu_1-\mu_2-\sigma_1)x_1+(2-\mu_1-3\mu_2-\sigma_2)x_2+4\mu_1+6\mu_2$, $\mu,\sigma\ge0$.
  2. Inf over all $x\in\mathbb{R}^2$: $q=4\mu_1+6\mu_2$ if $\sigma_1=3-\mu_1-\mu_2$ and $\sigma_2=2-\mu_1-3\mu_2$; $-\infty$ otherwise. $\mathbb{D}$ = the prices satisfying these two equations.
  3. $\sigma\ge0$ ⇒ dual: $\max\ 4\mu_1+6\mu_2$ s.t. $\mu_1+\mu_2\le3$, $\mu_1+3\mu_2\le2$, $\mu\ge0$. (Matches the table: $\ge$ rows → $\mu_i\ge0$ entering with $+$; $x\ge0$ → $R_j\le c_j$.)
  4. Primal feasibility of $(0,4)$: $4\ge4$ ✓, $12\ge6$ ✓, value $8$. Dual feasibility of $(2,0)$: $2\le3$ ✓, $2\le2$ ✓, value $8$. Equal values + weak duality ⇒ both optimal, $p^*=d^*=8$ (linprog ✓).
  5. CS: row 2 slack ($12\gt6$) ⇒ $\mu_2=0$ ✓; $x_2=4\gt0$ ⇒ dual constraint 2 tight ($\mu_1+3\mu_2=2$) ✓; $\mu_1=2\gt0$ ⇒ row 1 tight ✓; $x_1=0$, no condition needed (dual constraint 1 slack: $2\lt3$, consistent with $x_1=0$).
Q18 New, in his style (free variable + mixed rows)Descriptive

Consider $\ \min x_1+2x_2$ s.t. $x_1+x_2=4$, $x_1-x_2\le2$, $x_1$ free, $x_2\ge0$.

(1) Derive the dual in the plain course form $L=f+\lambda h+\mu^Tg$ with $h=x_1+x_2-4$ ($\lambda$ free), $g_1=x_1-x_2-2\le0$ ($\mu_1\ge0$), $g_2=-x_2\le0$ ($\mu_2\ge0$). (2) Solve the dual. (3) Recover the primal solution using complementary slackness and confirm $p^*=d^*$.

Hint

The free $x_1$ gives an equality, the sign-constrained $x_2$ gives an inequality after eliminating $\mu_2$.

Show answer
  1. $L=x_1+2x_2+\lambda(x_1+x_2-4)+\mu_1(x_1-x_2-2)-\mu_2x_2=(1+\lambda+\mu_1)x_1+(2+\lambda-\mu_1-\mu_2)x_2-4\lambda-2\mu_1$.
  2. Finite iff $1+\lambda+\mu_1=0$ (from free $x_1$) and $\mu_2=2+\lambda-\mu_1$. With $\mu_2\ge0$: dual is $\max\ -4\lambda-2\mu_1$ s.t. $1+\lambda+\mu_1=0$, $2+\lambda-\mu_1\ge0$, $\mu_1\ge0$, $\lambda$ free.
  3. Eliminate $\lambda=-1-\mu_1$: objective $4+4\mu_1-2\mu_1=4+2\mu_1$; constraint $1-2\mu_1\ge0\iff\mu_1\le\frac12$. Max at $\mu_1^*=\frac12$, $\lambda^*=-\frac32$, $d^*=5$.
  4. CS: $\mu_1^*\gt0$ ⇒ $x_1-x_2=2$; with $x_1+x_2=4$: $x^*=(3,1)$. $x_2=1\ge0$ ✓; $\mu_2^*=2-\frac32-\frac12=0$, consistent with $x_2\gt0$ ✓. $p^*=3+2=5=d^*$ (linprog ✓).
  5. Table check. This question wrote $h$ as $Ax-b$ (not $b-Ax$), so the table's equality price is minus this one: $\lambda^{\text{tab}}=-\lambda=\frac32$ (free, $=$ row). The $\le$ row is in course form both here and in the table, so its price is the same $\mu_1=\frac12\ge0$, entering with a minus. Table dual: $\max 4\lambda^{\text{tab}}-2\mu_1$ s.t. $\lambda^{\text{tab}}-\mu_1=1$ (free $x_1$: $R_1=\lambda^{\text{tab}}-\mu_1=c_1$), $\lambda^{\text{tab}}+\mu_1\le2$ ($x_2\ge0$: $R_2=\lambda^{\text{tab}}-(-1)\mu_1\le c_2$): value $6-1=5$ ✓.
Q19 New, in his style (tutorial V with new numbers)Descriptive

$\min_{x\in\mathbb{R}^2}x_1^2+x_2^2$ s.t. $h(x)=x_1+x_2-2=0$, $x_1\ge3$. Use $L=f+\lambda h+\mu g$ with $g$ in $\le0$ form.

(a) Give a Slater point and explain why a KKT point is the unique global minimiser. (b) Derive $q(\lambda,\mu)$ by minimising $L$ over all $x$; complete the squares. (c) Solve the dual. (d) Recover $x^*$, give $p^*$, $d^*$, check KKT. (e) Redo (c)–(d) if the constraint is $x_1\ge0$ instead.

Hint

$g=3-x_1\le0$. $x_1(\lambda,\mu)=\frac{\mu-\lambda}2$, $x_2=-\frac\lambda2$. In (e) the unconstrained maximiser has $\mu\lt0$.

Show answer
  1. (a) $x^0=(4,-2)$: $h=0$, $g=-1\lt0$ ✓. $f$ strictly convex, $h$ affine, $g$ affine ⇒ convex problem; KKT ⇒ global min (section C4); strict convexity ⇒ unique.
  2. (b) $L=x_1^2+x_2^2+\lambda(x_1+x_2-2)+\mu(3-x_1)$. $\nabla_xL=0$: $2x_1+\lambda-\mu=0$, $2x_2+\lambda=0$. Substitute: $q=-\tfrac14(\mu-\lambda)^2-\tfrac14\lambda^2-2\lambda+3\mu=10-\tfrac14(\mu-\lambda-6)^2-\tfrac14(\lambda-2)^2$, $\mathbb{D}=\mathbb{R}^2$.
  3. (c) Max: $\lambda^*=2$, $\mu^*=\lambda^*+6=8\ge0$ ✓, $d^*=10$.
  4. (d) $L(x,2,8)=x_1^2+x_2^2-6x_1+2x_2+20=(x_1-3)^2+(x_2+1)^2+10$, unique minimiser $x^*=(3,-1)$. $p^*=9+1=10=d^*$. KKT: $\nabla f=(6,-2)$, $+2(1,1)+8(-1,0)=(0,0)$ ✓; $h=0$ ✓; $g=0$ (active) ✓; $\mu=8\ge0$ ✓; CS $8\cdot0=0$ ✓.
  5. (e) $g=-x_1\le0$: $q=-\tfrac14(\mu-\lambda)^2-\tfrac14\lambda^2-2\lambda$. Unconstrained max is $\lambda=\mu=-4$: not allowed ($\mu\lt0$). On $\mu=0$: $q=-\tfrac12\lambda^2-2\lambda$, max at $\lambda=-2$, $q=2$. There $\partial q/\partial\mu=\frac{\lambda-\mu}{2}=-1\lt0$, and because $q$ is concave a point on the boundary where moving into the allowed region ($\mu\gt0$) goes downhill is the maximum over $\mu\ge0$. So increasing $\mu$ only lowers $q$: $(\lambda^*,\mu^*)=(-2,0)$, $d^*=2$. Recover $x=(1,1)$, $p^*=2$, constraint inactive and $\mu^*=0$ (CS ✓).
Q36 New, in his style (a variable with x ≤ 0)Descriptive

Derive the dual of $\ \min 2x_1+x_2$ s.t. $x_1+x_2\ge1$, $x_1-x_2\le3$, $x_1\ge0$, $x_2\le0$. Solve both and verify complementary slackness.

Hint

Course form for both rows: $g_1=1-x_1-x_2\le0$ ($\mu_1\ge0$) and $g_2=x_1-x_2-3\le0$ ($\mu_2\ge0$). Signs: $-x_1\le0$ ($\sigma_1\ge0$) and $x_2\le0$ ($\sigma_2\ge0$, entering as $+\sigma_2x_2$).

Show answer
  1. $L=2x_1+x_2+\mu_1(1-x_1-x_2)+\mu_2(x_1-x_2-3)-\sigma_1x_1+\sigma_2x_2=(2-\mu_1+\mu_2-\sigma_1)x_1+(1-\mu_1-\mu_2+\sigma_2)x_2+\mu_1-3\mu_2$.
  2. Coefficients must vanish: $\sigma_1=2-\mu_1+\mu_2\ge0$ and $\sigma_2=\mu_1+\mu_2-1\ge0$.
  3. Dual: $\max\ \mu_1-3\mu_2$ s.t. $\mu_1-\mu_2\le2$, $\mu_1+\mu_2\ge1$, $\mu_1\ge0$, $\mu_2\ge0$. (Table: the $\le$ row's $\mu_2$ enters with a minus; $x_1\ge0$ → $\le$; $x_2\le0$ → $\ge$.)
  4. Solve the dual: $-3\mu_2$ with $\mu_2\ge0$ can only lower the objective, and $\mu_1\le2+\mu_2$ gives objective $\le2-2\mu_2\le2$. So $\mu^*=(2,0)$, $d^*=2$ (check $\mu_1+\mu_2=2\ge1$ ✓).
  5. Primal: $x_1\ge1-x_2\ge1$ (since $x_2\le0$), so $2x_1+x_2\ge2(1-x_2)+x_2=2-x_2\ge2$; equality at $x^*=(1,0)$, $p^*=2=d^*$ (linprog ✓).
  6. CS: $\mu_1=2\gt0$ ⇒ row 1 tight ($1+0=1$ ✓). Row 2 slack ($1\lt3$) ⇒ $\mu_2=0$ ✓. $x_1=1\gt0$ ⇒ $\sigma_1=0$, i.e. $\mu_1-\mu_2=2$ ✓. $\sigma_2=2+0-1=1\gt0$ ⇒ $x_2=0$ ✓.

Part D · Midterm 2 Question I (guided proof: KKT ⇒ global minimum)

$\min f(x)$ s.t. $h(x)=Ax-b=0$, $g(x)\le0$; $f,g_1,\dots,g_r$ differentiable convex. $J_h=[\nabla h_1\cdots\nabla h_m]$, $J_g=[\nabla g_1\cdots\nabla g_r]$, $L=f+\lambda^Th+\mu^Tg$, $\lambda$ free. For parts 2–8, $(x^*,\lambda^*,\mu^*)$ is a KKT triplet, $y$ any feasible point, $d=y-x^*$.

Q20 Midterm 2 I.1 (past paper)MCQ

Which system gives the complete KKT conditions? (All options include $h(x^*)=0$, $g(x^*)\le0$.)

  1. (a) $\nabla f+J_h\lambda^*+J_g\mu^*=0$, $\mu^*\le0$, $\mu_i^*g_i(x^*)=0$.
  2. (b) $\nabla f+J_h\lambda^*+J_g\mu^*=0$, $\mu^*\ge0$, $\mu_i^*g_i(x^*)\le0$.
  3. (c) $\nabla f(x^*)=0$, $\mu^*\ge0$, $\mu_i^*g_i(x^*)=0$.
  4. (d) $\nabla f+J_h\lambda^*+J_g\mu^*=0$, $\mu^*\ge0$, $\mu_i^*g_i(x^*)=0$.
Show answer

Answer: (d). All five parts: stationarity of $L$, $h=0$, $g\le0$, $\mu\ge0$, $\mu_ig_i=0$; $\lambda$ free.

(a) wrong sign of $\mu$. (b) $\mu_ig_i\le0$ is automatic from $\mu\ge0,g\le0$; CS needs $=0$. (c) $\nabla f=0$ is unconstrained stationarity, not of the Lagrangian. (The OCR copy of the paper drops option (c); this list is from the PDF.)

Q21 Midterm 2 I.2 (past paper)MCQ

For $h(x)=Ax-b$, the column-gradient Jacobian $J_h(x)$ is

  1. (a) $-A$
  2. (b) $-A^T$
  3. (c) $A^T$
  4. (d) $A$
Show answer

Answer: (c). $h_i=a_i^Tx-b_i$, $\nabla h_i=a_i$; stacking the $a_i$ as columns gives $A^T\in\mathbb{R}^{n\times m}$. (d) is the row (standard) Jacobian; (a), (b) have a sign that $Ax-b$ does not produce (they would fit $b-Ax$).

Q22 Midterm 2 I.3 (past paper)MCQ

Which statement about $d^TJ_h(x^*)$ is correct?

  1. (a) It is $0^T$, because $Ad=Ay-Ax^*=b-b=0$.
  2. (b) It is $b^T$.
  3. (c) It is $-b^T$.
  4. (d) It is $0^T$, because the Jacobian of an affine function is zero.
Show answer

Answer: (a). $d^TA^T=(Ad)^T=0^T$ since both points are feasible.

(d) right value, wrong reason: the Jacobian is the constant $A^T$, not zero. (b), (c) $b$ cancels.

Q23 Midterm 2 I.4 (past paper)MCQ

What can be asserted in general about $d^T\nabla g_j(x^*)$ for constraints active and inactive at $x^*$?

  1. (a) Active: nonpositive. Inactive: nonpositive.
  2. (b) Active: zero. Inactive: no fixed sign.
  3. (c) Active: nonpositive. Inactive: no fixed sign.
  4. (d) Active: nonpositive. Inactive: nonnegative.
Show answer

Answer: (c). Convexity: $\nabla g_j(x^*)^Td\le g_j(y)-g_j(x^*)$. Active: $=g_j(y)\le0$. Inactive: the bound $g_j(y)-g_j(x^*)$ can be positive. Example: $g(t)=t-1$, $t^*=0$: $y=\pm\frac12$ give opposite signs.

(b) "zero" is for equality constraints. (a), (d) inactive constraints have no fixed sign.

Q24 Midterm 2 I.5 (past paper)MCQ

Which statement correctly gives the multiplier-weighted inequality and its justification?

  1. (a) $d^TJ_g\mu^*\le0$: nonnegativity of multipliers alone suffices, even if inactive multipliers are nonzero.
  2. (b) $d^TJ_g\mu^*\le0$: CS makes inactive multipliers zero; the rest are nonnegative multipliers times nonpositive directional derivatives.
  3. (c) $d^TJ_g\mu^*\ge0$: CS makes the active multipliers zero.
  4. (d) $d^TJ_g\mu^*=0$: CS implies $\mu_j^*d^T\nabla g_j=0$ for every $j$.
Show answer

Answer: (b). This is where complementary slackness enters the proof.

(a) a nonzero inactive multiplier times a positive directional derivative breaks the sign. (c) CS kills the inactive ones. (d) CS says $\mu_jg_j(x^*)=0$, not $\mu_jd^T\nabla g_j=0$.

Q25 Midterm 2 I.6 (past paper)MCQ

Which relation is valid?

  1. (a) $f(y)-f(x^*)=-d^T[J_h\lambda^*+J_g\mu^*]$
  2. (b) $f(y)-f(x^*)\ge-d^T[J_h\lambda^*+J_g\mu^*]$
  3. (c) $f(y)-f(x^*)\le d^T[J_h\lambda^*+J_g\mu^*]$
  4. (d) $f(y)-f(x^*)\le-d^T[J_h\lambda^*+J_g\mu^*]$
Show answer

Answer: (b). $f(y)-f(x^*)\ge\nabla f(x^*)^Td$ (convexity) and $\nabla f(x^*)=-(J_h\lambda^*+J_g\mu^*)$ (stationarity).

(a) equality only for affine $f$. (c), (d) the convexity inequality goes the other way.

Q26 Midterm 2 I.7 (past paper)MCQ

Which two concepts directly produce the relation in I.6?

  1. (a) Convexity of the $g_j$ and stationarity of the Lagrangian.
  2. (b) Convexity of $f$ and complementary slackness.
  3. (c) Convexity of $f$ and stationarity of $f$.
  4. (d) Convexity of $f$ and stationarity of the Lagrangian.
Show answer

Answer: (d). (a) convexity of $g_j$ was used in I.4, not here. (b) CS was used in I.5. (c) $\nabla f(x^*)$ need not be $0$.

Q27 Midterm 2 I.8 (past paper)MCQ

Combining the preceding results, which conclusion follows?

  1. (a) Any point that is not a local minimiser must violate the KKT conditions.
  2. (b) Stationarity of the Lagrangian alone guarantees a minimum, without CS or $\mu\ge0$.
  3. (c) Every KKT point is a strict local minimiser.
  4. (d) A KKT point is a local minimiser but need not be global.
Show answer

Answer: (a). $f(y)-f(x^*)\ge-d^TJ_g\mu^*\ge0$ for all feasible $y$: every KKT point is a global, hence local, minimiser. (a) is the contrapositive.

(b) I.5 needed CS and $\mu\ge0$. (c) nothing gives strictness ($f\equiv0$: every point is KKT, none strict). (d) it is global.

Part E · Midterm 2 Question II (self-dual LP)

$(P)\ \min_{z\in\mathbb{R}^N}q^Tz$ s.t. $Mz\ge-q$, $z\ge0$, with $M^T=-M$. Multipliers $\lambda\ge0$ for $-Mz-q\le0$, $\mu\ge0$ for $-z\le0$; inner infimum over all $z\in\mathbb{R}^N$. Letters in this paper: $q\in\mathbb{R}^N$ is a given cost vector (not the dual function, which the paper calls $\phi$), $M$ is a given $N\times N$ matrix with $M^T=-M$ ("skew-symmetric"), and $z$ is the variable. Section L3 summarises the whole question.

Q28 Midterm 2 II.1 (past paper)MCQ

After using $M^T=-M$, the Lagrangian is

  1. (a) $L=(q+M\lambda-\mu)^Tz-q^T\lambda$
  2. (b) $L=(q-M\lambda-\mu)^Tz-q^T\lambda$
  3. (c) $L=(q+M\lambda-\mu)^Tz+q^T\lambda$
  4. (d) $L=(q+M\lambda+\mu)^Tz-q^T\lambda$
Show answer

Answer: (a). $L=q^Tz+\lambda^T(-Mz-q)-\mu^Tz=(q-M^T\lambda-\mu)^Tz-q^T\lambda=(q+M\lambda-\mu)^Tz-q^T\lambda$.

(b) forgot $M^T=-M$. (c) constant term is $-q^T\lambda$. (d) $\mu$ enters through $-\mu^Tz$.

Q29 Midterm 2 II.2 (past paper)MCQ

Write $L=r^Tz+\beta$. $\phi(\lambda,\mu)=\inf_{z\in\mathbb{R}^N}L$ is

  1. (a) $-\beta$ if $r=0$, $-\infty$ otherwise.
  2. (b) $\beta$ if $r=0$, $-\infty$ otherwise.
  3. (c) $\beta$ if $r\ge0$, $-\infty$ otherwise.
  4. (d) $\beta$ if $r=0$, $+\infty$ otherwise.
Show answer

Answer: (b). If $r\ne0$, take $z=-tr$: $L=-t\|r\|^2+\beta\to-\infty$.

(a) sign of constant. (c) "$r\ge0$" would be right only if $z\ge0$ were kept in the infimum, but it was dualised. (d) an infimum of a function that takes finite values cannot be $+\infty$.

Q30 Midterm 2 II.3 (past paper)MCQ

Using the finite-value condition to eliminate $\mu\ge0$ (with $\lambda\ge0$ kept), which constraint on $\lambda$ remains?

  1. (a) $M\lambda\le-q$
  2. (b) $M\lambda\ge q$
  3. (c) $M\lambda=-q$
  4. (d) $M\lambda\ge-q$
Show answer

Answer: (d). $\mu=q+M\lambda\ge0$. (a) wrong direction. (b) sign of $q$. (c) forgets that $\mu$ can be positive (equality only if there were no $z\ge0$ constraint).

Q31 Midterm 2 II.4 (past paper)MCQ

The dual of $(P)$ is

  1. (a) $\max q^T\lambda$ s.t. $M\lambda\ge-q$, $\lambda\ge0$
  2. (b) $\max -q^T\lambda$ s.t. $M\lambda\ge q$, $\lambda\ge0$
  3. (c) $\max -q^T\lambda$ s.t. $M\lambda\ge-q$, $\lambda\ge0$
  4. (d) $\max -q^T\lambda$ s.t. $M\lambda\le-q$, $\lambda\ge0$
Show answer

Answer: (c). Objective is $\beta=-q^T\lambda$; constraint from II.3. Same feasible set as $(P)$, which is why it is called self-dual. (a) sign of objective; (b), (d) wrong constraint.

Q32 Midterm 2 II.5 (past paper)MCQ

For every feasible $z$ of $(P)$, which is guaranteed?

  1. (a) $q^Tz\ge0$
  2. (b) $q^Tz=0$
  3. (c) $q^Tz\gt0$
  4. (d) $q^Tz\lt0$
Show answer

Answer: (a). $z^TMz=z^TM^Tz=-z^TMz\Rightarrow z^TMz=0$. So $q^Tz=z^T(Mz+q)\ge0$ (both factors $\ge0$). (b), (c) too strong: zero only at optimal points, and $z=0$ is feasible when $q\ge0$. (d) impossible.

Q33 Midterm 2 II.6 (past paper)MCQ

Suppose $(P)$ is feasible. Which must hold?

  1. (a) It has an optimal solution, but the optimal value may be strictly positive.
  2. (b) It has an optimal solution, and its optimal value is zero.
  3. (c) Its infimum is zero but need not be attained.
  4. (d) It has a unique optimal solution, with value zero.
Show answer

Answer: (b). Bounded below by $0$ and feasible ⇒ an LP attains its minimum. LP duality: $p^*=d^*$. Same feasible set: $d^*=\sup(-q^T\lambda)=-p^*$. So $p^*=-p^*=0$.

(a) the value is forced to $0$. (c) LPs that are feasible and bounded attain. (d) not unique: $M=0$, $q=0$ makes every $z\ge0$ optimal. (Random instances checked with linprog: optimum $0$.)

For Q34–Q35: $M=\begin{pmatrix}0&-A^T\\A&0\end{pmatrix}$, $q=\begin{pmatrix}c\\-b\end{pmatrix}$, $z=\begin{pmatrix}x\\y\end{pmatrix}$. (In Q34–Q35, $y$ is the price vector of the second LP, not "another feasible point" as in Part D. Also note: in Part E the letter $q$ is the cost vector of the paper's LP, not the dual function.)

Q34 Midterm 2 II.7 (past paper)MCQ

The constraints of $(P)$ describe simultaneous feasibility for which pair (first: $\min c^Tx$; second: $\max b^Ty$)?

  1. (a) $Ax=b,\ x\ge0$; $A^Ty\le c$, $y$ free.
  2. (b) $Ax\le b,\ x\ge0$; $A^Ty\ge c$, $y\ge0$.
  3. (c) $Ax\ge b,\ x\ge0$; $A^Ty\le c$, $y\ge0$.
  4. (d) $Ax\ge b,\ x\ge0$; $A^Ty\ge c$, $y\ge0$.
Show answer

Answer: (c). $Mz\ge-q$: top block $-A^Ty\ge-c\iff A^Ty\le c$; bottom block $Ax\ge b$; $z\ge0$ gives $x,y\ge0$. (Matches the sign table: $\ge$ rows ↔ $y\ge0$, $x\ge0$ ↔ $\le$.) (a) is the standard-form pair, but $z\ge0$ forces $y\ge0$. (b), (d) wrong directions.

Q35 Midterm 2 II.8 (past paper)MCQ

$z=(x,y)$ is feasible and $q^Tz=0$. What follows?

  1. (a) $x$ is primal optimal, but $y$ may fail to be dual optimal.
  2. (b) $y$ is dual optimal, but $x$ may fail to be primal optimal.
  3. (c) Both are optimal, and their objective values must be zero.
  4. (d) Both are optimal, and their objective values are equal.
Show answer

Answer: (d). $q^Tz=c^Tx-b^Ty=0$: a feasible pair with zero gap; by weak duality both are optimal.

(a), (b) zero gap certifies both. (c) values need not be $0$: $A=b=c=1$, $x=y=1$ gives $c^Tx=b^Ty=1$.

Self-test (no looking)

S1

Write the dual of $\min c^Tx$ s.t. $Ax=b$, $x\ge0$, and the one-line weak-duality identity for this pair.

Show answer

$\max_\lambda b^T\lambda$ s.t. $A^T\lambda\le c$ ($\lambda$ free). $c^Tx-b^T\lambda=(c-A^T\lambda)^Tx=\mu^Tx\ge0$.

S2

Write the full LP KKT system and the value identity.

Show answer

$A^T\lambda^*+\mu^*=c$, $\mu^*\ge0$, $Ax^*=b$, $x^*\ge0$, $(\mu^*)^Tx^*=0$. Then $c^Tx^*=(A^T\lambda^*+\mu^*)^Tx^*=b^T\lambda^*$.

S3

Define $q$ and $\mathbb{D}$. Over which set is the infimum taken? What two properties do they always have, and why?

Show answer

$q(\lambda,\mu)=\inf_{x\in\mathbb{R}^n}L(x,\lambda,\mu)$, over the whole space (or the function domain), not the feasible set. $\mathbb{D}=\{q\gt-\infty\}$. $q$ concave, $\mathbb{D}$ convex, because $L$ is affine in the multipliers (an infimum of affine functions is concave); no convexity of the primal needed.

S4

State weak duality and prove it in one line.

Show answer

$x$ feasible, $\mu\ge0$: $q(\lambda,\mu)\le L(x,\lambda,\mu)=f(x)+\lambda^Th(x)+\mu^Tg(x)\le f(x)$ since $h(x)=0$ and $\mu^Tg(x)\le0$. So $d^*\le p^*$.

S5

State Slater's theorem (hypotheses and conclusion) and name one thing it does NOT give, with an example.

Show answer

$f,g_j$ convex, $h$ affine, $\exists x^0$: $h(x^0)=0$, $g_j(x^0)\lt0\ \forall j$; if $p^*$ finite then $p^*=d^*$ and a dual optimum exists. Not primal attainment: $\min e^x$, $x\le0$. Also not a unique Lagrangian minimiser: $-2u+(v-1)^2$, $u\le1$.

S6

State the KKT-equivalence theorem (7.4.1) and the primal-recovery corollary (7.4.2).

Show answer

Differentiable convex $f,g$, affine $h$, full space: a KKT pair exists ⇔ $p^*=d^*\in\mathbb{R}$ and both are attained; then every primal optimum with every dual optimum is a KKT pair. Recovery: under this, if $\bar\eta$ is dual optimal and $L(\cdot,\bar\eta)$ has a unique minimiser $\bar x$, then $\bar x$ is the unique primal optimum (feasible, CS holds automatically).

S7

State the LP duality theorem (both parts) and the false converse, with a counter-example.

Show answer

(i) If (P) or (D) has an optimal solution, so does the other and the values are equal. (ii) If one is unbounded, the other is infeasible. False: "infeasible ⇒ other unbounded". $A=[0]$, $b=1$, $c=-1$: both infeasible.

S8

Which three constraint types give a convex feasible set? Is KKT necessary for a convex problem? Sufficient? Give the counter-example for one of them.

Show answer

$h=0$ with $h$ affine; $g\le0$ with $g$ convex; $g\ge0$ with $g$ concave. KKT is sufficient for a global minimum (no CQ needed), not necessary without a CQ: $\min(x-1)^2$ s.t. $x^2\le0$, optimum $x=0$, no multiplier. (And say "convex optimization problem", never "concave optimization problem" or "concave set".)

S9

For a MIN primal, what does each of these become in the dual: a $\ge$ row, a $\le$ row, a free variable, a variable with $x_j\le0$? (Equality rows written $b_i-a_i^Tx$; inequality rows in course form $g\le0$.)

Show answer

$\ge$ row → $\mu_i\ge0$, entering as $+b_i\mu_i$ (term $\mu_i(b_i-a_i^Tx)$); $\le$ row → $\mu_i\ge0$, entering as $-b_i\mu_i$ (term $\mu_i(a_i^Tx-b_i)$); free $x_j$ → $R_j=c_j$; $x_j\le0$ → $R_j\ge c_j$. (And $x_j\ge0$ → $R_j\le c_j$; $=$ row → $\lambda_i$ free, entering as $+b_i\lambda_i$.) Every inequality price is $\ge0$.

Summary card (for revision; the formula sheet copies this)

Memorise cold

Symbols: $x\in\mathbb{R}^n$ variable; $f$ cost; $h(x)=0$ equalities with prices $\lambda$ (free); $g(x)\le0$ inequalities with prices $\mu\ge0$; $p^*$ / $d^*$ = primal / dual optimal values; LP data $c\in\mathbb{R}^n$, $A\in\mathbb{R}^{m\times n}$, $b\in\mathbb{R}^m$, $a_i^T$ = row $i$ of $A$.

  • Primal (always rewrite into this form first): $\min_x f(x)$ s.t. $h(x)=0$, $g(x)\le 0$. Lagrangian $L(x,\lambda,\mu)=f(x)+\lambda^Th(x)+\mu^Tg(x)$, $\lambda$ free, $\mu\ge 0$. (The notes write the multipliers as $y=(u,v)$, Quiz 4 as $\eta$; same thing.)
  • Dual function $q(\lambda,\mu)=\inf_{x\in\mathbb{R}^n}L(x,\lambda,\mu)$: infimum over all $x$, constraints are not put back. Domain $\mathbb{D}=\{(\lambda,\mu):q\gt-\infty\}$. Dual problem: $\max q(\lambda,\mu)$ s.t. $(\lambda,\mu)\in\mathbb{D}$, $\mu\ge0$.
  • Linear-in-$x$ rule: $\inf_x (r^Tx+\beta)=\beta$ if $r=0$, and $-\infty$ otherwise. ("The infimum is finite if and only if the coefficient of $x$ vanishes.")
  • $q$ is concave and $\mathbb{D}$ is convex, even when the primal is nonconvex (because $L$ is affine in the multipliers).
  • Weak duality: $x$ feasible, $\mu\ge0$ ⇒ $q(\lambda,\mu)\le L(x,\lambda,\mu)\le f(x)$. Hence $d^*\le p^*$. Equal values for a feasible pair ⇒ both optimal.
  • Standard LP pair: $\ \min c^Tx$ s.t. $Ax=b,\ x\ge0\quad\Longleftrightarrow\quad \max b^T\lambda$ s.t. $A^T\lambda\le c$ ($\lambda$ free; derived with $h=b-Ax$).
  • LP KKT: $A^T\lambda^*+\mu^*=c,\ \ \mu^*\ge0,\ \ Ax^*=b,\ \ x^*\ge0,\ \ (\mu^*)^Tx^*=0$. Value identity $c^Tx^*=b^T\lambda^*$.
  • LP duality theorem: (i) one has an optimal solution ⇒ both do, equal values. (ii) one unbounded ⇒ the other infeasible. The converse of (ii) is FALSE: both can be infeasible ($A=[0]$, $b=1$, $c=-1$).
  • KKT-equivalence (Thm 7.4.1), differentiable convex, full space: a KKT pair exists ⇔ $p^*=d^*\in\mathbb{R}$ and both are attained. Then every primal optimum with every dual optimum is a KKT pair.
  • Slater (Thm 7.4.3): $f,g$ convex, $h$ affine, some $x^0$ with $h(x^0)=0$, $g(x^0)\lt 0$, and $p^*$ finite ⇒ $p^*=d^*$ and the dual optimum is attained. Primal attainment is NOT guaranteed ($e^x$, $x\le0$).
  • Primal recovery (Cor 7.4.2): KKT pair exists, $\bar\eta=(\bar\lambda,\bar\mu)$ dual optimal, $L(\cdot,\bar\eta)$ has a unique minimiser $\bar x$ ⇒ $\bar x$ is the unique primal optimum (feasibility and complementary slackness come free). Uniqueness, not strict convexity, is the hypothesis.
  • Convex problems: local min = global min; minimiser set convex; KKT ⇒ global min (no CQ); KKT not necessary without a CQ ($(x-1)^2$, $x^2\le0$).
  • Convex feasible set from: $h(x)=0$ with $h$ affine; $g(x)\le0$ with $g$ convex; $g(x)\ge0$ with $g$ concave.
  • Never write "concave optimization problem" or "concave set".
LP dual sign table for a MIN primal (equality rows $\lambda_i(b_i-a_i^Tx)$; inequality rows in course form $g\le0$, $\mu_i\ge0$)

One price per row of $A$ and one dual constraint per variable $x_j$ (column $j$ of $A$). Dual objective $=\sum_{=,\ \ge}b_i\cdot\text{price}_i-\sum_{\le}b_i\mu_i$; $R_j$ = the same with $a_{ij}$ in place of $b_i$ (only $=$ rows: $R_j=(A^T\lambda)_j$).

Primal ROW $i$→ dual VARIABLE (enters as)Primal VARIABLE $x_j$→ dual CONSTRAINT $j$
$a_i^Tx\ge b_i$$\mu_i\ge0$ ($+b_i\mu_i$)$x_j\ge0$$R_j\le c_j$
$a_i^Tx=b_i$$\lambda_i$ free ($+b_i\lambda_i$)$x_j$ free$R_j=c_j$
$a_i^Tx\le b_i$$\mu_i\ge0$ ($-b_i\mu_i$)$x_j\le0$$R_j\ge c_j$

The two halves are separate lookups (rows → prices; variables → dual constraints); the thick line divides them. Every inequality price is $\ge0$. Equality rows: this page writes them $b-Ax$ in LP work (flipping to $Ax-b$ flips those prices' signs). Books that attach a $\le$ row's price to $b_i-a_i^Tx$ show it as "$\le0$": that is $-\mu_i$, same dual value. Check: standard form ($=$ rows, $x\ge0$) gives $\lambda$ free, $A^T\lambda\le c$. A max primal: first rewrite as $\min(-c^Tx)$. $\max c^Tx$, $Ax\le b$, $x\ge0$ ↔ $\min b^Tw$, $A^Tw\ge c$, $w\ge0$.