Graduate Algorithms · Part 2LP · Duality · Max-flow/Min-cut · Convexity · Gradient descent · Approximation
0%
Unit 0.1 · Start here

The whole of Part 2 on one page

Sources: L9 §2; L11 §5; L12 intro; every supplied PDF

Part 2 changes the way you design algorithms. Part 1 used divide and conquer, dynamic programming and graph structure. In Part 2 you describe the feasible solutions and the objective mathematically, then use the structure of the resulting optimization problem.

BlockLecturesThe main question
Linear programming9–11How do we model a problem with linear constraints? How can we certify that a solution is optimal?
Convex optimization12–13What still works when the objective is not linear? How does gradient descent find an approximately optimal solution?
Approximation algorithms14–15When exact discrete optimization is hard, how do greedy choices, matchings, LP relaxations and rounding give solutions that are provably within a factor of optimal?

The one idea that ties everything together

Each part of this material has the same two pieces: an algorithm finds a solution, and a certificate proves how good it is.

LP modelmax cᵀx, Ax ≤ b, x ≥ 0 Geometryconvex region, vertices Dualityprices = upper bounds Max-flow = min-cutdual + rounding Strong duality proofFarkas, separation Convex functionschords, tangents, Hessian Gradient descentDG/√T · smooth: βD²/2T Approximationrelax, round, bound tangent= local linear model Algorithm side:an LP solver / Dijkstra + threshold / gradient descent / greedy or rounding produces a candidate. Certificate side:a dual solution / a cut / convexity + distance bound / a matching or LP lower bound proves how good it is.
Read left to right along the top, then back along the bottom row. Each box is a chapter.

1 · LP models

Turn word problems into max⁡c⊤x\max c\T x with Ax≤b, x≥0Ax\le b,\ x\ge 0. Convert any form into this one.

2 · LP geometry

Feasible regions are convex. If an optimum exists, some optimal point is at a corner. The exact answer needs only polynomially many bits.

3 · Duality

Prices on constraints prove upper bounds. Weak and strong duality, writing duals (an exam question), complementary slackness.

4 · Max-flow = min-cut

The flow dual is a system of edge lengths, and threshold rounding turns lengths into a cut.

5 · Why strong duality holds

Cones, Farkas' lemma, separating hyperplanes, active constraints.

6 · Convexity

Convex functions: chord, tangent and Hessian tests, rules for building them, least squares, and why every local minimum is global.

7 · Gradient descent

Steepest descent, step sizes, and the full DG/TDG/\sqrt T proof.

8 · Projections & smoothness (L13)

Projected GD for constraints, β-smoothness, the descent lemma, and the faster βD2/(2T)\beta D^2/(2T) guarantee for the last iterate.

9 · Approximation algorithms (L14–L15)

α-approximations, greedy vertex cover (O(log⁡n)O(\log n)), maximal matching (factor 2), LP relaxation and threshold rounding (factor 2), the matching dual, integrality gaps, facility location.

10 · Exam toolkit

Proof templates, traps, a decoded formula sheet, and 80+ practice questions with answers.

How to read these notes

Every important formula is in a box like this one, followed by a decoding:

Example of a decoded formula
c⊤x  =  ∑i=1ncixic^{\top}x \;=\; \sum_{i=1}^{n} c_i x_i

In words"c-transpose-x" is just a weighted sum: multiply each choice by its score and add.

Symbol by symbol
xix_ihow much of choice ii you make (a decision variable)
cic_iscore (revenue, cost, …) per unit of choice ii
∑i=1n\sum_{i=1}^n"add up, for i=1,2,…,ni=1,2,\dots,n"

Why it is trueIt is the definition of the dot product.

When you use itEvery LP objective is written this way.

The coloured boxes mean:

Interactive diagrams (tagged Interactive) sit next to the text they explain. Drag points and move sliders, then check the live numbers against the formulas. Your progress (the "I understand this unit" boxes) and the dark-mode choice are saved in this browser. Use ←/→ to move between units and / to search. One page shows everything on a single page for printing or Ctrl+F.

A study routine that works with the pictures

  1. Picture first. Before reading a formula, describe the figure: what moves, what stays feasible, what blocks improvement.
  2. Decode. Read the "In words" line and the symbol table, then cover them and explain the formula aloud.
  3. Re-derive. For every inequality in a proof, say which assumption it uses: feasibility, nonnegativity, convexity, a gradient bound, Cauchy–Schwarz, or "a square is ≥ 0".
  4. Test. Do the quick checks in each unit, then the practice bank before opening the answers.
Unit 0.2 · Start here

Math toolkit I: vectors, matrices, inequalities

Sources: L9 §3; L12 §2

Almost every formula in Part 2 uses a few pieces of linear algebra. If a formula ever looks unreadable, come back to this unit.

Vectors and coordinatewise inequalities

A vector x∈Rnx\in\R^n is a column of nn real numbers x=(x1,…,xn)⊤x=(x_1,\dots,x_n)\T. Comparisons between vectors are coordinatewise:

Vector inequality
x≥0  ⟺  xi≥0 for every i,Ax≤b  ⟺  (Ax)j≤bj for every row j.x \ge 0 \iff x_i \ge 0 \text{ for every } i, \qquad Ax\le b \iff (Ax)_j\le b_j \text{ for every row } j.

In wordsA vector inequality is many ordinary inequalities written at once, one per coordinate.

Symbol by symbol
Rn\R^nthe set of all lists of nn real numbers
  ⟺  \iff"if and only if": the two statements are equivalent
(Ax)j(Ax)_jthe jj-th entry of the vector AxAx

When you use itWhenever you see ≤\le between vectors, write out the rows to check signs.

Transpose and the dot product

Dot product (inner product)
⟨u,v⟩  =  u⊤v  =  ∑iuivi  =  ∥u∥ ∥v∥cos⁡α\langle u,v\rangle \;=\; u\T v \;=\; \sum_{i} u_i v_i \;=\; \norm{u}\,\norm{v}\cos\alpha

In wordsMultiply matching coordinates and add. Geometrically, it is length × length × cosine of the angle between the vectors.

Symbol by symbol
u⊤u\T"u transpose": the column turned into a row, so that row × column gives one number
⟨u,v⟩\langle u,v\rangleother notation for the same number (used in L12)
∥u∥=∑iui2\norm{u}=\sqrt{\sum_i u_i^2}Euclidean length of uu (the 2-norm, sometimes written ∥u∥2\norm{u}_2)
α\alphathe angle between uu and vv

Why it is trueThe cosine form comes from the law of cosines applied to the triangle with sides uu, vv, u−vu-v.

When you use itSign of the dot product = which side of a line or plane a vector points to. Positive: acute angle (same general direction). Zero: perpendicular. Negative: obtuse (opposite direction). Farkas, separation and gradient descent all rely on this.

uvuᵀv > 0 (acute) uvuᵀv = 0 (right angle) uvuᵀv < 0 (obtuse)
The sign of a dot product tells you whether two vectors point "with" or "against" each other.
u v light from above shadow = ‖v‖ cos α α ⟨u, v⟩ = ‖u‖ × shadowshadow ≤ ‖v‖ (Cauchy–Schwarz)
The dot product measures how much of vv points along uu.

Matrix times vector: the row view and the column view

For A∈Rm×nA\in\R^{m\times n} (mm rows, nn columns) and x∈Rnx\in\R^n, there are two equally correct ways to read Ax∈RmAx\in\R^m:

Row view: one constraint per row row j: Aⱼ₁ … Aⱼₙ x ≤ bⱼ (Ax)ⱼ = Σᵢ Aⱼᵢ xᵢ ≤ bⱼ "how much of resource j the whole plan uses" Column view: one recipe per variable column i xᵢ Ax = Σᵢ xᵢ · (column i) "what one unit of choice i consumes"
Rows are restrictions; columns are recipes. Duality swaps the two (the transpose A⊤A\T turns columns into rows).
Matrix–vector product
(Ax)j  =  ∑i=1nAji xi(j=1,…,m),(A⊤y)i  =  ∑j=1mAji yj(i=1,…,n).(Ax)_j \;=\; \sum_{i=1}^{n} A_{ji}\,x_i \quad (j=1,\dots,m), \qquad (A\T y)_i \;=\; \sum_{j=1}^{m} A_{ji}\,y_j \quad (i=1,\dots,n).

In wordsAxAx runs along a row of AA. A⊤yA\T y runs down a column of AA.

Symbol by symbol
AjiA_{ji}entry in row jj, column ii: how much of resource jj one unit of choice ii uses
mmnumber of constraints (rows)
nnnumber of variables (columns)
A⊤A\Ttranspose: (A⊤)ij=Aji(A\T)_{ij}=A_{ji}, an n×mn\times m matrix

When you use itDual constraints are (A⊤y)i≥ci(A\T y)_i\ge c_i: one per primal variable, built from a primal column.

Two identities are used constantly:

(A⊤y)⊤x  =  y⊤Ax  =  ∑j∑iyjAjixi,(AB)⊤=B⊤A⊤.(A\T y)\T x \;=\; y\T A x \;=\; \sum_{j}\sum_{i} y_j A_{ji} x_i, \qquad (AB)\T = B\T A\T.

In wordsA number equals its own transpose, so you can move AA to the other side of the dot product by transposing it.

Why it is trueBoth sides are the same double sum, added in a different order.

When you use itThe weak-duality chain c⊤x≤(A⊤y)⊤x=y⊤Ax≤y⊤bc\T x\le (A\T y)\T x=y\T Ax\le y\T b.

Linear combinations, cones and convex combinations

NameFormAllowed weightsPicture of all of them
Linear combination∑jλjaj\sum_j\lambda_j a_jany real λj\lambda_ja line / plane through 0 (a subspace)
Conic (nonnegative) combination∑jλjaj\sum_j\lambda_j a_jλj≥0\lambda_j\ge 0a cone (a wedge from 0)
Convex combination∑jλjaj\sum_j\lambda_j a_jλj≥0, ∑jλj=1\lambda_j\ge0,\ \sum_j\lambda_j=1the filled polygon spanned by the points

A set of vectors is linearly independent if no vector is a linear combination of the others. In Rn\R^n at most nn vectors can be independent, and nn independent vectors span Rn\R^n: every vector is some linear combination of them. You need this for vertices (Chapter 2).

Lengths and the "expand the square" identity

Expanding a squared norm
∥a−b∥2  =  ∥a∥2  −  2⟨a,b⟩  +  ∥b∥2\norm{a-b}^2 \;=\; \norm{a}^2 \;-\; 2\langle a,b\rangle \;+\; \norm{b}^2

In wordsThe vector version of (a−b)2=a2−2ab+b2(a-b)^2=a^2-2ab+b^2.

Symbol by symbol
∥a∥2=⟨a,a⟩\norm{a}^2=\langle a,a\ranglesquared length (no square root, easier to handle)

Why it is true∥a−b∥2=⟨a−b,a−b⟩\norm{a-b}^2=\langle a-b,a-b\rangle. Expand the inner product like a product of brackets, using ⟨a,b⟩=⟨b,a⟩\langle a,b\rangle=\langle b,a\rangle.

When you use itTwice: in the separation proof (L11, with a=p−qa=p-q, b=θ(z−q)b=\theta(z-q)) and in the gradient-descent proof (L12, with a=xt−x∗a=x_t-x^*, b=ηgtb=\eta g_t).

Cauchy–Schwarz inequality
−∥u∥ ∥v∥  ≤  ⟨u,v⟩  ≤  ∥u∥ ∥v∥-\norm{u}\,\norm{v} \;\le\; \langle u,v\rangle \;\le\; \norm{u}\,\norm{v}

In wordsA dot product can never be bigger (in absolute value) than the product of the lengths. Equality on the left happens exactly when vv points opposite to uu (or one of them is 00).

Why it is true⟨u,v⟩=∥u∥∥v∥cos⁡α\langle u,v\rangle=\norm u\norm v\cos\alpha and −1≤cos⁡α≤1-1\le\cos\alpha\le1. The lowest value, cos⁡α=−1\cos\alpha=-1, occurs at α=180∘\alpha=180^\circ.

When you use itProving that −∇f(x)-\nabla f(x) is the steepest descent direction (L12 §4.1).

Quick check: with A=(101211021)A=\begin{pmatrix}1&0&1\\2&1&1\\0&2&1\end{pmatrix} and y=(5,0,2)⊤y=(5,0,2)\T, compute A⊤yA\T y.
Show answer
Go down each column: column 1 gives 1⋅5+2⋅0+0⋅2=51\cdot5+2\cdot0+0\cdot2=5, column 2 gives 0⋅5+1⋅0+2⋅2=40\cdot5+1\cdot0+2\cdot2=4, column 3 gives 1⋅5+1⋅0+1⋅2=71\cdot5+1\cdot0+1\cdot2=7. So A⊤y=(5,4,7)⊤A\T y=(5,4,7)\T. This is the smoothie dual check from Chapter 3.
Unit 0.3 · Start here

Math toolkit II: calculus and logic words

Sources: L12 §2–4; Lec12_secB pp.1–4

Gradient and Hessian

Gradient
∇f(x)  =  (∂f∂x1(x), …, ∂f∂xd(x)) ⁣⊤∈Rd\nabla f(x) \;=\; \Big(\tfrac{\partial f}{\partial x_1}(x),\ \dots,\ \tfrac{\partial f}{\partial x_d}(x)\Big)^{\!\top} \in \R^d

In wordsCollect all partial derivatives into one vector. It points in the direction of steepest increase, and its length is the steepness.

Symbol by symbol
f:Rd→Rf:\R^d\to\Ra function that takes dd numbers and returns one number (a "landscape")
∂f/∂xi\partial f/\partial x_irate of change of ff if you move only coordinate ii

When you use itGradient descent moves in direction −∇f-\nabla f.

Hessian
∇2f(x)  =  [∂2f∂xi ∂xj(x)]i,j=1d∈Rd×d\nabla^2 f(x) \;=\; \Big[\tfrac{\partial^2 f}{\partial x_i\,\partial x_j}(x)\Big]_{i,j=1}^{d} \in \R^{d\times d}

In wordsThe matrix of second derivatives: how the slope changes as you move. It measures curvature.

Why it is trueFor a function with continuous second derivatives the matrix is symmetric, since ∂2f/∂xi∂xj=∂2f/∂xj∂xi\partial^2 f/\partial x_i\partial x_j=\partial^2 f/\partial x_j\partial x_i.

When you use itTesting convexity: ff is convex exactly when v⊤∇2f(x)v≥0v\T\nabla^2 f(x)v\ge0 for all vv and xx (Chapter 6).

Useful gradients to know by heart:

f(x)f(x)∇f(x)\nabla f(x)∇2f(x)\nabla^2 f(x)
c⊤xc\T x (linear)cc00
12∥x∥2\tfrac12\norm{x}^2xxII
12x⊤Qx\tfrac12 x\T Qx (QQ symmetric)QxQxQQ
12∥Ax−b∥2\tfrac12\norm{Ax-b}^2 (least squares)A⊤(Ax−b)A\T(Ax-b)A⊤AA\T A

First-order Taylor expansion and little-o

Linear approximation
f(x+h)  =  f(x)+⟨∇f(x),h⟩+o(∥h∥)f(x+h) \;=\; f(x) + \langle\nabla f(x),h\rangle + o(\norm h)

In wordsNear xx a smooth function looks like a plane (its tangent). The error is negligible compared to the step size ∥h∥\norm h when hh is tiny.

Symbol by symbol
hha small step (a vector)
⟨∇f(x),h⟩\langle\nabla f(x),h\ranglethe predicted change, i.e. the directional derivative times the step
o(∥h∥)o(\norm h)"little-o": some error term e(h)e(h) with e(h)/∥h∥→0e(h)/\norm h\to0 as h→0h\to0

When you use itDeriving the steepest descent direction. The first-order convexity inequality is the global version: the tangent stays below the graph everywhere, not only nearby.

Logic and set notation used in proofs

SymbolRead asExample
∀\forallfor every∀z∈C: v⊤z≤v⊤q\forall z\in C:\ v\T z\le v\T q
∃\existsthere exists∃ y≥0\exists\,y\ge0 with A⊤y≥cA\T y\ge c
  ⟺  \iff, "iff"if and only if (both directions)ff convex   ⟺  \iff tangent inequality
⇒\Rightarrowimplies (one direction only)primal unbounded ⇒\Rightarrow dual infeasible
{x:… }\{x: \dots\}the set of all xx such that …P={x:Ax≤b, x≥0}P=\{x:Ax\le b,\ x\ge0\}
arg⁡min⁡x∈Kf(x)\arg\min_{x\in K} f(x)a point of KK where ff is smallest (not the value)x∗∈arg⁡min⁡fx^*\in\arg\min f; f(x∗)f(x^*) is the value
min⁡\min vs inf⁡\infinf⁡\inf = greatest lower bound, may not be attainedinf⁡x>0x=0\inf_{x>0}x=0 but no minimum
max⁡\max vs sup⁡\supsup⁡\sup = least upper boundsup⁡{x:x<1}=1\sup\{x:x<1\}=1, no maximum
θ↓0\theta\downarrow0θ\theta tends to 0 from aboveused in "take the limit" proofs
δ+(S)\delta^+(S)edges leaving set SSa directed cut
P\mathcal Pset of all simple ss-tt pathspath-flow LP

Sums you will meet in convergence proofs

Harmonic sum
∑t=1T1t  ≤  1+ln⁡T.\sum_{t=1}^{T}\frac1t\;\le\;1+\ln T.

In wordsAdding 1+12+13+⋯+1T1+\tfrac12+\tfrac13+\dots+\tfrac1T grows only like a logarithm.

Symbol by symbol
ln⁡\lnnatural logarithm (in algorithm analysis log⁡\log usually means ln⁡\ln or log⁡2\log_2; they differ by a constant factor)

Why it is trueFor t≥2t\ge2, 1t≤∫t−1tdxx\frac1t\le\int_{t-1}^{t}\frac{dx}{x} because 1x≥1t\frac1x\ge\frac1t on [t−1,t][t-1,t]. Summing from t=2t=2 to TT: ∑t=2T1t≤∫1Tdxx=ln⁡T\sum_{t=2}^T\frac1t\le\int_1^T\frac{dx}x=\ln T. Add the t=1t=1 term.

When you use itStep-size schedules like ηt∝1t\eta_t\propto\frac1t produce such sums.

Other standard sums
∑t=1Tt=T(T+1)2,∑t=0T−1rt=1−rT1−r≤11−r (0≤r<1),∑t=1T1t≤2T.\sum_{t=1}^T t=\frac{T(T+1)}2,\qquad\sum_{t=0}^{T-1}r^t=\frac{1-r^T}{1-r}\le\frac1{1-r}\ (0\le r<1),\qquad\sum_{t=1}^T\frac1{\sqrt t}\le2\sqrt T.

Why it is trueArithmetic and geometric series; the last one by the same integral comparison as above (∫0Tx−1/2dx=2T\int_0^T x^{-1/2}dx=2\sqrt T).

Six proof patterns used again and again

  1. "Weighted sum of valid inequalities is valid": if a1≤b1a_1\le b_1 and a2≤b2a_2\le b_2 and y1,y2≥0y_1,y_2\ge0, then y1a1+y2a2≤y1b1+y2b2y_1a_1+y_2a_2\le y_1b_1+y_2b_2. A negative weight flips the inequality. This one fact is all of LP duality.
  2. "Take a tiny step along a segment": x+θ(y−x)x+\theta(y-x) with θ→0\theta\to0. It appears in convexity of sets, the tangent inequality, local ⇒ global, and separation.
  3. "Telescoping": ∑t=0T−1(Rt−Rt+1)=R0−RT\sum_{t=0}^{T-1}(R_t-R_{t+1})=R_0-R_T. Every middle term cancels. This is the core of the gradient-descent proof.
  4. "Telescoping with changing weights": if each step gives a term atRt−btRt+1a_tR_t-b_tR_{t+1} with nonnegative RtR_t and coefficients that change with tt, regroup by RtR_t: ∑t=0T−1(atRt−btRt+1)=a0R0+∑t=1T−1(at−bt−1)Rt−bT−1RT.\sum_{t=0}^{T-1}(a_tR_t-b_tR_{t+1})=a_0R_0+\sum_{t=1}^{T-1}(a_t-b_{t-1})R_t-b_{T-1}R_T. If at≤bt−1a_t\le b_{t-1} for every tt, each middle term is ≤0\le0 and can be dropped; if also bT−1≥0b_{T-1}\ge0, the whole sum is at most a0R0a_0R_0. Choosing step sizes or a potential function Φt=(weight)⋅Rt\Phi_t=(\text{weight})\cdot R_t so that the coefficients line up is how analyses with time-varying step sizes are done.
  5. "The largest is at least the average" (and the smallest is at most the average): if a1+⋯+ak≥sa_1+\dots+a_k\ge s, some ai≥s/ka_i\ge s/k. It proves that a threshold cut is cheap (Chapter 4), that best responses are pure (Chapter 3), and almost every approximation guarantee (Chapter 9). Picture three friends splitting a $30 bill in any way they like: somebody pays at least $10.
  6. "Multiplicative shrinking": if at≤(1−1k)at−1a_t\le(1-\frac1k)a_{t-1}, then at≤(1−1k)ta0≤e−t/ka0a_t\le(1-\frac1k)^ta_0\le e^{-t/k}a_0, using 1−x≤e−x1-x\le e^{-x} (the tangent line of e−xe^{-x} at 0). The quantity falls below any target after about kln⁡(a0/target)k\ln(a_0/\text{target}) steps. Used for greedy vertex cover (unit 9.4).
Unit 1.1 · Linear programs: models and forms

What is a linear program?

Sources: L9 §3; Lec_9_SecB p.1 (board notes)

A linear program (LP) has real-valued variables, a linear objective, and linear constraints that are equalities or non-strict inequalities. The course writes every LP in one standard shape.

Canonical maximization form (the course convention)
maximizec⊤xsubject toAx≤bx≥0A∈Rm×n, b∈Rm, c∈Rn.\begin{aligned} \text{maximize}\quad & c\T x \\ \text{subject to}\quad & Ax \le b \\ & x \ge 0 \end{aligned} \qquad A\in\R^{m\times n},\ b\in\R^m,\ c\in\R^n.

In wordsPick nn nonnegative numbers x1,…,xnx_1,\dots,x_n that make a linear score ∑icixi\sum_i c_ix_i as large as possible, while mm linear "budget" rows ∑iAjixi≤bj\sum_i A_{ji}x_i\le b_j all hold.

Symbol by symbol
x∈Rnx\in\R^nthe decision variables: what you choose (an n×1n\times1 column)
c∈Rnc\in\R^nobjective coefficients: score per unit of each variable (n×1n\times1)
c⊤x=∑icixic\T x=\sum_i c_ix_ithe objective, the number you maximize
A∈Rm×nA\in\R^{m\times n}constraint matrix: one row per constraint, one column per variable
b∈Rmb\in\R^mright-hand sides: the limits (m×1m\times1)
Ax≤bAx\le bmm inequalities ∑i=1nAjixi≤bj\sum_{i=1}^n A_{ji}x_i\le b_j, one for each j=1,…,mj=1,\dots,m
x≥0x\ge0nn sign constraints xi≥0x_i\ge0

When you use itEvery LP you meet can be converted to this form (unit 1.5). The dual, complementary slackness, and the strong-duality proof are all stated for it.

Am × n xn × 1 ≤ bm × 1 m = number of constraintsn = number of variables(inner sizes match: n = n)
Dimension check: an m×nm\times n matrix times an n×1n\times1 vector gives an m×1m\times1 vector, the same shape as bb.

The vocabulary, side by side

WordMeaningWhat it proves (max problem)
Feasible point xxsatisfies all constraintsOPT≥c⊤x\opt\ge c\T x (a lower bound)
Optimal point x∗x^*feasible and bestOPT=c⊤x∗\opt=c\T x^*
OPT\opta number, the best objective value
Certificate yy (Chapter 3)constraint weightsOPT≤b⊤y\opt\le b\T y (an upper bound)

Why bother? What LPs give you

  1. Modeling. Real variables and linear constraints express resource allocation, flows and many graph problems.
  2. Algorithms. Rational LPs can be solved in polynomial time (in the bit length of the input). In this course the solver is a black box (unit 2.6).
  3. Certificates. A feasible solution plus a matching dual solution proves optimality without rerunning anything (Chapter 3).
  4. Geometry. At an optimum, tight constraints block every improving direction (Chapter 5).
  5. Rounding. A fractional LP optimum can guide the search for an integral solution. Max-flow/min-cut is an exact example (Chapter 4), and approximation algorithms (Chapter 9) build on this.
Unit 1.2 · Linear programs: models and forms

How to turn a problem into an LP

Sources: L9 §3–4; added modeling checklist

Decide what each variable means before writing any equation. An equation is only correct if it represents the decisions you intend.

  1. Define the decisions and their units. For example "xix_i = liters of smoothie ii" or "fef_e = flow on edge ee". State whether each variable is ≥0\ge0, ≤0\le0 or free. LP variables are real numbers.
  2. Write the goal as a linear score. If one unit of choice ii contributes cic_i, the total is ∑icixi\sum_i c_ix_i. Use max for revenue or throughput and min for cost or error.
  3. Write one linear constraint per rule. Usage ≤ supply. Demand served ≥ requirement. Inflow = outflow. Include every bound and sign. Check that units match on both sides.
  4. Check both directions. (a) Every valid real-world plan gives a feasible vector. (b) Every feasible vector describes a valid plan. Failing (a) cuts off good solutions; failing (b) lets the LP "cheat".

What is, and is not, an LP

ExpressionPlain LP?Why
3x1−2x2+73x_1-2x_2+7 as objectiveYesAffine. The constant 7 shifts every value equally and does not change the optimizer.
3u−2v≥73u-2v\ge 7YesLinear. Multiply by −1 to get the ≤ form.
x1x2≤1x_1x_2\le1NoProduct of two variables (nonlinear).
objective x12+x22x_1^2+x_2^2NoQuadratic. It is a convex optimization problem (Chapter 6), but not an LP.
xi∈{0,1}x_i\in\{0,1\} or xi∈Zx_i\in\ZNoDiscrete. This makes an integer program, which is NP-hard in general. Chapter 9 drops the integrality, solves the LP, and rounds.
x<2x<2 (strict)Not allowed"max xx s.t. x<2x<2" has supremum 2 but no maximizing point.
∣x1∣≤3|x_1|\le 3Yes, after rewritingSame as x1≤3x_1\le3 and −x1≤3-x_1\le3.
max⁡(x1,x2)≤3\max(x_1,x_2)\le 3Yes, after rewritingSame as x1≤3x_1\le3 and x2≤3x_2\le3.
min⁡(x1,x2)≤3\min(x_1,x_2)\le 3No"x1≤3x_1\le3 or x2≤3x_2\le3" describes a non-convex region (an L-shape).
Unit 1.3 · Linear programs: models and forms

Worked model: the smoothie LP

Sources: L9 §3.1, §8; Lec_9_SecB p.2 (A written on board)

This example runs through Chapters 1–3, so it is worth knowing well.

Inventory: 3 oranges, 10 bananas, 6 strawberries. You may make fractional liters.

SmoothieOrangesBananasStrawberriesRevenue / liter
1120$5
2012$4
3111$6

Let xix_i = liters of smoothie ii. Each ingredient gives a constraint (a row) and each smoothie gives a variable (a column):

The smoothie LP
max⁡5x1+4x2+6x3s.t.x1+x3≤3(oranges)2x1+x2+x3≤10(bananas)2x2+x3≤6(strawberries)x1,x2,x3≥0.\begin{aligned} \max\quad & 5x_1+4x_2+6x_3 \\ \text{s.t.}\quad & x_1+x_3\le 3 &&\text{(oranges)}\\ & 2x_1+x_2+x_3\le 10 &&\text{(bananas)}\\ & 2x_2+x_3\le 6 &&\text{(strawberries)}\\ & x_1,x_2,x_3\ge0. \end{aligned}

In wordsRevenue is $5, $4, $6 per liter. Each row adds up how much of one fruit the whole plan uses and caps it at the stock.

Symbol by symbol
Row "oranges"smoothie 1 uses 1, smoothie 2 uses 0, smoothie 3 uses 1
Row "bananas"2x1+1x2+1x32x_1+1x_2+1x_3 bananas used, at most 10 available
Row "strawberries"0x1+2x2+1x30x_1+2x_2+1x_3 used, at most 6
Matrix form
A=(101211021),b=(3106),c=(546).A=\begin{pmatrix}1&0&1\\2&1&1\\0&2&1\end{pmatrix},\qquad b=\begin{pmatrix}3\\10\\6\end{pmatrix},\qquad c=\begin{pmatrix}5\\4\\6\end{pmatrix}.

In wordsRows of AA are fruits (orange, banana, strawberry). Columns are smoothies 1, 2, 3. m=n=3m=n=3.

When you use itThe L9 exercise "write A,b,cA,b,c" (the instructor wrote this AA on the board).

Checking a candidate: x=(3,3,0)x=(3,3,0)

FruitUsage at x=(3,3,0)x=(3,3,0)StockStatus
Oranges3+0=33+0=33tight (all used)
Bananas2⋅3+3+0=92\cdot3+3+0=910slack 1
Strawberries2⋅3+0=62\cdot3+0=66tight

All variables are ≥ 0, so xx is feasible. Its revenue is 5⋅3+4⋅3+6⋅0=275\cdot3+4\cdot3+6\cdot0=27. This proves OPT≥27\opt\ge27. It does not yet prove optimality. The matching upper bound is in unit 3.1.

L9 exercise: what changes if smoothies can only be sold in whole-liter batches?
Show answer
Add xi∈Zx_i\in\Z (integers). The model becomes an integer program, not an LP. Integer programs are NP-hard in general. Here the LP optimum (3,3,0)(3,3,0) happens to be integral, so it is also the integer optimum. That is luck, not a rule: an LP with integer data can have only fractional optima (try max⁡x1\max x_1 s.t. 2x1≤12x_1\le1).
Is x=(1,4,1)x=(1,4,1) feasible? What about (0,2,2)(0,2,2)?
Show answer
(1,4,1)(1,4,1): strawberries 2⋅4+1=9>62\cdot4+1=9>6, so infeasible. (0,2,2)(0,2,2): oranges 0+2=2≤30+2=2\le3, bananas 0+2+2=4≤100+2+2=4\le10, strawberries 4+2=6≤64+2=6\le6. Feasible, with revenue 8+12=20≤278+12=20\le27.
Unit 1.4 · Linear programs: models and forms

Maximum flow is an LP

Sources: L9 §4.1

Max flow (L8) is our first graph problem written as an LP. Give each directed edge ee a real variable fef_e, the amount of flow on it.

Edge-flow LP
max⁡∑(s,v)∈Efsv  −  ∑(v,s)∈Efvss.t.∑(u,v)∈Efuv  =  ∑(v,w)∈Efvw∀v∉{s,t}0≤fe≤ce∀e∈E.\begin{aligned} \max\quad & \sum_{(s,v)\in E} f_{sv}\;-\;\sum_{(v,s)\in E} f_{vs} \\ \text{s.t.}\quad & \sum_{(u,v)\in E} f_{uv} \;=\; \sum_{(v,w)\in E} f_{vw} \qquad \forall v\notin\{s,t\} \\ & 0\le f_e\le c_e \qquad \forall e\in E. \end{aligned}

In wordsMaximize the net flow leaving the source. At every vertex other than ss and tt, what flows in must flow out. Every edge carries between 0 and its capacity.

Symbol by symbol
EE, VVdirected edges and vertices of the network
fuvf_{uv}flow on edge u→vu\to v (a variable)
cec_ecapacity of edge ee (given data, ≥ 0)
∑(u,v)∈Efuv\sum_{(u,v)\in E} f_{uv}inflow into vv: sum over all edges ending at vv
∑(v,w)∈Efvw\sum_{(v,w)\in E} f_{vw}outflow from vv: sum over all edges starting at vv

Why it is trueEach constraint is linear in the ff's, so this is an LP. The objective uses net outflow because flow that leaves ss and later returns to it should not count as throughput.

When you use itSize: ∣E∣|E| variables and O(∣E∣+∣V∣)O(|E|+|V|) constraints, i.e. polynomial. Compare the path LP in Chapter 4, which can have exponentially many variables.

s a b t 2 / 3 2 / 2 2 / 2 2 / 3
The running network for Chapters 1 and 4. A label "2 / 3" means flow 2 on an edge of capacity 3. This flow has value 4, so max flow ≥ 4.
Unit 1.5 · Linear programs: models and forms

Converting any LP to canonical form

Sources: L9 §4.2; Lec11_SecB p.1 (x = max(0,x) − max(0,−x))

Every linear program can be rewritten as max⁡c⊤x, Ax≤b, x≥0\max c\T x,\ Ax\le b,\ x\ge0 without changing what it represents.

FeatureConversionWhy it is equivalent
min⁡ c⊤x\min\ c\T xmax⁡ (−c)⊤x\max\ (-c)\T x, then negate the valueThe smallest c⊤xc\T x is where −c⊤x-c\T x is largest.
a⊤x≥da\T x\ge d−a⊤x≤−d-a\T x\le -dMultiplying by −1 flips an inequality.
a⊤x=da\T x=da⊤x≤da\T x\le d and −a⊤x≤−d-a\T x\le -dBoth together force equality.
Free variable zzz=z+−z−z=z^+-z^- with z+,z−≥0z^+,z^-\ge0Every real number is a difference of two nonnegative numbers.
Variable z≤0z\le0z=−z′z=-z' with z′≥0z'\ge0Flip its sign.
a⊤x≤da\T x\le d → equalitya⊤x+s=d, s≥0a\T x+s=d,\ s\ge0The slack variable s=d−a⊤xs=d-a\T x is the unused amount.
Splitting a free variable
z  =  z+−z−,z+=max⁡(0,z)≥0,z−=max⁡(0,−z)≥0.z \;=\; z^+ - z^-,\qquad z^+=\max(0,z)\ge0,\qquad z^-=\max(0,-z)\ge0.

In wordsKeep the positive part and the negative part of zz as two separate nonnegative numbers.

Symbol by symbol
z+z^+positive part: zz if z>0z>0, else 0
z−z^-negative part: −z-z if z<0z<0, else 0

Why it is trueIf z≥0z\ge0: z+−z−=z−0z^+-z^-=z-0. If z<0z<0: z+−z−=0−(−z)=zz^+-z^-=0-(-z)=z. (The instructor wrote this formula on the L11 board.)

When you use itWhenever a variable is "unrestricted" or "free" and you need canonical form, e.g. to take a dual.

Worked exercise (L9): min⁡(2u−v)\min(2u-v) s.t. u−v=3, u≥0, vu-v=3,\ u\ge0,\ v free

  1. Free variable: v=v+−v−v=v^+-v^- with v+,v−≥0v^+,v^-\ge0. All variables u,v+,v−u,v^+,v^- are now nonnegative.
  2. Min → max: max⁡ −2u+v+−v−\max\ -2u+v^+-v^-.
  3. Equality → two inequalities: u−v++v−≤3u-v^++v^-\le3 and −u+v+−v−≤−3-u+v^+-v^-\le-3.
max⁡ −2u+v+−v−s.t.(1−11−11−1)(uv+v−)≤(3−3),u,v+,v−≥0.\max\ -2u+v^+-v^- \quad\text{s.t.}\quad \begin{pmatrix}1&-1&1\\-1&1&-1\end{pmatrix}\begin{pmatrix}u\\v^+\\v^-\end{pmatrix}\le\begin{pmatrix}3\\-3\end{pmatrix},\quad u,v^+,v^-\ge0.

Solve by elimination: u−v=3u-v=3 gives v=u−3v=u-3, so 2u−v=u+32u-v=u+3. This is smallest when uu is smallest, i.e. u=0u=0. So v=−3v=-3 and the minimum is 33. The transformed maximum is −3-3, attained for example at u=0,v+=0,v−=3u=0,v^+=0,v^-=3.

Standard (equality) form with slack variables

Ax≤b, x≥0⟺Ax+s=b, x≥0, s≥0Ax\le b,\ x\ge0 \quad\Longleftrightarrow\quad Ax+s=b,\ x\ge0,\ s\ge0

In wordsAdd one nonnegative slack per row to absorb the unused amount.

Symbol by symbol
s=b−Axs=b-Axslack vector: sjs_j is how much of resource jj is left over
sj=0s_j=0row jj is tight (fully used)

When you use itSlacks reappear in complementary slackness: yjsj=0y_js_j=0 (unit 3.6).

Unit 1.6 · Linear programs: models and forms

Modeling tricks: absolute values, max/min objectives, and reductions

Sources: L9 §4.2 (forms); standard LP modeling techniques

Many problems that do not look linear (absolute values, a maximum of several expressions) become LPs with one extra trick: introduce a new variable for the awkward quantity and bound it with linear inequalities.

Trick 1: minimizing an absolute value

Epigraph variable for |e|
min⁡ ∣e(x)∣⇝min⁡ ts.t.t≥e(x),t≥−e(x).\min\ |e(x)| \qquad\leadsto\qquad \min\ t\quad\text{s.t.}\quad t\ge e(x),\quad t\ge -e(x).

In wordsReplace ∣e∣|e| by a new variable tt that must sit above both ee and −e-e. Minimizing pushes tt down until it equals the larger of the two, which is ∣e∣|e|.

Symbol by symbol
e(x)e(x)any affine expression in the variables, e.g. 3x1−x2+23x_1-x_2+2
ttnew free variable; the two constraints force t≥∣e(x)∣t\ge|e(x)|

Why it is trueFeasible tt are exactly the numbers ≥max⁡{e,−e}=∣e∣\ge\max\{e,-e\}=|e|. At an optimum tt is as small as possible, so t=∣e(x)∣t=|e(x)|. This is the same as minimizing over the epigraph of ∣⋅∣|\cdot| (unit 6.2).

When you use itFor a sum ∑i∣ei(x)∣\sum_i|e_i(x)|, use one variable tit_i per term: min⁡∑iti\min\sum_it_i, ti≥±ei(x)t_i\ge\pm e_i(x). The number of new variables and constraints is linear in the number of terms, so the LP stays polynomial size.

Trick 2: minimizing a maximum

One variable for the worst case
min⁡x max⁡i ei(x)⇝min⁡ ts.t.t≥ei(x)  ∀i.\min_x\ \max_{i}\ e_i(x)\qquad\leadsto\qquad \min\ t\quad\text{s.t.}\quad t\ge e_i(x)\ \ \forall i.

In wordsA single variable tt must be above every expression. Minimizing tt makes it equal the largest one.

Symbol by symbol
ttfree variable representing the worst (largest) value
max⁡i∣ei(x)∣\max_i|e_i(x)|combine both tricks: t≥ei(x)t\ge e_i(x) and t≥−ei(x)t\ge-e_i(x) for every ii

When you use itMinimax ("make the worst case as good as possible") objectives: worst-case error, makespan, bottleneck capacity.

Mirror image: maximizing a minimum
max⁡x min⁡j ej(x)⇝max⁡ vs.t.v≤ej(x)  ∀j.\max_x\ \min_j\ e_j(x)\qquad\leadsto\qquad\max\ v\quad\text{s.t.}\quad v\le e_j(x)\ \ \forall j.

In wordsA variable vv that is below every expression, pushed up as far as possible, equals the smallest expression.

When you use itGuaranteed-payoff problems, such as choosing a strategy in a game (unit 3.8).

Reductions: "this LP form can express that one"

A statement like "if we can solve every LP of form 1 in polynomial time, we can solve every LP of form 2" is a reduction. A correct reduction argument has three parts:

  1. Transform an instance of form 2 into an instance of form 1, using only polynomially many new variables and constraints (and numbers of polynomial bit length).
  2. Map solutions both ways. Every feasible solution of the new LP gives a feasible solution of the old one with the same objective value, and vice versa. Then the optimal values agree, and infeasible/unbounded is preserved.
  3. Recover an optimal solution of the original from one of the transformed LP in polynomial time.

The building blocks are the conversions of unit 1.5: split free variables, add slack variables to turn ≤\le into ==, write == as two ≤\le, negate to flip ≥\ge or min.

Unit 2.1 · The geometry of an LP

Convex sets: every segment stays inside

Sources: L9 §5; Lec_9_SecB p.3 (board pictures)

"Convex" is the property that makes LPs, and later convex optimization, tractable. It says you can blend any two feasible choices and the blend is still feasible.

Definition: convex set
P⊆Rn is convex  ⟺  ∀ x,y∈P, ∀ λ∈[0,1]:λx+(1−λ)y∈P.P\subseteq\R^n \text{ is convex} \iff \forall\,x,y\in P,\ \forall\,\lambda\in[0,1]:\quad \lambda x+(1-\lambda)y\in P.

In wordsPick any two points of the set. The whole straight segment between them must also lie in the set.

Symbol by symbol
λx+(1−λ)y\lambda x+(1-\lambda)ya blend (convex combination): λ\lambda parts of xx and 1−λ1-\lambda parts of yy
λ=1\lambda=1gives xx; λ=0\lambda=0 gives yy; λ=12\lambda=\tfrac12 gives the midpoint
λ∈[0,1]\lambda\in[0,1]as λ\lambda sweeps from 0 to 1 the blend traces the whole segment from yy to xx

Why it is trueIt is a definition, so nothing to prove. To show a set is not convex, one pair of points and one λ\lambda whose blend falls outside is enough.

When you use itLP regions (below), domains of convex functions, the separation theorem, and the local ⇒ global proof.

convex: every line of sight stays inside not convex: the view leaves the room
One pair of points whose segment leaves the set is enough to show a set is not convex.
The one-line proof
A(λx+(1−λ)y)  =  λAx+(1−λ)Ay  ≤  λb+(1−λ)b  =  b.A\big(\lambda x+(1-\lambda)y\big) \;=\; \lambda Ax+(1-\lambda)Ay \;\le\; \lambda b+(1-\lambda)b \;=\; b.

In wordsApplying the constraints to a blend gives the same blend of the two constraint values, and both of those are within the limit.

Symbol by symbol
first ==matrix multiplication is linear (distributes over sums and scalars)
≤\leuses Ax≤bAx\le b, Ay≤bAy\le b, and that the weights λ\lambda and 1−λ1-\lambda are both ≥0\ge0, so multiplying keeps the direction of ≤\le
last ==λ+(1−λ)=1\lambda+(1-\lambda)=1

Why it is trueNonnegativity also survives: each coordinate of the blend is a nonnegative weighting of nonnegative numbers. Equalities survive by the same calculation with == in place of ≤\le.

Operations on convex sets

OperationConvex?Reason
intersection K∩LK\cap L (even of infinitely many sets)alwaysa segment between two points of K∩LK\cap L lies in KK (convex) and in LL (convex), hence in both
union K∪LK\cup Lnot in generala segment may start in KK, end in LL, and cross a gap in between
image or preimage under an affine map x↦Mx+vx\mapsto Mx+valwaysaffine maps send segments to segments
halfspace {a⊤x≤d}\{a\T x\le d\}, hyperplane, ball, box, simplexalwayscheck the definition directly (for a ball: triangle inequality)
sublevel set {x:f(x)≤c}\{x: f(x)\le c\} of a convex functionalwaysf(λx+(1−λ)y)≤λf(x)+(1−λ)f(y)≤cf(\lambda x+(1-\lambda)y)\le\lambda f(x)+(1-\lambda)f(y)\le c
Unit 2.2 · The geometry of an LP

Solving a 2-D LP by sliding the objective line

Sources: L9 §5.1; Lec_9_SecB p.4

The running 2-D example:

max⁡ 2x1+3x2s.t.x1+x2≤5,x1≥1,x2≥0.\max\ 2x_1+3x_2 \quad\text{s.t.}\quad x_1+x_2\le5,\quad x_1\ge1,\quad x_2\ge0.

The feasible region is the triangle with corners (1,0)(1,0), (5,0)(5,0), (1,4)(1,4).

Level lines of the objective
{x: c⊤x=q}  =  {x: 2x1+3x2=q}\{x:\ c\T x = q\} \;=\; \{x:\ 2x_1+3x_2=q\}

In wordsEvery point on this line has the same score qq. Changing qq slides the line parallel to itself. Increasing qq moves it in the direction of c=(2,3)c=(2,3).

Symbol by symbol
qqthe objective value (a number you choose); one line per value
c=(2,3)c=(2,3)the normal to the line (perpendicular to it), pointing toward larger qq. It is not the slope.

Why it is trueMoving from a point xx by a step hh changes the objective by c⊤hc\T h. Steps along the line have c⊤h=0c\T h=0, so they are perpendicular to cc. A step h=t ch=t\,c with t>0t>0 changes it by t∥c∥2>0t\norm{c}^2>0, so moving along cc increases the score fastest.

When you use itGraphical LP solving: slide the line in direction cc until it is about to lose contact with PP. The last contact point(s) are optimal.

Vertex2x1+3x22x_1+3x_2Tight constraints (pin it down)
(1,0)(1,0)2x1=1x_1=1, x2=0x_2=0
(5,0)(5,0)10x1+x2=5x_1+x_2=5, x2=0x_2=0
(1,4)(1,4)14x1=1x_1=1, x1+x2=5x_1+x_2=5

The unique optimum is (1,4)(1,4) with value 14.

Non-unique optima

With objective x1+x2x_1+x_2, every point of the edge from (1,4)(1,4) to (5,0)(5,0) has value 5, so the whole edge is optimal. The level line is parallel to that edge. The instructor's board note: "Obs: Opt soln need not be unique", with a second example max⁡x1\max x_1 s.t. x1≤2, x2≤1, x≥0x_1\le2,\ x_2\le1,\ x\ge0, where every point (2,x2)(2,x_2) with 0≤x2≤10\le x_2\le1 is optimal.

Unit 2.3 · The geometry of an LP

The three possible outcomes of an LP

Sources: L9 §6

Before looking for an optimal point, ask two questions. Is there any feasible point? Is the objective bounded in the direction you optimize?

OutcomeMeaningExample
InfeasibleNo vector satisfies all constraints (P=∅P=\varnothing).x≥2, x≤1x\ge2,\ x\le1
Unbounded (objective)Feasible points with arbitrarily large objective exist.max⁡x\max x s.t. x≥0x\ge0
Finite optimumThe best value is finite, and an LP then attains it.max⁡−x\max -x s.t. x≥0x\ge0: x∗=0x^*=0
Infeasible x ≤ 1x ≥ 2no overlap Unbounded: max x, x ≥ 0 objective keeps growing 0 Finite: max −x, x ≥ 0 better ← x* = 0region unbounded, objective is not
Unit 2.4 · The geometry of an LP

Tight constraints and vertices

Sources: L9 §6
Tight (active) constraint
a⊤x≤d  is tight at x  ⟺  a⊤x=d.a\T x\le d \ \text{ is tight at } x \iff a\T x = d.

In wordsA constraint is tight when the point sits exactly on its boundary wall. "Tight", "active" and "binding" mean the same thing. The opposite is "slack" or "inactive" (a⊤x<da\T x<d).

Symbol by symbol
aathe normal vector of the constraint, pointing out of the feasible side (the direction in which a⊤xa\T x grows)
d−a⊤xd-a\T xthe slack: zero when tight
Why n independent tight constraints pin down a point
{a1⊤x=d1 ⋮an⊤x=dnwith a1,…,an independent  ⟹  Bx=d has exactly one solution.\begin{cases} a_1\T x=d_1\\ \ \vdots\\ a_n\T x=d_n\end{cases}\quad\text{with } a_1,\dots,a_n \text{ independent} \;\Longrightarrow\; Bx=d \text{ has exactly one solution.}

In wordsEach tight equation is a wall through the point. In Rn\R^n, nn walls facing genuinely different directions cross at exactly one point. Fewer walls, or dependent walls, cross in a line or a plane.

Symbol by symbol
BBthe n×nn\times n matrix whose rows are a1⊤,…,an⊤a_1\T,\dots,a_n\T
independent rowsBB is invertible (det⁡B≠0\det B\ne0), so x=B−1dx=B^{-1}d is unique

When you use itPolynomial bit size (unit 2.6), the box-constraint exercise, and identifying vertices in exam questions.

Smoothie example: which three constraints pin (3,3,0)(3,3,0)?

Tight at (3,3,0)(3,3,0): oranges x1+x3=3x_1+x_3=3, strawberries 2x2+x3=62x_2+x_3=6, and x3=0x_3=0 (that is, −x3≤0-x_3\le0 is tight). Normals (1,0,1)(1,0,1), (0,2,1)(0,2,1), (0,0,−1)(0,0,-1) are independent: the determinant of the matrix with these rows is 1⋅(2⋅(−1)−1⋅0)−0+1⋅0=−2≠01\cdot(2\cdot(-1)-1\cdot0)-0+1\cdot0=-2\ne0. Their only common solution is (3,3,0)(3,3,0), so it is a vertex. Bananas are slack (9<109<10).

Unit 2.5 · The geometry of an LP

Some optimal solution is at a vertex

Sources: L9 §6

So why not just check every corner?

A vertex is chosen by picking nn of the m+nm+n constraints to be tight, so there can be up to (m+nn)\binom{m+n}{n} vertices. That is exponential. A cube in Rn\R^n (0≤xi≤10\le x_i\le1) already has 2n2^n corners. Even choosing among just 40 constraints gives 240≈10122^{40}\approx10^{12} subsets, so guessing "which constraints are tight" by brute force is hopeless. Checking every corner is correct but does not scale: real LP algorithms (simplex, ellipsoid, interior point) avoid enumeration.

Unit 2.6 · The geometry of an LP

Polynomial-time solvability and short exact answers

Sources: L9 §7

The ellipsoid method and interior-point methods are the algorithms behind this theorem. The course uses LP solving as a tool and does not develop them.

Why the answer can be written with polynomially many bits

Pick a vertex optimum and nn independent tight constraints. They form a nonsingular square system Bx=dBx=d, so x=B−1dx=B^{-1}d. Cramer's rule gives each coordinate:

Cramer's rule
xi  =  det⁡(Bi)det⁡(B),Bi=B with column i replaced by d.x_i \;=\; \frac{\det(B_i)}{\det(B)},\qquad B_i = B \text{ with column } i \text{ replaced by } d.

In wordsEach coordinate of a vertex is a ratio of two determinants of matrices built from the input numbers.

Symbol by symbol
det⁡(B)≠0\det(B)\neq0because the nn tight rows are independent
det⁡\det of an integer matrixa sum of n!n! signed products of nn entries

Why it is trueClear denominators so all entries are integers of absolute value at most 2L2^L. Then each product is at most 2nL2^{nL} and a sum of n!≤nnn!\le n^n of them is at most 2nL+nlog⁡n2^{nL+n\log n}. That is O(nL+nlog⁡n)O(nL+n\log n) bits, polynomial in the input size.

When you use itIt shows an exact optimum is short. It does not tell you which constraints to make tight, so it is not an algorithm.

Exercise (L9): few fractional coordinates

Claim. An LP in nn variables with box constraints 0≤xi≤10\le x_i\le1 and only kk other linear inequalities: every vertex has at most kk coordinates strictly between 0 and 1.

Unit 3.1 · LP duality

A certificate: an upper bound that meets your solution

Sources: L9 §8; L10 §1; Lec10_SecB p.1 (board)

You found x=(3,3,0)x=(3,3,0) with revenue 27. How can you prove nobody can do better without trying every plan? Combine the constraints into one inequality that bounds the objective from above.

Take 5 × the orange row plus 2 × the strawberry row:

The smoothie certificate
5(x1+x3)+2(2x2+x3)  ≤  5⋅3+2⋅6  =  275(x_1+x_3)+2(2x_2+x_3)\;\le\;5\cdot3+2\cdot6 \;=\;27

In wordsWeighted sums of valid "≤" inequalities with nonnegative weights are still valid.

Symbol by symbol
55weight (multiplier) on the orange constraint x1+x3≤3x_1+x_3\le3
00weight on bananas (not used)
22weight on the strawberry constraint 2x2+x3≤62x_2+x_3\le6

Why it is trueMultiplying x1+x3≤3x_1+x_3\le3 by 5≥05\ge0 keeps the direction, and so does multiplying by 2. Adding two valid ≤ inequalities gives a valid ≤.

Expand the left side: 5x1+4x2+7x35x_1+4x_2+7x_3. Compare it to the objective coefficient by coefficient:

5x1+4x2+6x3⏟objective  ≤  5x1+4x2+7x3  ≤  27for every feasible x.\underbrace{5x_1+4x_2+6x_3}_{\text{objective}} \;\le\; 5x_1+4x_2+7x_3 \;\le\; 27 \quad\text{for every feasible }x.

In wordsThe combined left side beats the objective on every coefficient (5 ≥ 5, 4 ≥ 4, 7 ≥ 6). Since all xi≥0x_i\ge0, it is at least the objective. So no feasible plan earns more than 27.

Why it is trueFirst ≤\le: 6x3≤7x36x_3\le7x_3 because x3≥0x_3\ge0 ("6 ≤ 7, and x3x_3 is nonnegative"). Second ≤\le: the weighted sum above. Equivalently, add one copy of −x3≤0-x_3\le0 to make the left side exactly the objective.

When you use it27 (feasible) ≤ OPT ≤ 27 (certificate), so OPT=27\opt=27 and (3,3,0)(3,3,0) is optimal.

feasible solutions: lower bounds → ← certificates: upper bounds 27 value →
When a lower bound and an upper bound meet, both are optimal (L9/L10 figure).

Mirror image: certificates for a minimization LP

For min⁡c⊤x\min c\T x s.t. Ax≥b, x≥0Ax\ge b,\ x\ge0, a feasible point gives an upper bound on OPT\opt, and the certificate must give a lower bound. Same idea, all directions flipped:

Lower bound from ≥ constraints
y≥0,A⊤y≤c⟹c⊤x  ≥  (A⊤y)⊤x  =  y⊤Ax  ≥  y⊤bfor every feasible x.y\ge0,\quad A\T y\le c\quad\Longrightarrow\quad c\T x\;\ge\;(A\T y)\T x\;=\;y\T Ax\;\ge\;y\T b\qquad\text{for every feasible }x.

In wordsTake a nonnegative combination of the ≥ rows. If every combined coefficient is at most the cost coefficient, the combination is below the objective, so its right side b⊤yb\T y is a lower bound on every feasible cost.

Symbol by symbol
y≥0y\ge0multiplying a ≥ row by a nonnegative number keeps ≥
A⊤y≤cA\T y\le cthe combination never "overcharges" any variable; with x≥0x\ge0 this gives c⊤x≥(A⊤y)⊤xc\T x\ge(A\T y)\T x
b⊤yb\T ythe lower bound; the best one is max⁡b⊤y\max b\T y, the dual of a min problem
Unit 3.2 · LP duality

Deriving the dual: optimize over upper bounds

Sources: L10 §2; Lec10_SecB p.2 (lemma on board)

Generalize the smoothie argument to any canonical LP (P) max⁡c⊤x(P)\ \max c\T x s.t. Ax≤b, x≥0Ax\le b,\ x\ge0. Put a weight yjy_j on row jj and add up.

Step 1: weighted sum of the rows
∑j=1myj(∑i=1nAjixi)  ≤  ∑j=1myjbj(valid if every yj≥0)\sum_{j=1}^{m} y_j\Big(\sum_{i=1}^{n}A_{ji}x_i\Big) \;\le\; \sum_{j=1}^{m} y_j b_j \qquad\text{(valid if every } y_j\ge0)

In wordsMultiply constraint jj by yjy_j and add all mm of them.

Symbol by symbol
yjy_jthe multiplier (weight, "price") on constraint jj
∑iAjixi\sum_i A_{ji}x_ileft side of row jj
∑jyjbj=b⊤y\sum_j y_jb_j=b\T ythe resulting upper bound

Why it is trueEach row satisfies (Ax)j≤bj(Ax)_j\le b_j. Multiplying by yj≥0y_j\ge0 keeps ≤\le, and sums of ≤'s are ≤.

Step 2: regroup by variable
∑jyj∑iAjixi  =  ∑i=1n(∑j=1mAjiyj⏟(A⊤y)i)xi\sum_{j}y_j\sum_i A_{ji}x_i \;=\; \sum_{i=1}^{n}\Big(\underbrace{\sum_{j=1}^{m}A_{ji}y_j}_{(A\T y)_i}\Big)x_i

In wordsSwap the order of summation. The coefficient that multiplies xix_i is the column-ii sum (A⊤y)i(A\T y)_i. This is where the transpose comes from.

Why it is trueA finite double sum can be added in any order.

Step 3: dominate the objective (the weak-duality chain)
c⊤x  ≤  (A⊤y)⊤x  =  y⊤Ax  ≤  y⊤bif A⊤y≥c, y≥0, x≥0, Ax≤b.c\T x \;\le\; (A\T y)\T x \;=\; y\T Ax \;\le\; y\T b \qquad\text{if } A\T y\ge c,\ y\ge0,\ x\ge0,\ Ax\le b.

In wordsIf every combined coefficient is at least the objective coefficient, the combination is an upper bound on the objective for every feasible xx.

Symbol by symbol
1st ≤\leuses x≥0x\ge0 and A⊤y≥cA\T y\ge c: cixi≤(A⊤y)ixic_ix_i\le(A\T y)_ix_i term by term
==transpose identity: (A⊤y)⊤x=y⊤Ax(A\T y)\T x=y\T Ax
2nd ≤\leuses y≥0y\ge0 and Ax≤bAx\le b
The primal–dual pair (canonical form)
(P)  max⁡ c⊤x  s.t. Ax≤b, x≥0(D)  min⁡ b⊤y  s.t. A⊤y≥c, y≥0.(P)\ \ \max\ c\T x\ \ \text{s.t.}\ Ax\le b,\ x\ge0 \qquad\qquad (D)\ \ \min\ b\T y\ \ \text{s.t.}\ A\T y\ge c,\ y\ge0.

In wordsThe dual looks for the cheapest valid set of multipliers, i.e. the tightest upper bound.

Symbol by symbol
min⁡\minthe smallest upper bound is the most informative one
A⊤y≥cA\T y\ge cnn constraints, one per primal variable (domination)
y≥0y\ge0mm variables, one per primal constraint (direction kept)

When you use itRemember the duality "dictionary" below. It makes writing duals mechanical.

Primal (max)Dual (min)
nn variables xix_inn constraints (A⊤y)i≥ci(A\T y)_i\ge c_i
mm constraints (Ax)j≤bj(Ax)_j\le b_jmm variables yj≥0y_j\ge0
objective coefficients ccright-hand sides cc
right-hand sides bbobjective coefficients bb
matrix AA (m×nm\times n)matrix A⊤A\T (n×mn\times m)
Unit 3.3 · LP duality

Weak duality, the smoothie dual, and prices

Sources: L10 §3 (marked "Optional")
Weak duality
c⊤x  ≤  b⊤yfor every primal-feasible x and dual-feasible y.c\T x\;\le\;b\T y\qquad\text{for every primal-feasible } x \text{ and dual-feasible } y.

In wordsAny feasible primal value is at most any feasible dual value. Max-side values never pass min-side values.

Why it is trueIt is the chain from the previous unit. (The proof was marked Optional in class. The one-line chain is all you need.)

When you use it(1) Any dual-feasible yy gives an upper bound on OPT\opt. (2) If c⊤x=b⊤yc\T x=b\T y for a feasible pair, both are optimal. You do not need strong duality for that conclusion.

Why matching values prove optimality
c⊤x  ≤  OPTP  ≤  OPTD  ≤  b⊤y.c\T x\;\le\;\opt_P\;\le\;\opt_D\;\le\;b\T y.

In wordsThe primal optimum lies between your feasible value and the dual optimum, which lies below your dual value. If the two ends are equal, everything in between is squeezed to the same number.

The smoothie dual, explicitly

Dual of the smoothie LP
min⁡3yO+10yB+6ySs.t.yO+2yB≥5(smoothie 1)yB+2yS≥4(smoothie 2)yO+yB+yS≥6(smoothie 3)yO,yB,yS≥0.\begin{aligned}\min\quad & 3y_O+10y_B+6y_S\\ \text{s.t.}\quad & y_O+2y_B\ge5 &&\text{(smoothie 1)}\\ & y_B+2y_S\ge4 &&\text{(smoothie 2)}\\ & y_O+y_B+y_S\ge6 &&\text{(smoothie 3)}\\ & y_O,y_B,y_S\ge0.\end{aligned}

In wordsChoose a price per fruit so that the fruit in every smoothie is worth at least what that smoothie sells for, and make the total inventory value as small as possible.

Symbol by symbol
yO,yB,ySy_O,y_B,y_Sprices of an orange, a banana, a strawberry
3yO+10yB+6yS3y_O+10y_B+6y_Svalue of the whole inventory at those prices
row "smoothie 1"1 orange + 2 bananas must be worth ≥ $5

Check y=(5,0,2)y=(5,0,2): 5+0=5≥55+0=5\ge5, 0+4=4≥40+4=4\ge4, 5+0+2=7≥65+0+2=7\ge6. Feasible, with value 15+0+12=2715+0+12=27. This matches the primal 27, so both are optimal.

Economic interpretation

Imagine a buyer offering to purchase your whole inventory at prices yy. Each dual constraint says that turning fruit into smoothie ii earns no more than selling that fruit directly. So no production plan earns more than the inventory's value b⊤yb\T y. The dual finds the lowest prices that still make this true.

At the optimum, one banana is left over and the banana price is 0. Smoothie 3's ingredients are worth 7>67>6 and it is not produced. These observations become complementary slackness.

Exercise (L10): check that (yO,yB,yS)=(3,1,2)(y_O,y_B,y_S)=(3,1,2) is dual feasible. What bound does it give? Why is a feasible certificate not necessarily the best?
Show answer
3+2=5≥53+2=5\ge5, 1+4=5≥41+4=5\ge4, 3+1+2=6≥63+1+2=6\ge6: feasible. Bound 9+10+12=319+10+12=31, so OPT≤31\opt\le31. It is valid but loose (31 > 27). The dual minimizes over all valid certificates, and (5,0,2)(5,0,2) is better. Together with x=(3,3,0)x=(3,3,0) the pair (x,y)(x,y) only proves xx is within 31−27=431-27=4 of optimal.
Unit 3.4 · LP duality

Strong duality and what can go wrong

Sources: L10 §4; Lec10_SecB pp.2,4
Weak duality: max LP ≤ min LP primal valuesdual valuesnever cross (a gap may remain) Strong duality: opt max = opt min common optimumno duality gap
Primal (max) values approach from below and dual (min) values from above. Weak duality: they never cross. Strong duality: their optima meet.
ResultStatementWhat it lets you conclude
Weak dualityc⊤x≤b⊤yc\T x\le b\T y for every feasible pair.Any dual point is an upper bound. A matching pair is optimal.
Strong dualityFinite optimum ⇒ both optima exist and are equal.An exact certificate always exists. You can always prove optimality this way.

Infeasible is not the same as unbounded

PrimalDual can be…Reason
finite optimumfinite optimum, same valuestrong duality
unbounded (above)infeasiblea feasible yy would give a finite upper bound b⊤yb\T y
infeasibleunbounded (below) or infeasibleboth are possible (see example)

Symmetrically, if the dual is unbounded below then the primal is infeasible. The possible status pairs are:

Primal \ Dualfinite optimumunboundedinfeasible
finite optimumpossible (equal values)impossibleimpossible
unboundedimpossibleimpossiblepossible
infeasibleimpossiblepossiblepossible
Unit 3.5 · LP duality

★ Exam skill: writing the dual of ANY LP

Sources: L10 §4.1 rulebook (flagged in class as an exam question)

The rulebook for a maximization primal

Primal (max) featureDual (min) featureWhy
constraint aj⊤x≤bja_j\T x\le b_jyj≥0y_j\ge0a nonnegative multiple of a ≤ stays ≤
constraint aj⊤x≥bja_j\T x\ge b_jyj≤0y_j\le0a nonpositive multiple turns ≥ into ≤
constraint aj⊤x=bja_j\T x=b_jyjy_j freean equality can be multiplied by any number
variable xi≥0x_i\ge0(A⊤y)i≥ci(A\T y)_i\ge c_icixi≤(A⊤y)ixic_ix_i\le(A\T y)_ix_i when xi≥0x_i\ge0
variable xi≤0x_i\le0(A⊤y)i≤ci(A\T y)_i\le c_ifor xi≤0x_i\le0 the inequality flips
variable xix_i free(A⊤y)i=ci(A\T y)_i=c_imust hold for both signs of xix_i, which forces equality

The dual objective is always min⁡b⊤y\min b\T y. The dual of the dual is the primal.

Mnemonic: Sensible – Odd – Bizarre

Call a feature sensible if it is the "natural" one for that kind of problem, odd if it is an equality or free variable, and bizarre if it is the unnatural direction. Then sensible ↔ sensible, odd ↔ odd, bizarre ↔ bizarre.

in a MAX problemin a MIN problem
constraint, sensible≤\le≥\ge
constraint, odd====
constraint, bizarre≥\ge≤\le
variable, sensible≥0\ge0≥0\ge0
variable, oddfreefree
variable, bizarre≤0\le0≤0\le0

Example: in a max primal, a ≥ constraint is bizarre, so its dual variable is bizarre for the min dual, i.e. yj≤0y_j\le0. A free primal variable is odd, so its dual constraint is odd: an equality. This works in both directions (min primal → max dual), so you never need a separate table for min problems.

The recipe

  1. Name a dual variable per primal constraint (y1,…,ymy_1,\dots,y_m). Write its sign using the table (or S-O-B).
  2. Dual objective: min⁡∑jbjyj\min\sum_j b_jy_j if the primal is max (max⁡∑jbjyj\max\sum_jb_jy_j if the primal is min). Coefficients are the primal right-hand sides.
  3. One dual constraint per primal variable xix_i: read down column ii of the primal: ∑jAjiyj □ ci\sum_jA_{ji}y_j\ \square\ c_i, where □\square is ≥, ≤ or = from the sign of xix_i.
  4. Sanity checks: the counts (mm dual variables, nn dual constraints), weak duality on a feasible pair if you have one, and "dual of dual = primal".

Worked example 1 (canonical): the smoothie LP

All three rows are ≤ (max), so y≥0y\ge0. All variables are ≥ 0, so every dual constraint is ≥. Columns of AA: (1,2,0)(1,2,0), (0,1,2)(0,1,2), (1,1,1)(1,1,1). The result is the dual in unit 3.3.

Worked example 2 (mixed): equality row and a free variable

max⁡ 2u+vs.t.u+v≤4  (α),u−v=1  (β),u≥0, v free.\max\ 2u+v\quad\text{s.t.}\quad u+v\le4\ \ (\alpha),\qquad u-v=1\ \ (\beta),\qquad u\ge0,\ v\ \text{free}.
  1. Row 1 is ≤ in a max problem: α≥0\alpha\ge0. Row 2 is =: β\beta free.
  2. Objective: min⁡ 4α+β\min\ 4\alpha+\beta.
  3. Column uu is (1,1)(1,1) and u≥0u\ge0: α+β≥2\alpha+\beta\ge2. Column vv is (1,−1)(1,-1) and vv is free: α−β=1\alpha-\beta=1.
min⁡ 4α+βs.t.α+β≥2,α−β=1,α≥0, β free.\min\ 4\alpha+\beta \quad\text{s.t.}\quad \alpha+\beta\ge2,\quad \alpha-\beta=1,\quad \alpha\ge0,\ \beta\ \text{free}.

Check with a matching pair: primal u+v=4, u−v=1u+v=4,\ u-v=1 gives u=2.5, v=1.5u=2.5,\ v=1.5, value 6.5. Dual α−β=1, α+β=2\alpha-\beta=1,\ \alpha+\beta=2 gives α=1.5, β=0.5\alpha=1.5,\ \beta=0.5, value 6+0.5=6.56+0.5=6.5. Both feasible with equal values, so both are optimal.

Worked example 3 (min primal)

min⁡ 3x1+2x2s.t.x1+x2≥4 (y1),x1−x2≤2 (y2),x1≥0, x2 free.\min\ 3x_1+2x_2\quad\text{s.t.}\quad x_1+x_2\ge4\ (y_1),\qquad x_1-x_2\le2\ (y_2),\qquad x_1\ge0,\ x_2\ \text{free}.
  1. Min primal, so the dual is max 4y1+2y24y_1+2y_2.
  2. Row 1 is ≥ in a min problem (sensible): y1≥0y_1\ge0. Row 2 is ≤ in a min problem (bizarre): y2≤0y_2\le0.
  3. Column x1=(1,1)x_1=(1,1) with x1≥0x_1\ge0 (sensible). In a max dual the sensible constraint is ≤: y1+y2≤3y_1+y_2\le3. Column x2=(1,−1)x_2=(1,-1), free: y1−y2=2y_1-y_2=2.
max⁡ 4y1+2y2s.t.y1+y2≤3,y1−y2=2,y1≥0, y2≤0.\max\ 4y_1+2y_2\quad\text{s.t.}\quad y_1+y_2\le3,\quad y_1-y_2=2,\quad y_1\ge0,\ y_2\le0.

Solve both to check. Primal: x2≥max⁡(4−x1, x1−2)x_2\ge\max(4-x_1,\ x_1-2) and x2x_2 has positive cost, so take it as small as possible. For x1≤3x_1\le3 the objective is 3x1+2(4−x1)=x1+83x_1+2(4-x_1)=x_1+8, minimized at x1=0, x2=4x_1=0,\ x_2=4: value 8. Dual: y1=2+y2y_1=2+y_2, so the objective is 8+6y28+6y_2 with y2≤0y_2\le0, maximized at y2=0, y1=2y_2=0,\ y_1=2. Check y1+y2=2≤3y_1+y_2=2\le3. Value 8. They match.

Worked example 4 (everything at once)

max⁡ x1−2x2+3x3  s.t.  {x1+x2+x3≤10(y1)2x1−x3≥2(y2)x2+x3=4(y3)x1≥0, x2≤0, x3 free.\max\ x_1-2x_2+3x_3\ \ \text{s.t.}\ \ \begin{cases}x_1+x_2+x_3\le10 & (y_1)\\ 2x_1-x_3\ge2 & (y_2)\\ x_2+x_3=4 & (y_3)\end{cases}\quad x_1\ge0,\ x_2\le0,\ x_3\ \text{free}.

Signs: y1≥0y_1\ge0 (≤, sensible), y2≤0y_2\le0 (≥, bizarre), y3y_3 free (=). Columns: x1→(1,2,0)x_1\to(1,2,0), x2→(1,0,1)x_2\to(1,0,1), x3→(1,−1,1)x_3\to(1,-1,1).

min⁡ 10y1+2y2+4y3  s.t.  {y1+2y2≥1(x1≥0: sensible)y1+y3≤−2(x2≤0: bizarre)y1−y2+y3=3(x3 free: odd)y1≥0, y2≤0, y3 free.\min\ 10y_1+2y_2+4y_3\ \ \text{s.t.}\ \ \begin{cases}y_1+2y_2\ge1 & (x_1\ge0:\ \text{sensible})\\ y_1+y_3\le-2 & (x_2\le0:\ \text{bizarre})\\ y_1-y_2+y_3=3 & (x_3\ \text{free: odd})\end{cases}\quad y_1\ge0,\ y_2\le0,\ y_3\ \text{free}.

Worked example 5: dual of the dual is the primal

Write (D)(D) as a max problem: max⁡(−b)⊤y\max(-b)\T y s.t. (−A⊤)y≤−c, y≥0(-A\T)y\le-c,\ y\ge0. This is canonical, with data (−A⊤,−c,−b)(-A\T,-c,-b). Its dual is min⁡(−c)⊤x\min(-c)\T x s.t. (−A⊤)⊤x≥−b, x≥0(-A\T)\T x\ge-b,\ x\ge0, i.e. min⁡−c⊤x\min -c\T x s.t. −Ax≥−b-Ax\ge-b. That is max⁡c⊤x\max c\T x s.t. Ax≤b, x≥0Ax\le b,\ x\ge0: the primal again.

Unit 3.6 · LP duality

Complementary slackness: where the duality gap lives

Sources: L10 §3 (economic interpretation); L11 §4.2

For a feasible pair, the duality gap b⊤y−c⊤xb\T y-c\T x is a sum of nonnegative "waste" terms. Zero gap means zero waste everywhere, and that gives easy equations to check or find optimal solutions.

Primal and dual slacks
s  =  b−Ax  ≥0,r  =  A⊤y−c  ≥0.s \;=\; b-Ax\;\ge0,\qquad r\;=\;A\T y-c\;\ge0.
Symbol by symbol
sjs_junused amount of resource jj (primal slack of row jj)
rir_ihow much the priced cost of product ii exceeds its revenue (dual slack of column ii): the "loss per unit" of making product ii
The gap identity
b⊤y−c⊤x  =  y⊤(b−Ax)  +  x⊤(A⊤y−c)  =  ∑jyjsj  +  ∑ixiri.b\T y-c\T x \;=\; y\T(b-Ax)\;+\;x\T(A\T y-c) \;=\; \sum_{j} y_j s_j \;+\; \sum_{i} x_i r_i.

In wordsEvery dollar of gap is either (a) unused inventory that has a positive price, or (b) production of something whose ingredients are worth more than it sells for.

Why it is trueExpand the right side: y⊤b−y⊤Ax+x⊤A⊤y−x⊤cy\T b-y\T Ax+x\T A\T y-x\T c. The middle two terms cancel because x⊤A⊤y=y⊤Axx\T A\T y=y\T Ax. What remains is b⊤y−c⊤xb\T y-c\T x.

When you use itEach term is a product of two nonnegative numbers, so each is ≥ 0. The sum is zero exactly when every term is zero.

(⇐) The conditions make the gap zero, so weak duality gives optimality. (⇒) By strong duality optimal values are equal, so the gap is zero, so every term is zero.

If …then …meaning
yj>0y_j>0primal row jj is tighta resource with positive price is fully used
primal row jj is slackyj=0y_j=0leftover resources are worth nothing at the margin
xi>0x_i>0dual row ii is tightanything produced has priced cost exactly equal to revenue
dual row ii is slackxi=0x_i=0a product whose ingredients are worth more than it sells for is not made

Using slackness to find a solution

From xx to yy. Suppose x=(3,3,0)x=(3,3,0) is optimal. Bananas are slack, so yB=0y_B=0. Since x1,x2>0x_1,x_2>0, dual rows 1 and 2 are tight: yO+2yB=5y_O+2y_B=5 and yB+2yS=4y_B+2y_S=4. Hence y=(5,0,2)y=(5,0,2). Check the remaining dual row: 5+0+2=7≥65+0+2=7\ge6. ✓

From yy to xx. Start from y=(5,0,2)y=(5,0,2). Dual row 3 is slack (7>67>6), so x3=0x_3=0. yO,yS>0y_O,y_S>0 force the orange and strawberry rows to be tight: x1+x3=3x_1+x_3=3, 2x2+x3=62x_2+x_3=6. Hence x=(3,3,0)x=(3,3,0). Check bananas separately: 9≤109\le10. ✓

Resourceslack sjs_jprice yjy_jyjsjy_js_jSmoothierir_ixix_ixirix_ir_i
Oranges05015−5=030
Bananas10024−4=030
Strawberries02037−6=100

Tight does not mean positive: an example (L11 exercise)

max⁡x1\max x_1 s.t. x1≤1, x2≤0, x≥0x_1\le1,\ x_2\le0,\ x\ge0. The unique optimum is (1,0)(1,0), where the second row x2≤0x_2\le0 is tight. The dual is min⁡y1+0⋅y2\min y_1+0\cdot y_2 s.t. y1≥1, y2≥0y_1\ge1,\ y_2\ge0. The optimum y=(1,0)y=(1,0) puts multiplier 0 on that tight row. This does not contradict complementary slackness: y2⋅slack2=0⋅0=0y_2\cdot\text{slack}_2=0\cdot0=0.

Unit 3.7 · LP duality

Approximate certificates: a small gap bounds your error

Sources: L11 §5.2 exercise
Gap bounds the error
0  ≤  OPTP−c⊤x  ≤  b⊤y−c⊤x  =:  δ0\;\le\;\opt_P-c\T x\;\le\;b\T y-c\T x \;=:\;\delta

In wordsEven without knowing OPT\opt, a feasible yy tells you how far a feasible xx can be from optimal: at most the gap.

Symbol by symbol
δ\deltathe duality gap of the pair (x,y)(x,y), always ≥ 0 for a feasible pair

Why it is trueLeft: xx is feasible, so c⊤x≤OPTPc\T x\le\opt_P. Right: weak duality gives OPTP≤b⊤y\opt_P\le b\T y. Subtract c⊤xc\T x everywhere.

When you use itL11 exercise: "Using only weak duality, show that a feasible pair with b⊤y−c⊤x≤εb\T y-c\T x\le\eps certifies OPT−c⊤x≤ε\opt-c\T x\le\eps." This is exactly the chain above. Note it is an additive guarantee, not a ratio.

Unit 3.8 · LP duality

Application: zero-sum games and the minimax theorem

Sources: Standard application of LP duality

LP duality also explains two-player games. This unit gives the definitions and the tools. The proof that max-min equals min-max is a direct application of strong duality.

Expected payoff
p⊤Aq=∑i=1m∑j=1npi Aij qjp\T Aq=\sum_{i=1}^m\sum_{j=1}^n p_i\,A_{ij}\,q_j

In wordsAverage Alice's payoff over the random row (probabilities pp) and the independent random column (probabilities qq).

Symbol by symbol
pip_iprobability Alice plays row ii
qjq_jprobability Bob plays column jj
(p⊤A)j=∑ipiAij(p\T A)_j=\sum_ip_iA_{ij}Alice's expected payoff if Bob plays the pure column jj
(Aq)i(Aq)_iAlice's expected payoff from pure row ii against Bob's mix qq
Guaranteed values
max⁡p∈Δm min⁡q∈Δn p⊤Aq⏟Alice commits firstandmin⁡q∈Δn max⁡p∈Δm p⊤Aq⏟Bob commits first\underbrace{\max_{p\in\Delta_m}\ \min_{q\in\Delta_n}\ p\T Aq}_{\text{Alice commits first}}\qquad\text{and}\qquad\underbrace{\min_{q\in\Delta_n}\ \max_{p\in\Delta_m}\ p\T Aq}_{\text{Bob commits first}}

In wordsThe first is the most Alice can guarantee even if Bob sees her probabilities. The second is the least Bob can hold Alice to even if Alice sees his. The minimax theorem says they are equal; the common value is the value of the game.

Tool 1: a linear function over the simplex is optimized at a corner

min⁡q∈Δn c⊤q  =  min⁡1≤j≤n cj,max⁡p∈Δm d⊤p=max⁡1≤i≤mdi.\min_{q\in\Delta_n}\ c\T q\;=\;\min_{1\le j\le n}\ c_j,\qquad\max_{p\in\Delta_m}\ d\T p=\max_{1\le i\le m}d_i.

In wordsAgainst a fixed opponent mix, some pure strategy is a best response: put all probability on the best coordinate.

Why it is truec⊤q=∑jcjqjc\T q=\sum_jc_jq_j is a weighted average of the cjc_j with weights qj≥0q_j\ge0 summing to 1, and an average is never below its smallest entry. Putting q=ejq=e_j on the smallest cjc_j attains it. (Geometrically: the vertices of Δn\Delta_n are the unit vectors eje_j, and a linear objective is optimized at a vertex, unit 2.5.)

Tool 2: the easy inequality (weak duality for games)

max⁡pmin⁡q p⊤Aq  ≤  min⁡qmax⁡p p⊤Aq.\max_{p}\min_{q}\ p\T Aq\;\le\;\min_{q}\max_{p}\ p\T Aq.

Why it is trueFor any p′p' and q′q': min⁡qp′⊤Aq≤p′⊤Aq′≤max⁡pp⊤Aq′\min_qp'^{\top}Aq\le p'^{\top}Aq'\le\max_pp\T Aq'. The left side does not depend on q′q' and the right side does not depend on p′p', so maximize the left over p′p' and minimize the right over q′q'.

When you use itExactly like weak LP duality: any guarantee for Alice is at most any guarantee for Bob. The minimax theorem is the "strong duality" statement that they meet.

Tool 3: how the LP enters

By Tool 1, Alice's guarantee for a fixed pp is min⁡j(p⊤A)j\min_j(p\T A)_j, a minimum of linear functions of pp. Maximizing a minimum is an LP via the "maximize a minimum" trick of unit 1.6 (a free variable vv below every column payoff, plus the simplex constraints on pp). Bob's problem is the same with max and min swapped. Writing the dual of Alice's LP with the rulebook of unit 3.5 (the equality ∑ipi=1\sum_ip_i=1 gives a free dual variable; the free vv gives an equality dual constraint) and applying strong duality is how the minimax theorem is proved.

Unit 4.1 · Max-flow = min-cut via duality

The path-flow LP

Sources: L10 §5.1; Lec10_SecB p.5

L8 proved max-flow = min-cut using residual graphs. L10 reaches the same theorem through LP duality. That route also introduces rounding, the main idea of approximation algorithms.

(P_flow): one variable per s–t path
max⁡ ∑p∈Pxps.t.∑p ∋ exp≤ce  (∀e∈E),xp≥0  (∀p∈P).\max\ \sum_{p\in\mathcal P}x_p \qquad\text{s.t.}\qquad \sum_{p\,\ni\, e}x_p\le c_e\ \ (\forall e\in E),\qquad x_p\ge0\ \ (\forall p\in\mathcal P).

In wordsSend xpx_p units along each ss–tt path pp. The total flow is the sum. On every edge, the total of all paths using that edge must fit within its capacity.

Symbol by symbol
P\mathcal Pthe finite set of all simple directed ss–tt paths (can be exponentially many)
xpx_phow much flow is sent along path pp
p∋ep\ni e"paths pp that contain edge ee"
∑p∋exp\sum_{p\ni e}x_ptotal flow on edge ee contributed by all paths through it
cec_ecapacity of edge ee

Why it is trueIts optimum equals the edge-LP optimum (below). There is one constraint per edge and one variable per path.

When you use itIts dual has a clean meaning (edge lengths), which is the point of this formulation.

s a b t cap 3cap 2 cap 2cap 3 x(s-a-t) = 2x(s-b-t) = 2
Two paths with 2 units each give total flow 4. Edge s→as\to a only carries the blue path, so its row reads xsat≤3x_{sat}\le3.

Why path LP and edge LP have the same optimum

Path → edge. Set fe=∑p∋expf_e=\sum_{p\ni e}x_p. Each path conserves flow at every interior vertex (one unit in, one unit out), so the sum does too. The capacity rows give fe≤cef_e\le c_e. The value is ∑pxp\sum_p x_p.

Edge → path (flow decomposition). Any feasible flow of nonnegative value splits into ss–tt path flows plus cycle flows. Cycles add no value and can be discarded. One way to see it: add an edge t→st\to s carrying the flow value, which makes every vertex conserve flow (a circulation). Then repeatedly follow positive edges until a cycle closes and subtract its smallest flow. Each round zeroes at least one edge. Cycles through t→st\to s are ss–tt paths.

Unit 4.2 · Max-flow = min-cut via duality

The dual: edge lengths, and every cut is a dual solution

Sources: L10 §5.2; Lec10_SecB p.5

Give the capacity row of edge ee the multiplier ye≥0y_e\ge0 (≤ rows in a max problem). Column xpx_p has a 1 in row ee exactly when e∈pe\in p, and objective coefficient 1. Applying the recipe:

(D_length)
min⁡ ∑e∈Ece yes.t.∑e∈pye≥1  (∀p∈P),ye≥0  (∀e∈E).\min\ \sum_{e\in E}c_e\,y_e\qquad\text{s.t.}\qquad \sum_{e\in p}y_e\ge1\ \ (\forall p\in\mathcal P),\qquad y_e\ge0\ \ (\forall e\in E).

In wordsAssign each edge a nonnegative length yey_e so that every ss–tt path has total length at least 1. Minimize the capacity-weighted total length.

Symbol by symbol
yey_elength of edge ee (dual variable of its capacity row)
∑e∈pye≥1\sum_{e\in p}y_e\ge1dual constraint for variable xpx_p: path pp is at least 1 long
∑eceye\sum_ec_ey_e"cost" of the length assignment, not the length of any single path

Why it is trueRecipe: dual constraint for xpx_p = column of xpx_p (1's on edges of pp) ⋅ y ≥\cdot\,y\ \ge objective coefficient 1. Dual objective = capacities · yy.

When you use itThink of yey_e as how much of edge ee you cut: every ss–tt path must be cut by a total of at least 1. The dual is a fractional cut: a barrier spread over edges that every path must pay to cross.

s a b t cap 3, length 0cap 2, length 1 cap 2, length 1cap 3, length 0 material = 2·1 + 2·1 = 4 = max flow
Pipe thickness = capacity. Every route from ss to tt passes through exactly one pink pipe, so giving the pink pipes length 1 puts tt at distance 1. That costs 4 units of material, the same as the maximum flow.

Every s–t cut is a feasible 0/1 dual solution

Cut → lengths
δ+(S)={(u,v)∈E: u∈S, v∉S},ye={1e∈δ+(S)0otherwise⇒∑eceye=c(δ+(S)).\delta^+(S)=\{(u,v)\in E:\ u\in S,\ v\notin S\},\qquad y_e=\begin{cases}1 & e\in\delta^+(S)\\0&\text{otherwise}\end{cases}\quad\Rightarrow\quad\sum_e c_ey_e=c(\delta^+(S)).

In wordsPut length 1 on edges leaving SS and 0 elsewhere. The dual cost is exactly the cut capacity.

Symbol by symbol
SSa vertex set with s∈Ss\in S, t∉St\notin S (an ss–tt cut)
δ+(S)\delta^+(S)directed edges leaving SS; edges entering SS do not count
c(δ+(S))c(\delta^+(S))capacity of the cut

Why it is trueAny ss–tt path starts inside SS and ends outside, so it must use at least one edge of δ+(S)\delta^+(S). Its length is ≥ 1, so the solution is feasible.

Example: S={s,a,b}S=\{s,a,b\} gives the edges a→ta\to t (cap 2) and b→tb\to t (cap 3), so dual value 5.

So far: max flow=OPT(Dlength)≤min cut\text{max flow} = \opt(D_\text{length}) \le \text{min cut}. The first equality is strong duality, the inequality holds because cuts are special dual solutions.

Unit 4.3 · Max-flow = min-cut via duality

Threshold rounding: from lengths to a cut

Sources: L10 §6–6.1; Lec10_SecB p.6

Treat the lengths as distances from ss, and cut the graph at a "radius" rr.

Clipped distances and threshold sets
ℓ(v)=min⁡{d(v),1},Sr={v: ℓ(v)≤r}(0<r<1),ℓ(s)=0,  ℓ(t)=1.\ell(v)=\min\{d(v),1\},\qquad S_r=\{v:\ \ell(v)\le r\}\quad(0<r<1),\qquad \ell(s)=0,\ \ \ell(t)=1.

In wordsCompute shortest-path distances d(v)d(v) from ss using lengths yy. Cap them at 1. For a threshold rr, SrS_r is the "ball" of all vertices within distance rr of ss.

Symbol by symbol
d(v)d(v)shortest-path distance from ss to vv with edge lengths yey_e (+∞+\infty if unreachable)
ℓ(v)\ell(v)clipped distance, always in [0,1][0,1]
SrS_ralso written Br={v:d(s,v)≤r}B_r=\{v: d(s,v)\le r\}, a ball around ss (same set for r<1r<1)
ℓ(t)=1\ell(t)=1feasibility says every path has length ≥1\ge1, so d(t)≥1d(t)\ge1 (Observation 1)

Why it is trues∈Srs\in S_r since ℓ(s)=0≤r\ell(s)=0\le r. t∉Srt\notin S_r since ℓ(t)=1>r\ell(t)=1>r. So every SrS_r is an ss–tt cut.

s a b t ℓ = 0.4ℓ = 0.7ℓ = 1 ripple at r = 0.55 cut: s→b and a→t, capacity 2 + 2 = 4
The running example. Dashed rings are the clipped distances ℓ(a)=0.4\ell(a)=0.4, ℓ(b)=0.7\ell(b)=0.7, ℓ(t)=1\ell(t)=1. Any ripple radius strictly between 0 and 1 gives a cut, and the radius decides which one.
Key lemma: an edge is cut for at most y_e of the thresholds
e=(u,v)∈δ+(Sr)  ⟺  ℓ(u)≤r<ℓ(v),an interval of length max⁡{0,ℓ(v)−ℓ(u)}≤yuv.e=(u,v)\in\delta^+(S_r)\iff \ell(u)\le r<\ell(v),\qquad\text{an interval of length}\ \max\{0,\ell(v)-\ell(u)\}\le y_{uv}.

In wordsAs rr sweeps from 0 to 1, edge u→vu\to v leaves the cut set only while the "gate" rr is past uu but not yet past vv. That window is at most as long as the edge itself.

Symbol by symbol
ℓ(u)≤r\ell(u)\le rtail uu is inside the ball
r<ℓ(v)r<\ell(v)head vv is outside
max⁡{0,⋅}\max\{0,\cdot\}if ℓ(v)≤ℓ(u)\ell(v)\le\ell(u) the edge never crosses outward

Why it is trueIf d(u)<1d(u)<1: shortest paths satisfy the triangle inequality d(v)≤d(u)+yuvd(v)\le d(u)+y_{uv}, and clipping at 1 can only shrink a positive difference. If d(u)≥1d(u)\ge1 or uu is unreachable, ℓ(u)=1≥ℓ(v)\ell(u)=1\ge\ell(v) and the window is empty.

When you use itObservation 2: edge e=(u,v)e=(u,v) is cut with probability ≤ye\le y_e. If rr is drawn uniformly from (0,1)(0,1), the probability that ee is cut is the window length, at most yey_e.

01 ℓ(u)ℓ(v) edge u→v is in the cut for these rr
Unit 4.4 · Max-flow = min-cut via duality

Averaging: some threshold cut is cheap

Sources: L10 §6.2
Average cut capacity over thresholds
∫01c(δ+(Sr)) dr  =  ∑(u,v)∈Ecuvmax⁡{0,ℓ(v)−ℓ(u)}  ≤  ∑e∈Eceye.\int_0^1 c\big(\delta^+(S_r)\big)\,dr \;=\;\sum_{(u,v)\in E}c_{uv}\max\{0,\ell(v)-\ell(u)\}\;\le\;\sum_{e\in E}c_ey_e.

In wordsAverage the cut capacity over all thresholds. Each edge contributes its capacity times the fraction of thresholds that cut it, which is at most its length.

Symbol by symbol
∫01⋯dr\int_0^1\cdots draverage over r∈(0,1)r\in(0,1) (area under a step function; no calculus is really needed)
equalityswap "sum over edges" and "average over rr": an edge contributes cuvc_{uv} for a window of length max⁡{0,ℓ(v)−ℓ(u)}\max\{0,\ell(v)-\ell(u)\}
≤\lethe key lemma, edge by edge

Why it is trueThe cut only changes when rr passes one of the finitely many distances ℓ(v)\ell(v). So the integral is a weighted average of finitely many cut values, weighted by the lengths of the threshold intervals.

Conclusion
some Sr satisfiesc(δ+(Sr))  ≤  ∑eceye.\text{some } S_r \text{ satisfies}\quad c\big(\delta^+(S_r)\big)\;\le\;\sum_ec_ey_e.

In wordsSomething is always at most its average: at least one threshold gives a cut no more expensive than the fractional solution.

Why it is trueIf every cut were more expensive than the average, the average would be larger than itself. This "something is at most the average" step is the averaging principle that drives most of the approximation proofs in Chapter 9.

When you use itDeterministic algorithm: compute distances (Dijkstra), sort the distinct clipped values, test one threshold in each interval (at most ∣V∣−1|V|-1 cuts), and keep the cheapest.

The example, computed by hand

Capacities csa=3, cat=2, csb=2, cbt=3c_{sa}=3,\ c_{at}=2,\ c_{sb}=2,\ c_{bt}=3. Lengths ysa=.4, yat=.6, ysb=.7, ybt=.3y_{sa}=.4,\ y_{at}=.6,\ y_{sb}=.7,\ y_{bt}=.3. Both paths have length exactly 1, so the solution is feasible. Distances: ℓ(s)=0, ℓ(a)=.4, ℓ(b)=.7, ℓ(t)=1\ell(s)=0,\ \ell(a)=.4,\ \ell(b)=.7,\ \ell(t)=1.

threshold rangeSrS_redges leavingcapacityinterval length
0<r<.40<r<.4{s}\{s\}s→a, s→bs\to a,\ s\to b3+2 = 5.4
.4≤r<.7.4\le r<.7{s,a}\{s,a\}s→b, a→ts\to b,\ a\to t2+2 = 4.3
.7≤r<1.7\le r<1{s,a,b}\{s,a,b\}a→t, b→ta\to t,\ b\to t2+3 = 5.3
average=.4⋅5+.3⋅4+.3⋅5=4.7,∑eceye=3(.4)+2(.6)+2(.7)+3(.3)=4.7.\text{average}=.4\cdot5+.3\cdot4+.3\cdot5=4.7,\qquad \sum_ec_ey_e=3(.4)+2(.6)+2(.7)+3(.3)=4.7.

The cut {s,a}\{s,a\} costs 4≤4.74\le4.7. Since a cut of cost 4 exists, these lengths are feasible but not dual-optimal. The optimal dual is the 0/1 cut solution of value 4, matching the flow of value 4.

Unit 4.5 · Max-flow = min-cut via duality

Completing max-flow = min-cut, and checking the dual fast

Sources: L10 §6.3 + exercise
The chain
max flow  ≤(1)  min cut  ≤(2)  OPT(Dlength)  =(3)  max flow.\text{max flow}\;\overset{(1)}{\le}\;\text{min cut}\;\overset{(2)}{\le}\;\opt(D_\text{length})\;\overset{(3)}{=}\;\text{max flow}.

In wordsSqueeze: a quantity that is ≤ something that is ≤ itself must equal it. All three numbers are equal.

Symbol by symbol
(1)the L8 cut bound: net flow across any cut cannot exceed the capacity of its outward edges
(2)threshold rounding applied to an optimal length solution gives a cut of no larger cost
(3)strong LP duality for (P_flow)/(D_length)

For the example: the flow of value 4 and the cut {s,a}\{s,a\} of capacity 4 certify each other, so max flow = min cut = 4.

Exercise (L10): checking exponentially many path constraints with one Dijkstra run

Given nonnegative lengths yey_e, how does one Dijkstra run verify every constraint of DlengthD_\text{length} or exhibit a violated one? Why don't we need to list all paths? What if tt is unreachable?
Show answer
Run Dijkstra from ss with lengths yey_e (valid because y≥0y\ge0). The shortest ss–tt distance d(t)d(t) is the minimum length over all paths. If d(t)≥1d(t)\ge1 then every path has length ≥ 1, so all (exponentially many) constraints hold at once. If d(t)<1d(t)<1, the shortest path found is an explicit violated constraint. We only ever need the minimum path length, not the list. If tt is unreachable, d(t)=∞≥1d(t)=\infty\ge1: there are no ss–tt paths, so there are no constraints to violate. This "find a violated constraint quickly" idea is called a separation oracle, and it is why exponentially large LPs can still be solvable (via the ellipsoid method).
Unit 5.1 · Why strong duality holds

The proof plan: tight normals block every improving direction

Sources: L11 §1; Lec11_SecB p.1

Weak duality is one line of algebra. Strong duality says an exact certificate always exists, and that needs real geometry. The whole proof rests on one picture.

a₁ (normal of right wall)a₂ (top wall) c = λ₁a₁ + λ₂a₂x* feasible regionshaded wedge = cone of tight normals c inside the wedge ⇒ x* optimal
At an optimum x∗x^*, the objective direction cc is a nonnegative combination of the outward normals of the constraints that are tight at x∗x^*.

Write all primal constraints in one list, including the sign constraints:

All constraints as one list
ar⊤x≤dr(r=1,…,m+n),where the last n rows are −xi≤0.a_r\T x\le d_r\qquad(r=1,\dots,m+n),\qquad\text{where the last } n \text{ rows are } -x_i\le0.
Symbol by symbol
r≤mr\le moriginal rows: ara_r = row rr of AA, dr=brd_r=b_r
r>mr>msign rows: ar=−eia_r=-e_i (minus the ii-th unit vector), dr=0d_r=0
SSthe set of rows that are tight at x∗x^*: ar⊤x∗=dra_r\T x^*=d_r
The claim to prove
c  =  ∑r∈Sλr arfor some λr≥0.c\;=\;\sum_{r\in S}\lambda_r\,a_r\qquad\text{for some }\lambda_r\ge0.

In wordsThe objective direction lies in the cone generated by the tight outward normals.

Symbol by symbol
λr\lambda_rnonnegative weights; these will become the dual solution
SSonly tight constraints are used
wind c = λ₁a₁ + λ₂a₂ λ₁a₁ λ₂a₂ ← −λ₁a₁: the right wall pushes left ↓ −λ₂a₂: the top wall pushes down feasible region slack wall (not touched): no push, λ = 0
At the optimum (red ball) the objective direction cc splits into nonnegative amounts of the touching walls' outward normals. Those amounts are the dual solution.

The three steps

  1. Farkas' lemma: either cc is in the cone of tight normals, or there is a direction vv that moves "into" every tight wall's allowed side while improving the objective.
  2. Contradiction: a tiny step along such a vv is feasible and strictly better, which is impossible at an optimum. So cc is in the cone.
  3. Read off the dual: the weights λr\lambda_r on original rows form a dual-feasible yy with b⊤y=c⊤x∗b\T y=c\T x^*. Weak duality finishes the proof.
Unit 5.2 · Why strong duality holds

Cones and Farkas' lemma: certificates of infeasibility

Sources: L11 §2; Lec11_SecB p.2
Cone generated by vectors
C={∑j=1kλjaj: λj≥0}={Mλ: λ≥0},M=[ a1 ⋯ ak ].C=\Big\{\sum_{j=1}^{k}\lambda_j a_j:\ \lambda_j\ge0\Big\}=\{M\lambda:\ \lambda\ge0\},\qquad M=[\,a_1\ \cdots\ a_k\,].

In wordsEverything you can build by adding nonnegative amounts of the generators a1,…,aka_1,\dots,a_k. In 2-D it is a wedge from the origin.

Symbol by symbol
aj∈Rda_j\in\R^dgenerator vectors, the columns of MM
λj≥0\lambda_j\ge0amounts; negative amounts are not allowed (otherwise you would get a whole subspace)
MλM\lambdathe column view: Mλ=∑jλjajM\lambda=\sum_j\lambda_ja_j

When you use it"Is pp in the cone?" is the feasibility question "Mλ=p, λ≥0M\lambda=p,\ \lambda\ge0".

Reading system (II)
M⊤w≥0  ⟺  aj⊤w≥0  ∀j,p⊤w<0.M\T w\ge0 \iff a_j\T w\ge0\ \ \forall j,\qquad p\T w<0.

In wordsFind a test direction ww such that every generator has a nonnegative dot product with ww (all lie on one side of the line w⊤z=0w\T z=0) while pp has a negative one (pp is strictly on the other side).

Why it is trueEvery point of the cone, ∑λjaj\sum\lambda_ja_j, then also has w⊤(⋅)=∑λj aj⊤w≥0w\T(\cdot)=\sum\lambda_j\,a_j\T w\ge0. So pp cannot be in the cone. ww is a short, checkable proof that (I) is infeasible.

Why both cannot hold (the easy half)

p⊤w=(Mλ)⊤w=λ⊤(M⊤w) ≥ 0p\T w=(M\lambda)\T w=\lambda\T(M\T w)\ \ge\ 0

In wordsIf pp were built from the generators, its test value would be a nonnegative mixture of nonnegative numbers, so not negative.

Why it is trueλ≥0\lambda\ge0 and M⊤w≥0M\T w\ge0, so their dot product is ≥ 0. That contradicts p⊤w<0p\T w<0.

The substantive half is that when p∉Cp\notin C, a witness ww always exists. That needs separation (next unit).

Unit 5.3 · Why strong duality holds

The separation theorem: the nearest point gives the wall

Sources: L11 §3; Lec11_SecB p.2
The construction
q∈arg⁡min⁡z∈C∥p−z∥,v=p−q.q\in\arg\min_{z\in C}\norm{p-z},\qquad v=p-q.

In wordsLet qq be the point of CC closest to pp. The arrow vv from qq to pp is the normal of a wall through qq that keeps all of CC on one side and pp on the other.

Symbol by symbol
qqnearest point of CC to pp; it exists because CC is closed and nonempty (restrict to a closed ball around pp, which is compact)
v=p−qv=p-qpoints from the set toward the outside point
v⊤z≤v⊤qv\T z\le v\T qevery point of CC lies on or behind the wall {z:v⊤z=v⊤q}\{z: v\T z=v\T q\}

Proof: why the nearest point works

Take any z∈Cz\in C. By convexity the whole segment q+θ(z−q)=θz+(1−θ)qq+\theta(z-q)=\theta z+(1-\theta)q, 0≤θ≤10\le\theta\le1, lies in CC. Measure its squared distance to pp:

Expanding the squared distance
∥p−(q+θ(z−q))∥2  =  ∥p−q∥2  −  2θ v⊤(z−q)  +  θ2∥z−q∥2.\norm{p-(q+\theta(z-q))}^2 \;=\; \norm{p-q}^2\;-\;2\theta\,v\T(z-q)\;+\;\theta^2\norm{z-q}^2.

In wordsThe distance from pp to a point that has moved a fraction θ\theta toward zz is the old distance, minus a term that is linear in θ\theta, plus a term that is quadratic in θ\theta.

Symbol by symbol
a=p−q=va=p-q=v, b=θ(z−q)b=\theta(z-q)then p−(q+θ(z−q))=a−bp-(q+\theta(z-q))=a-b; apply ∥a−b∥2=∥a∥2−2a⊤b+∥b∥2\norm{a-b}^2=\norm a^2-2a\T b+\norm b^2
−2θv⊤(z−q)-2\theta v\T(z-q)the linear term; it dominates for small θ\theta
θ2∥z−q∥2\theta^2\norm{z-q}^2the quadratic term; negligible for small θ\theta

Why it is trueIf v⊤(z−q)>0v\T(z-q)>0, then for small enough θ>0\theta>0 the negative linear term beats the positive quadratic term (θ2\theta^2 is much smaller than θ\theta). The point q+θ(z−q)∈Cq+\theta(z-q)\in C would then be closer to pp than qq, contradicting the choice of qq.

When you use itConclusion: v⊤(z−q)≤0v\T(z-q)\le0, i.e. v⊤z≤v⊤qv\T z\le v\T q for all z∈Cz\in C. Finally v⊤p−v⊤q=v⊤v=∥p−q∥2>0v\T p-v\T q=v\T v=\norm{p-q}^2>0 because p≠qp\ne q.

Unit 5.4 · Why strong duality holds

From separation to Farkas: the cone case, step by step

Sources: L11 §3.1; Lec11_SecB p.2

Step 0: why a cone is convex (and closed)

Take two cone points MλM\lambda and MμM\mu with λ,μ≥0\lambda,\mu\ge0. For θ∈[0,1]\theta\in[0,1]: θMλ+(1−θ)Mμ=M(θλ+(1−θ)μ)\theta M\lambda+(1-\theta)M\mu=M(\theta\lambda+(1-\theta)\mu), and θλ+(1−θ)μ≥0\theta\lambda+(1-\theta)\mu\ge0. So the blend is again in the cone. Closed: a cone generated by finitely many vectors is closed. This is a standard fact used without proof in the course.

Step 1: apply separation

p∉Cp\notin C, so there are v,qv,q with v⊤p>v⊤q≥v⊤zv\T p>v\T q\ge v\T z for all z∈Cz\in C.

Step 2: the upper bound v⊤qv\T q is at least 0

0∈C0\in C (take all λj=0\lambda_j=0), so v⊤q≥v⊤0=0v\T q\ge v\T0=0.

Step 3: every generator has v⊤aj≤0v\T a_j\le0

The scaling argument
t aj∈C  ∀t≥0⟹t (v⊤aj)  ≤  v⊤q  ∀t≥0⟹v⊤aj≤0.t\,a_j\in C\ \ \forall t\ge0\quad\Longrightarrow\quad t\,(v\T a_j)\;\le\;v\T q\ \ \forall t\ge0\quad\Longrightarrow\quad v\T a_j\le0.

In wordsA cone contains every stretched copy of each generator. If some generator had a positive dot product with vv, stretching it would push v⊤(taj)v\T(ta_j) to infinity, past the fixed number v⊤qv\T q. So no generator can have a positive dot product.

Why it is trueIf v⊤aj>0v\T a_j>0, choose t>v⊤q/(v⊤aj)t>v\T q/(v\T a_j). Then t v⊤aj>v⊤qt\,v\T a_j>v\T q, which contradicts separation.

Step 4: pp is strictly on the positive side

By Step 3 every cone point z=∑λjajz=\sum\lambda_ja_j has v⊤z=∑λjv⊤aj≤0v\T z=\sum\lambda_j v\T a_j\le0. In particular v⊤q≤0v\T q\le0, and with Step 2, v⊤q=0v\T q=0. Separation then gives v⊤p>v⊤q=0v\T p>v\T q=0.

Step 5: flip the sign to get the Farkas witness

Orientation
w=−v⟹M⊤w=(−v⊤aj)j≥0,p⊤w=−v⊤p<0.w=-v\quad\Longrightarrow\quad M\T w=(-v\T a_j)_j\ge0,\qquad p\T w=-v\T p<0.

In wordsSeparation's normal points toward pp. Farkas orients it the other way, so that generators score ≥ 0 and pp scores < 0. Negating vv does that.

Unit 5.5 · Why strong duality holds

Farkas' lemma in other forms, and how to convert between them

Sources: L11 §2 (cone form); standard variants

Farkas' lemma comes in several equivalent versions. Each one says the same thing: a linear system has no solution exactly when some combination of its rows produces an obvious contradiction. You can derive any version from any other with the conversion tools of unit 1.5.

System (I) is infeasible …… iff this certificate existsCertificate's sign
(F1) Ax=b, x≥0Ax=b,\ x\ge0A⊤y≥0,  b⊤y<0A\T y\ge0,\ \ b\T y<0yy free
(F2) Ax≤b, x≥0Ax\le b,\ x\ge0A⊤y≥0,  b⊤y<0A\T y\ge0,\ \ b\T y<0y≥0y\ge0
(F3) Ax≤bAx\le b (xx free)A⊤y=0,  b⊤y<0A\T y=0,\ \ b\T y<0y≥0y\ge0

(F1) is the lecture's version with M=AM=A, p=bp=b, w=yw=y: "bb is in the cone of the columns of AA, or a witness separates it".

The easy direction is always one line

Example: why (F3)'s two systems can't both hold
0=(A⊤y)⊤x=y⊤Ax  ≤  y⊤b  <  0.0=(A\T y)\T x=y\T Ax\;\le\;y\T b\;<\;0.

In wordsA contradiction, so if the certificate exists the system is infeasible.

Symbol by symbol
first ==A⊤y=0A\T y=0
≤\leAx≤bAx\le b and y≥0y\ge0 (nonnegative weights keep ≤)
<<b⊤y<0b\T y<0

Worked conversion: (F1) ⇒ (F2)

  1. Rewrite the system in (F1)'s form. Add slacks: Ax≤b, x≥0Ax\le b,\ x\ge0 has a solution iff Ax+s=b, x≥0, s≥0Ax+s=b,\ x\ge0,\ s\ge0 has one, i.e. iff [A  I](xs)=b[A\ \ I]\binom{x}{s}=b with (xs)≥0\binom{x}{s}\ge0.
  2. Apply (F1) with the matrix A′=[A  I]A'=[A\ \ I]: infeasible iff some yy has A′⊤y≥0A'^{\top}y\ge0 and b⊤y<0b\T y<0.
  3. Unpack A′⊤y=(A⊤yy)≥0A'^{\top}y=\binom{A\T y}{y}\ge0: that is A⊤y≥0A\T y\ge0 and y≥0y\ge0. The slack columns are what force yy to be nonnegative. ∎
Unit 5.6 · Why strong duality holds

If c is outside the cone, there is a better feasible point

Sources: L11 §4–4.1; Lec11_SecB p.3

Suppose the claim c=∑r∈Sλrar, λ≥0c=\sum_{r\in S}\lambda_ra_r,\ \lambda\ge0 fails. Apply Farkas with M=[ar]r∈SM=[a_r]_{r\in S} (tight normals as columns) and p=cp=c. We get ww with ar⊤w≥0a_r\T w\ge0 for all tight rr, and c⊤w<0c\T w<0. Set v=−wv=-w:

An improving, feasible direction
ar⊤v≤0  (r∈S),c⊤v>0.a_r\T v\le0\ \ (r\in S),\qquad c\T v>0.

In wordsvv does not push outward through any tight wall, yet it strictly increases the objective.

Symbol by symbol
ar⊤v≤0a_r\T v\le0moving along vv does not increase constraint rr's left side, so tight row rr stays satisfied
c⊤v>0c\T v>0the objective goes up along vv

Now step from x∗x^* to x∗+εvx^*+\eps v and check every constraint:

Tight constraints stay feasible
ar⊤(x∗+εv)=ar⊤x∗⏟=dr+εar⊤v⏟≤0≤dr(r∈S).a_r\T(x^*+\eps v)=\underbrace{a_r\T x^*}_{=d_r}+\eps\underbrace{a_r\T v}_{\le0}\le d_r\qquad(r\in S).

In wordsar⊤x∗+εar⊤v=dr+(something≤0)≤dra_r\T x^*+\eps a_r\T v=d_r+(\text{something}\le0)\le d_r: a tight wall is never crossed.

Slack constraints: pick ε small enough
δr=dr−ar⊤x∗>0 (r∉S);if ar⊤v>0, require ε≤δrar⊤v.\delta_r=d_r-a_r\T x^*>0\ (r\notin S);\qquad \text{if } a_r\T v>0,\ \text{require}\ \eps\le\frac{\delta_r}{a_r\T v}.

In wordsEach slack constraint has a positive cushion δr\delta_r. Moving along vv uses it up at rate ar⊤va_r\T v (if positive), so a step of size up to δr/(ar⊤v)\delta_r/(a_r\T v) is safe.

Symbol by symbol
δr\delta_rslack (cushion) of inactive row rr
ar⊤v≤0a_r\T v\le0then row rr never gets closer to its wall, so no restriction
finitely many rowsso the minimum of the ratios is a positive number: one ε>0\eps>0 works for all rows at once, including the sign rows
Contradiction
c⊤(x∗+εv)=c⊤x∗+ε c⊤v>c⊤x∗.c\T(x^*+\eps v)=c\T x^*+\eps\,c\T v>c\T x^*.

In wordsA feasible point with a strictly higher objective, which is impossible because x∗x^* is optimal. So the claim holds: cc is in the cone of tight normals.

Unit 5.7 · Why strong duality holds

Turning the cone coefficients into a dual solution

Sources: L11 §4.2, §5; Lec11_SecB p.3

We now have c=∑r∈Sλrarc=\sum_{r\in S}\lambda_ra_r with λr≥0\lambda_r\ge0. Give every inactive row coefficient 0 (this is the equation y(a⊤x−b)=0y(a\T x-b)=0: an inactive row gets weight 0). Split the coefficients:

Split into original rows and sign rows
c  =  ∑j=1myj (row j of A)  +  ∑i=1nzi (−ei)  =  A⊤y−z,y≥0, z≥0.c\;=\;\sum_{j=1}^{m}y_j\,(\text{row } j \text{ of } A)\;+\;\sum_{i=1}^{n}z_i\,(-e_i)\;=\;A\T y-z,\qquad y\ge0,\ z\ge0.

In wordsThe weights on the mm original constraints are yy. The weights on the nn sign constraints −xi≤0-x_i\le0 are zz.

Symbol by symbol
yj=λjy_j=\lambda_jcoefficient of original row jj (zero if that row is slack at x∗x^*)
ziz_icoefficient of the sign row −xi≤0-x_i\le0 (zero if xi∗>0x_i^*>0)
−z-zthe normals of sign rows are −ei-e_i, which is why zz enters with a minus
y is dual feasible
A⊤y=c+z  ≥  c,y≥0.A\T y=c+z\;\ge\;c,\qquad y\ge0.

In wordsSince z≥0z\ge0, the combined coefficients dominate cc. This is exactly the dual constraint. And z=A⊤y−cz=A\T y-c is the dual slack vector.

…with the same value as x*
c⊤x∗=∑r∈Sλr ar⊤x∗=∑r∈Sλr dr=b⊤y.c\T x^*=\sum_{r\in S}\lambda_r\,a_r\T x^*=\sum_{r\in S}\lambda_r\,d_r=b\T y.

In wordsEvery row with a positive weight is tight (ar⊤x∗=dra_r\T x^*=d_r). Sign rows have dr=0d_r=0, so they contribute nothing to the right side. What is left is ∑jyjbj\sum_j y_jb_j.

Finish: x∗x^* is primal feasible, yy is dual feasible, and c⊤x∗=b⊤yc\T x^*=b\T y. By weak duality yy is dual-optimal and the two optimal values coincide. This is strong duality. ∎

L11 exercise: max⁡(−x)\max(-x) s.t. x≤1, x≥0x\le1,\ x\ge0

Write the dual, find an optimal primal–dual pair, and say which normal supplies the objective direction in the strong-duality proof.
Show answer
A=[1], b=1, c=−1A=[1],\ b=1,\ c=-1. Dual: min⁡y\min y s.t. y≥−1, y≥0y\ge-1,\ y\ge0, so y∗=0y^*=0. Primal optimum x∗=0x^*=0. Both values are 0, so the pair is optimal. At x∗=0x^*=0 the tight row is −x≤0-x\le0 (normal −1-1), and x≤1x\le1 is slack (so y=0y=0). Decomposition: c=A⊤y−z=0−1c=A\T y-z=0-1 with z=1z=1. The nonnegativity normal supplies the objective direction. This is why the bookkeeping must include sign constraints.

What the three LP lectures give you (L11 §5)

  1. Modeling: real variables and linear constraints express resource allocation and graph problems.
  2. Algorithms: polynomial-size rational LPs are solvable in polynomial time in their encoding length.
  3. Certificates: a feasible solution and a matching dual solution prove optimality.
  4. Geometry: at an optimum, tight constraints block every improving direction. Farkas turns this into multipliers.
  5. Rounding: a fractional optimum can guide the search for an integral one. Max-flow/min-cut is an exact example.
Unit 6.1 · Convex functions

The offline convex optimization problem

Sources: L12 §1; Lec12_secB p.3 ("Now we look at min f(x), K convex")

An LP optimizes a linear function over a convex region. Now the objective may be nonlinear, but we keep the property that makes the problem tractable: convexity.

The problem
min⁡x∈K f(x),f:Rd→R,K⊆Rd nonempty and convex.\min_{x\in K}\ f(x),\qquad f:\R^d\to\R,\quad K\subseteq\R^d \text{ nonempty and convex}.

In wordsFind the lowest point of a landscape ff over an allowed region KK.

Symbol by symbol
dddimension (number of variables); L12 uses dd where the LP lectures used nn
KKfeasible set; in the main L12 theorem K=RdK=\R^d (unconstrained)
x∗x^*a minimizer. Writing x∗x^* assumes one exists (e.g. exe^x on R\R has none)
ε-optimal (additive)
x∈Kandf(x)−f(x∗)≤ε.x\in K\quad\text{and}\quad f(x)-f(x^*)\le\eps.

In wordsA feasible answer whose value is at most ε\eps above the best possible value.

Symbol by symbol
f(x)−f(x∗)f(x)-f(x^*)the optimality gap (objective error), always ≥ 0
ε\epsthe tolerance you are willing to accept

When you use itGradient descent guarantees this with ε=DG/T\eps=DG/\sqrt T. Note it is additive, not a ratio f(x)/f(x∗)f(x)/f(x^*), which would be meaningless if f(x∗)≤0f(x^*)\le0.

Unit 6.2 · Convex functions

Convex functions: the graph lies below every chord

Sources: L12 §1; Lec12_secB p.1 (θ-form and figure)
Definition: convex function
f(θx+(1−θ)y)  ≤  θf(x)+(1−θ)f(y)∀x,y∈K,  ∀θ∈[0,1].f\big(\theta x+(1-\theta)y\big)\;\le\;\theta f(x)+(1-\theta)f(y)\qquad\forall x,y\in K,\ \ \forall\theta\in[0,1].

In wordsThe value at a blend of two inputs is at most the same blend of the two values. Geometrically, the graph lies on or below the straight chord joining (x,f(x))(x,f(x)) and (y,f(y))(y,f(y)).

Symbol by symbol
θx+(1−θ)y\theta x+(1-\theta)ya point on the segment between xx and yy (in KK because KK is convex)
f(θx+(1−θ)y)f(\theta x+(1-\theta)y)height of the graph above that point
θf(x)+(1−θ)f(y)\theta f(x)+(1-\theta)f(y)height of the chord above that point
KKdomain; it must be convex or the left side might not even be defined

Why it is trueA definition. L12 writes it with λ\lambda, the board with θ\theta, sometimes as (1−θ)x+θy(1-\theta)x+\theta y. These are all the same statement with the roles of x,yx,y swapped.

When you use itProving local ⇒ global; the many-point (Jensen) inequality for the average iterate; and, in the limit θ→0\theta\to0, the tangent inequality.

xyθx+(1−θ)y chord: θf(x)+(1−θ)f(y)graph: f(θx+(1−θ)y)gap ≥ 0
The board figure: the red gap between chord and graph is never negative for a convex function.
Unit 6.3 · Convex functions

First-order condition: tangents are global lower bounds

Sources: L12 §2; Lec12_secB pp.1–2 (proof with board annotation (y−x)/(y−x))
Decoding the tangent inequality
f(y)⏟true value at y  ≥  f(x)+⟨∇f(x),y−x⟩⏟tangent plane at x, evaluated at y\underbrace{f(y)}_{\text{true value at }y}\;\ge\;\underbrace{f(x)+\langle\nabla f(x),y-x\rangle}_{\text{tangent plane at }x\text{, evaluated at }y}

In wordsBuild the tangent line (plane) at any point xx. For a convex function it lies below the graph everywhere, not only near xx. So local slope information gives a global lower bound.

Symbol by symbol
f(x)+⟨∇f(x),y−x⟩f(x)+\langle\nabla f(x),y-x\ranglefirst-order Taylor polynomial ("Taylor of degree 1") of ff around xx
⟨∇f(x),y−x⟩\langle\nabla f(x),y-x\ranglepredicted change: slope vector · displacement
y−xy-xthe difference between the two points

When you use itPlugging in y=x∗y=x^* gives the inequality that drives the whole gradient-descent proof.

Proof (⇒): from chords to tangents

  1. Write the blend toward yy as x+θ(y−x)=θy+(1−θ)xx+\theta(y-x)=\theta y+(1-\theta)x. Convexity gives f(x+θ(y−x))≤θf(y)+(1−θ)f(x)f(x+\theta(y-x))\le\theta f(y)+(1-\theta)f(x).
  2. Subtract f(x)f(x) from both sides: f(x+θ(y−x))−f(x)≤θ(f(y)−f(x))f(x+\theta(y-x))-f(x)\le\theta\big(f(y)-f(x)\big).
  3. Divide by θ>0\theta>0 (keeps the direction): f(x+θ(y−x))−f(x)θ  ≤  f(y)−f(x).\frac{f(x+\theta(y-x))-f(x)}{\theta}\;\le\;f(y)-f(x).
  4. Let θ↓0\theta\downarrow0. The left side is a difference quotient along direction y−xy-x, which converges to the directional derivative ⟨∇f(x),y−x⟩\langle\nabla f(x),y-x\rangle. So ⟨∇f(x),y−x⟩≤f(y)−f(x)\langle\nabla f(x),y-x\rangle\le f(y)-f(x). ∎

Proof (⇐): from tangents to chords

Let z=λx+(1−λ)yz=\lambda x+(1-\lambda)y. Apply the tangent inequality at zz, once toward xx and once toward yy:

f(x)≥f(z)+⟨∇f(z),x−z⟩,f(y)≥f(z)+⟨∇f(z),y−z⟩.f(x)\ge f(z)+\langle\nabla f(z),x-z\rangle,\qquad f(y)\ge f(z)+\langle\nabla f(z),y-z\rangle.

Multiply by λ\lambda and 1−λ1-\lambda and add. The gradient terms combine into ⟨∇f(z), λx+(1−λ)y−z⟩=⟨∇f(z),0⟩=0\langle\nabla f(z),\ \lambda x+(1-\lambda)y-z\rangle=\langle\nabla f(z),0\rangle=0. What remains is λf(x)+(1−λ)f(y)≥f(z)\lambda f(x)+(1-\lambda)f(y)\ge f(z), which is convexity. ∎

The inequality to remember

Objective error ≤ gradient inner product
f(x)−f(x∗)  ≤  ⟨∇f(x), x−x∗⟩.f(x)-f(x^*)\;\le\;\langle\nabla f(x),\,x-x^*\rangle.

In wordsHow far you are above the optimum in value is at most (your slope) · (your displacement from the optimum).

Symbol by symbol
x∗x^*a minimizer (unknown to the algorithm, but usable in the analysis)
left sidethe objective error, ≥ 0
right sidean inner product that appears when you expand a gradient step

Why it is truePut y=x∗y=x^* in the tangent inequality: f(x∗)≥f(x)+⟨∇f(x),x∗−x⟩f(x^*)\ge f(x)+\langle\nabla f(x),x^*-x\rangle. Move terms: f(x)−f(x∗)≤−⟨∇f(x),x∗−x⟩=⟨∇f(x),x−x∗⟩f(x)-f(x^*)\le-\langle\nabla f(x),x^*-x\rangle=\langle\nabla f(x),x-x^*\rangle.

When you use itStep 1 of the gradient-descent proof. It turns "objective error" into "something the update rule controls".

Unit 6.4 · Convex functions

Second-order test: the Hessian is positive semidefinite

Sources: L12 §3.1; Lec12_secB p.2 (Thm ②)
Positive semidefinite (PSD)
H⪰0  ⟺  v⊤Hv=∑i,jHijvivj≥0  ∀v.H\succeq0\iff v\T Hv=\sum_{i,j}H_{ij}v_iv_j\ge0\ \ \forall v.

In wordsIn every direction vv, the curvature (second derivative along that direction) is nonnegative: the function bends upward or is flat, never downward.

Symbol by symbol
∇2f(x)\nabla^2 f(x)Hessian: the matrix of second partial derivatives ∂2f/∂xi∂xj\partial^2 f/\partial x_i\partial x_j
v⊤Hvv\T Hvsecond derivative of ff along the line through xx in direction vv
⪰0\succeq0"is PSD" (not entrywise ≥ 0!)

Why it is trueRestrict ff to a line: g(t)=f(x+tv)g(t)=f(x+tv). The chain rule gives g′′(t)=v⊤∇2f(x+tv) vg''(t)=v\T\nabla^2 f(x+tv)\,v. A 1-D function is convex iff g′′≥0g''\ge0, and ff is convex iff its restriction to every line is convex.

When you use itQuick convexity checks: in 1-D just check f′′≥0f''\ge0. For a 2×22\times2 symmetric H=(abbc)H=\begin{pmatrix}a&b\\b&c\end{pmatrix}: PSD ⇔ a≥0, c≥0, ac−b2≥0a\ge0,\ c\ge0,\ ac-b^2\ge0. In general: PSD ⇔ all eigenvalues ≥ 0.

Worked examples

ffHessian / f′′f''Convex?
x2/2x^2/211yes (strictly)
exe^xex>0e^x>0yes (but no minimizer on R\R)
x3x^36x6x, negative for x<0x<0no
(x2−1)2(x^2-1)^212x2−412x^2-4, negative near 0no (two local minima at ±1)
x12+x1x2+x22x_1^2+x_1x_2+x_2^2(2112)\begin{pmatrix}2&1\\1&2\end{pmatrix}: 2≥0, 4−1≥02\ge0,\ 4-1\ge0yes
x12−x22x_1^2-x_2^2(200−2)\begin{pmatrix}2&0\\0&-2\end{pmatrix}no (saddle)
12∥Ax−b∥2\tfrac12\norm{Ax-b}^2A⊤AA\T A: v⊤A⊤Av=∥Av∥2≥0v\T A\T Av=\norm{Av}^2\ge0yes
Unit 6.5 · Convex functions

Building convex functions: max, partial minimization, and more

Sources: Lec12_secB p.2 (Remark in red); L12 §3.1 (|x|, max of affine)

This unit covers the instructor's red Remark on the Lec12 board, plus the standard operations that preserve convexity. These rules let you prove convexity without computing any derivatives, which matters when a function is not differentiable.

Proof in one chain
g(θx+(1−θ)y)=max⁡ifi(θx+(1−θ)y)  ≤  max⁡i[θfi(x)+(1−θ)fi(y)]  ≤  θmax⁡ifi(x)+(1−θ)max⁡ifi(y).g(\theta x+(1-\theta)y)=\max_i f_i(\theta x+(1-\theta)y)\;\le\;\max_i\big[\theta f_i(x)+(1-\theta)f_i(y)\big]\;\le\;\theta\max_if_i(x)+(1-\theta)\max_if_i(y).

In wordsEach piece is below its own chord. Taking the maximum keeps that, and the maximum of a sum is at most the sum of the maxima.

Symbol by symbol
1st ≤\leconvexity of each fif_i
2nd ≤\leθfi(x)≤θmax⁡kfk(x)\theta f_i(x)\le\theta\max_k f_k(x) and similarly for yy, for every ii (uses θ,1−θ≥0\theta,1-\theta\ge0)

Why it is trueEpigraph view: the epigraph of max⁡ifi\max_if_i is the intersection of the epigraphs, and intersections of convex sets are convex. This is the same reason LP regions are convex.

When you use it∣x∣=max⁡(x,−x)|x|=\max(x,-x); piecewise-linear max⁡j(aj⊤x+bj)\max_j(a_j\T x+b_j); ∥x∥=max⁡∥u∥≤1u⊤x\norm{x}=\max_{\norm u\le1}u\T x; and the "worst case over scenarios" objectives used in LP modeling.

g(x) = max(−x, x, ½) −xx½ 0
The upper envelope (solid) of three lines (dashed) is convex, even though it has corners.
Proof
g(θx1+(1−θ)x2)  ≤  f(θx1+(1−θ)x2, θy1+(1−θ)y2)  ≤  θf(x1,y1)+(1−θ)f(x2,y2)  ≤  θg(x1)+(1−θ)g(x2)+ε.g(\theta x_1+(1-\theta)x_2)\;\le\;f\big(\theta x_1+(1-\theta)x_2,\ \theta y_1+(1-\theta)y_2\big)\;\le\;\theta f(x_1,y_1)+(1-\theta)f(x_2,y_2)\;\le\;\theta g(x_1)+(1-\theta)g(x_2)+\eps.

In wordsTake near-optimal partners y1,y2y_1,y_2 for x1,x2x_1,x_2. Blending them gives a valid (but not necessarily best) partner for the blended xx, so the best value at the blend is no worse than the blend of the values.

Symbol by symbol
y1,y2∈Yy_1,y_2\in Ychosen with f(xk,yk)≤g(xk)+εf(x_k,y_k)\le g(x_k)+\eps (they exist by definition of inf⁡\inf)
1st ≤\leθy1+(1−θ)y2∈Y\theta y_1+(1-\theta)y_2\in Y because YY is convex, and gg is an infimum over all y∈Yy\in Y
2nd ≤\lejoint convexity of ff in the pair (x,y)(x,y)
3rd ≤\lethe choice of y1,y2y_1,y_2

Why it is trueThe inequality holds for every ε>0\eps>0, so it holds with ε=0\eps=0.

When you use itThe distance to a convex set, dist(x,C)=inf⁡y∈C∥x−y∥\mathrm{dist}(x,C)=\inf_{y\in C}\norm{x-y}, is convex because ∥x−y∥\norm{x-y} is jointly convex. That is the function the separation theorem minimizes.

C = [a, b]g(x) = dist(x, C) = min over y∈C of |x − y|
Partial minimization: minimizing the jointly convex ∣x−y∣|x-y| over yy in a convex set leaves a convex function of xx.

The rest of the toolbox

OperationResultReason
αf+βg\alpha f+\beta g, α,β≥0\alpha,\beta\ge0convexadd the two chord inequalities with nonnegative weights
f(Ax+b)f(Ax+b) (affine input)convexaffine maps send segments to segments
any norm ∥x∥\norm{x}convextriangle inequality + scaling
max⁡ifi\max_i f_iconvexRule 1
inf⁡y∈Yf(x,y)\inf_{y\in Y}f(x,y)convexRule 2
min⁡(f,g)\min(f,g), f⋅gf\cdot g, f−gf-gnot in generalmin⁡(x2,(x−2)2)\min(x^2,(x-2)^2) has two dips. A product can fail, even when both factors are nonnegative. A difference can fail because −g-g is concave.
Show f(x)=∥Ax−b∥2+max⁡(0, 1−x1)f(x)=\norm{Ax-b}_2+\max(0,\,1-x_1) is convex.
Show answer
∥⋅∥\norm{\cdot} is convex and x↦Ax−bx\mapsto Ax-b is affine, so the first term is convex. max⁡(0,1−x1)\max(0,1-x_1) is a max of two affine functions (Rule 1). A sum of convex functions is convex.
Unit 6.6 · Convex functions

Least squares, step by step

Sources: L12 §3.1 example
Least squares
f(x)=12∥Ax−b∥22,∇f(x)=A⊤(Ax−b),∇2f(x)=A⊤A.f(x)=\tfrac12\norm{Ax-b}_2^2,\qquad \nabla f(x)=A\T(Ax-b),\qquad \nabla^2 f(x)=A\T A.

In wordsFit xx so that the predictions AxAx match the measurements bb as closely as possible in squared error.

Symbol by symbol
A∈Rm×dA\in\R^{m\times d}mm measurements (rows), dd unknowns (columns)
r=Ax−b∈Rmr=Ax-b\in\R^mresiduals: errors in measurement space
A⊤r∈RdA\T r\in\R^dresiduals sent back to the variables responsible for them: the gradient lives in variable space
12\tfrac12cosmetic; it cancels the 2 from differentiating a square

Why it is trueWrite rj=∑iAjixi−bjr_j=\sum_iA_{ji}x_i-b_j and f=12∑jrj2f=\tfrac12\sum_jr_j^2. The chain rule gives ∂f/∂xi=∑jrj ∂rj/∂xi=∑jrjAji=(A⊤r)i\partial f/\partial x_i=\sum_jr_j\,\partial r_j/\partial x_i=\sum_jr_jA_{ji}=(A\T r)_i. Differentiating again, ∂2f/∂xi∂xk=∑jAjiAjk=(A⊤A)ik\partial^2f/\partial x_i\partial x_k=\sum_jA_{ji}A_{jk}=(A\T A)_{ik}.

When you use itConvexity: v⊤A⊤Av=∥Av∥2≥0v\T A\T Av=\norm{Av}^2\ge0, so the Hessian is PSD everywhere.

fitted line (the x we choose)springs: energy ½·(stretch)² eachdata points are fixed; the line settles where the forces balance
Each residual is a spring stretched between a data point and the line. Total spring energy is 12∥Ax−b∥2\tfrac12\norm{Ax-b}^2. The line comes to rest where the net force is zero: A⊤(Ax−b)=0A\T(Ax-b)=0, the normal equations.
Normal equations
∇f(x)=0  ⟺  A⊤Ax=A⊤b.\nabla f(x)=0\iff A\T Ax=A\T b.

In wordsSetting the gradient to zero (enough for convex ff, see the next unit) gives a linear system for the best fit.

Why it is trueIf the columns of AA are independent, A⊤AA\T A is positive definite (∥Av∥2>0\norm{Av}^2>0 for v≠0v\ne0): ff is strictly convex with the unique minimizer x∗=(A⊤A)−1A⊤bx^*=(A\T A)^{-1}A\T b. If not, there are many minimizers.

Unit 6.7 · Convex functions

Every local minimum of a convex function is global

Sources: L12 §3; Lec12_secB p.3
x̂ (local min)y with f(y) < f(x̂) z_θ = (1−θ)x̂ + θyneighbourhood where x̂ is best
Walk from x^\hat x toward a better point yy. For small θ\theta the point zθz_\theta is inside the neighbourhood, yet it is better than x^\hat x. Contradiction.

Stationary points and constraints

Unconstrained, differentiable, convex
∇f(x)=0  ⟺  x is a global minimizer (on Rd).\nabla f(x)=0\iff x \text{ is a global minimizer (on } \R^d).

In wordsFor convex functions on all of Rd\R^d, "flat" means "best".

Why it is true(⇒) Tangent inequality with ∇f(x)=0\nabla f(x)=0 gives f(y)≥f(x)f(y)\ge f(x) for all yy. (⇐) At an unconstrained minimum every directional derivative must be 0 (otherwise step the other way), so the gradient is 0.

Constrained first-order optimality (added bridge)
x∗∈arg⁡min⁡x∈Kf(x)  ⟺  ⟨∇f(x∗), y−x∗⟩≥0∀y∈K.x^*\in\arg\min_{x\in K}f(x)\iff\langle\nabla f(x^*),\,y-x^*\rangle\ge0\quad\forall y\in K.

In wordsAt a constrained optimum, every feasible direction goes uphill or level. No feasible direction goes downhill.

Why it is true(⇒) A feasible direction with negative slope would give a nearby better feasible point. (⇐) Tangent inequality: f(y)≥f(x∗)+⟨∇f(x∗),y−x∗⟩≥f(x∗)f(y)\ge f(x^*)+\langle\nabla f(x^*),y-x^*\rangle\ge f(x^*).

When you use itFor an LP (f=−c⊤xf=-c\T x) this is exactly the active-normal picture of Chapter 5: −∇f=c-\nabla f=c must lie in the cone of tight normals.

Unit 7.1 · Gradient descent

Why step in the negative-gradient direction?

Sources: L12 §4.1; Lec12_secB p.4 (angle α, cos)

Near xx a smooth function looks like its tangent plane. Among all short steps, which one lowers the tangent prediction most? The answer is: straight against the gradient.

Step 1: the predicted change of a small step
f(x+h)=f(x)+⟨∇f(x),h⟩+o(∥h∥).f(x+h)=f(x)+\langle\nabla f(x),h\rangle+o(\norm h).

In wordsFor a short step hh, the change in ff is essentially ⟨∇f(x),h⟩\langle\nabla f(x),h\rangle. To decrease ff as fast as possible, make this inner product as negative as possible.

Symbol by symbol
⟨∇f(x),h⟩\langle\nabla f(x),h\ranglefirst-order (linear) prediction of the change
o(∥h∥)o(\norm h)error, negligible compared with ∥h∥\norm h for small steps
Step 2: the angle picture (board)
−1  ≤  cos⁡α=⟨v,w⟩∥v∥ ∥w∥  ≤  1⟹⟨v,w⟩  ≥  −∥v∥ ∥w∥.-1\;\le\;\cos\alpha=\frac{\langle v,w\rangle}{\norm v\,\norm w}\;\le\;1\qquad\Longrightarrow\qquad\langle v,w\rangle\;\ge\;-\norm v\,\norm w.

In wordsA dot product between two vectors can be as low as minus the product of their sizes, and no lower. It reaches that value exactly when the vectors point in opposite directions (α=180∘\alpha=180^\circ).

Symbol by symbol
α\alphathe angle between vv and ww
cos⁡α=−1\cos\alpha=-1opposite directions; the most negative possible inner product

Why it is trueThis is Cauchy–Schwarz (see the toolkit).

Step 3: steepest descent
⟨∇f(x),h⟩  ≥  −∥∇f(x)∥ ∥h∥  ≥  −ρ ∥∇f(x)∥for all ∥h∥≤ρ,\langle\nabla f(x),h\rangle\;\ge\;-\norm{\nabla f(x)}\,\norm h\;\ge\;-\rho\,\norm{\nabla f(x)}\qquad\text{for all } \norm h\le\rho,

In wordsWith step length at most ρ\rho, the predicted decrease can never exceed ρ∥∇f(x)∥\rho\norm{\nabla f(x)}. It reaches that bound exactly at h=−ρ ∇f(x)/∥∇f(x)∥h=-\rho\,\nabla f(x)/\norm{\nabla f(x)}, pointing straight against the gradient.

Symbol by symbol
ρ\rhoallowed step length (a radius)
∇f(x)/∥∇f(x)∥\nabla f(x)/\norm{\nabla f(x)}unit vector in the gradient direction

Why it is trueCauchy–Schwarz with v=∇f(x), w=hv=\nabla f(x),\ w=h, then ∥h∥≤ρ\norm h\le\rho. Equality needs cos⁡α=−1\cos\alpha=-1 and ∥h∥=ρ\norm h=\rho.

When you use itThere are many directions to move: pick the best one by minimizing this. −∇f-\nabla f is the steepest first-order descent direction in Euclidean distance.

Unit 7.2 · Gradient descent

The algorithm and what the step size does

Sources: L12 §4; Lec12_secB p.4 ("Init x₀, Repeat")
Gradient descent (unconstrained, K = ℝᵈ)
xt+1=xt−η ∇f(xt),t=0,1,2,…x_{t+1}=x_t-\eta\,\nabla f(x_t),\qquad t=0,1,2,\dots

In wordsStart at x0x_0. Repeatedly compute the slope where you stand and take a step of size η\eta times the slope, downhill.

Symbol by symbol
xtx_tthe iterate (current point) after tt steps
η>0\eta>0the step size (learning rate), constant in the L12 theorem
∇f(xt)\nabla f(x_t)one oracle call per step

When you use itEvery move goes toward something smaller. How fast? That is what the theorem in unit 7.3 answers.

One dimension: f(x)=x2/2f(x)=x^2/2

f′(x)=x⟹xt+1=xt−ηxt=(1−η) xt⟹xt=(1−η)t x0.f'(x)=x\quad\Longrightarrow\quad x_{t+1}=x_t-\eta x_t=(1-\eta)\,x_t\quad\Longrightarrow\quad x_t=(1-\eta)^t\,x_0.

In wordsEach step multiplies the position by the same factor 1−η1-\eta. Everything depends on the size and sign of that factor.

Step sizefactor 1−η1-\etaBehaviour from x0≠0x_0\ne0
0<η<10<\eta<1in (0,1)(0,1)converges, same side (η=12\eta=\tfrac12: xt=2−tx0x_t=2^{-t}x_0)
η=1\eta=100reaches the optimum in one step
1<η<21<\eta<2in (−1,0)(-1,0)alternates sides but converges
η=2\eta=2−1-1xt=(−1)tx0x_t=(-1)^tx_0: bounces forever, never improves
η>2\eta>2∣1−η∣>1|1-\eta|>1∣xt∣|x_t| grows: diverges

Two dimensions: why the zig-zag happens

On a stretched bowl f(x)=12(x12+κx22)f(x)=\tfrac12(x_1^2+\kappa x_2^2) each coordinate has its own factor: x1←(1−η)x1x_1\gets(1-\eta)x_1 and x2←(1−ηκ)x2x_2\gets(1-\eta\kappa)x_2. Stability needs η<2/κ\eta<2/\kappa for the steep direction, but then the shallow direction shrinks by only 1−η1-\eta per step. A badly stretched bowl (large κ\kappa) makes gradient descent slow. This is the motivation for the smoothness analysis of L13 (Chapter 8) and for strong convexity.

Unit 7.3 · Gradient descent

The convergence theorem: statement decoded

Sources: L12 §5; Lec12_secB pp.4–5
Every symbol in the theorem
f(xˉT)−f(x∗)⏟error of the output  ≤  D22ηT⏟“start far away” term  +  ηG22⏟“discrete step” penalty\underbrace{f(\bar x_T)-f(x^*)}_{\text{error of the output}}\;\le\;\underbrace{\frac{D^2}{2\eta T}}_{\text{``start far away'' term}}\;+\;\underbrace{\frac{\eta G^2}{2}}_{\text{``discrete step'' penalty}}
Symbol by symbol
DDa known bound on the starting distance to an optimizer ("you don't start from a far-away point"). Not the diameter of a domain.
GGa known bound on the gradient length at the iterates: how steep the function can be
TTnumber of gradient steps (= oracle calls), fixed in advance
η\etathe constant step size
xˉT\bar x_Taverage of x0,x1,…,xT−1x_0,x_1,\dots,x_{T-1}: the points where gradients were evaluated (not x1..xTx_1..x_T)
first termshrinks as TT grows (more steps); large when η\eta is tiny (slow progress)
second termdoes not shrink with TT; large when η\eta is big (overshooting)
DG/TDG/\sqrt Tthe balanced bound; halving the error needs 4× the iterations

Why it is trueProved in the next three units: expand one step, telescope, average.

When you use itExam computations: given D,G,TD,G,T, find η\eta and the error. Given ε\eps, find TT.

Unit 7.4 · Gradient descent

Proof step 1: one update, expanded

Sources: L12 §5.1–5.2; Lec12_secB p.5

We cannot compute x∗x^*, but the analysis can use it. Track the squared distance to the optimizer, sometimes called a potential.

The potential
Rt=∥xt−x∗∥2,gt=∇f(xt).R_t=\norm{x_t-x^*}^2,\qquad g_t=\nabla f(x_t).
Symbol by symbol
RtR_tsquared distance from the current iterate to the optimizer; R0≤D2R_0\le D^2, and always Rt≥0R_t\ge0
gtg_tthe gradient used at step tt; ∥gt∥≤G\norm{g_t}\le G
Expand one update
Rt+1=∥xt−ηgt−x∗∥2=∥xt−x∗∥2⏟Rt  −  2η ⟨gt, xt−x∗⟩  +  η2∥gt∥2.R_{t+1}=\norm{x_t-\eta g_t-x^*}^2=\underbrace{\norm{x_t-x^*}^2}_{R_t}\;-\;2\eta\,\langle g_t,\,x_t-x^*\rangle\;+\;\eta^2\norm{g_t}^2.

In wordsNew distance² = old distance² − (a "progress" term) + (an "overshoot" term).

Symbol by symbol
xt+1−x∗=(xt−x∗)−ηgtx_{t+1}-x^*=(x_t-x^*)-\eta g_tsubstitute the update rule
expansion∥a−b∥2=∥a∥2−2⟨a,b⟩+∥b∥2\norm{a-b}^2=\norm a^2-2\langle a,b\rangle+\norm b^2 with a=xt−x∗a=x_t-x^*, b=ηgtb=\eta g_t
−2η⟨gt,xt−x∗⟩-2\eta\langle g_t,x_t-x^*\rangleprogress: positive inner product means the step points toward x∗x^* "on average"
η2∥gt∥2\eta^2\norm{g_t}^2overshoot: the squared length of the step, always ≥ 0
Apply the two assumptions
Rt+1  ≤  Rt−2η(f(xt)−f(x∗))+η2G2.R_{t+1}\;\le\;R_t-2\eta\big(f(x_t)-f(x^*)\big)+\eta^2G^2.

In wordsConvexity says the progress term is at least the objective error. Bounded gradients cap the overshoot term.

Symbol by symbol
convexity⟨gt,xt−x∗⟩≥f(xt)−f(x∗)\langle g_t,x_t-x^*\rangle\ge f(x_t)-f(x^*) (the key inequality). Multiplying by −2η<0-2\eta<0 flips it: −2η⟨gt,xt−x∗⟩≤−2η(f(xt)−f(x∗))-2\eta\langle g_t,x_t-x^*\rangle\le-2\eta(f(x_t)-f(x^*))
gradient bound∥gt∥2≤G2\norm{g_t}^2\le G^2
Target one-step inequality (rearranged)
f(xt)−f(x∗)  ≤  Rt−Rt+12η+ηG22.f(x_t)-f(x^*)\;\le\;\frac{R_t-R_{t+1}}{2\eta}+\frac{\eta G^2}{2}.

In wordsThe error at step tt is paid for by how much the distance to x∗x^* shrank, plus a fixed penalty for taking discrete steps.

Why it is trueMove 2η(f(xt)−f(x∗))2\eta(f(x_t)-f(x^*)) to the left and Rt+1R_{t+1} to the right, then divide by 2η>02\eta>0.

Unit 7.5 · Gradient descent

Proof steps 2–3: telescope, then average

Sources: L12 §5.3; Lec12_secB p.6
Sum the one-step inequalities over t = 0,…,T−1
∑t=0T−1(f(xt)−f(x∗))  ≤  12η∑t=0T−1(Rt−Rt+1)+ηG2T2  =  R0−RT2η+ηG2T2.\sum_{t=0}^{T-1}\big(f(x_t)-f(x^*)\big)\;\le\;\frac1{2\eta}\sum_{t=0}^{T-1}(R_t-R_{t+1})+\frac{\eta G^2T}{2}\;=\;\frac{R_0-R_T}{2\eta}+\frac{\eta G^2T}{2}.

In wordsAdding up, the distance terms cancel in pairs ("telescoping"): (R0−R1)+(R1−R2)+⋯+(RT−1−RT)=R0−RT(R_0-R_1)+(R_1-R_2)+\dots+(R_{T-1}-R_T)=R_0-R_T.

Symbol by symbol
ηG22\frac{\eta G^2}{2} summed TT timesηG2T2\frac{\eta G^2T}{2}
R0≤D2R_0\le D^2the starting-distance assumption
RT≥0R_T\ge0a squared distance; dropping −RT-R_T can only increase the right side
Bound the total, then divide by T
∑t=0T−1(f(xt)−f(x∗))≤D22η+ηG2T2⟹1T∑t=0T−1f(xt)−f(x∗)≤D22ηT+ηG22.\sum_{t=0}^{T-1}\big(f(x_t)-f(x^*)\big)\le\frac{D^2}{2\eta}+\frac{\eta G^2T}{2}\qquad\Longrightarrow\qquad\frac1T\sum_{t=0}^{T-1}f(x_t)-f(x^*)\le\frac{D^2}{2\eta T}+\frac{\eta G^2}{2}.

In wordsThe average value at the queried points is within the bound.

Step 3: average value → value at the average point (Jensen)
f(1T∑t=0T−1xt)  ≤  1T∑t=0T−1f(xt).f\Big(\frac1T\sum_{t=0}^{T-1}x_t\Big)\;\le\;\frac1T\sum_{t=0}^{T-1}f(x_t).

In wordsFor a convex function, the value at the average point is at most the average of the values. This is the many-point version of the chord inequality.

Why it is trueInduction on TT. For T=1T=1 it is trivial. For TT points: xˉT=T−1TxˉT−1+1TxT−1\bar x_T=\frac{T-1}{T}\bar x_{T-1}+\frac1Tx_{T-1}, a two-point blend with weights T−1T,1T\frac{T-1}T,\frac1T. Apply the chord inequality, then the induction hypothesis to f(xˉT−1)f(\bar x_{T-1}). The same induction shows the average of points in a convex set stays in the set (L12 exercise).

When you use itCombine with the previous display: f(xˉT)−f(x∗)≤D22ηT+ηG22f(\bar x_T)-f(x^*)\le\frac{D^2}{2\eta T}+\frac{\eta G^2}2. ∎

Unit 7.6 · Gradient descent

Choosing η: balance the two error terms

Sources: L12 §5.4 + exercises
Balancing
D22ηT=ηG22  ⟺  η2=D2G2T  ⟺  η=DGT,each term=DG2T,  sum=DGT.\frac{D^2}{2\eta T}=\frac{\eta G^2}{2}\iff\eta^2=\frac{D^2}{G^2T}\iff\eta=\frac{D}{G\sqrt T},\qquad\text{each term}=\frac{DG}{2\sqrt T},\ \ \text{sum}=\frac{DG}{\sqrt T}.

In wordsA tiny step barely overshoots but makes slow progress. A big step makes fast progress but overshoots a lot. The best constant step makes the two costs equal.

Why it is trueCalculus agrees: ddη(D22ηT+ηG22)=−D22η2T+G22=0\frac{d}{d\eta}\big(\frac{D^2}{2\eta T}+\frac{\eta G^2}2\big)=-\frac{D^2}{2\eta^2T}+\frac{G^2}2=0 at the same η\eta. The sum a/η+bηa/\eta+b\eta is minimized where its two terms are equal.

Iterations for accuracy ε
DGT≤ε  ⟺  T≥(DGε)2.\frac{DG}{\sqrt T}\le\eps\iff T\ge\Big(\frac{DG}{\eps}\Big)^2.

In wordsError decreases like 1/T1/\sqrt T: 10× more accuracy costs 100× more iterations.

L12 exercise: D=2, G=3, T=900D=2,\ G=3,\ T=900. Find the prescribed step size and the guaranteed additive error. How large must TT be for ε=0.1\eps=0.1?
Show answer
T=30\sqrt T=30. η=DGT=23⋅30=145≈0.0222\eta=\frac{D}{G\sqrt T}=\frac{2}{3\cdot30}=\frac1{45}\approx0.0222. Error ≤DGT=630=0.2\le\frac{DG}{\sqrt T}=\frac{6}{30}=0.2. Check: D22ηT=42⋅145⋅900=440=0.1\frac{D^2}{2\eta T}=\frac{4}{2\cdot\frac1{45}\cdot900}=\frac{4}{40}=0.1 and ηG22=990=0.1\frac{\eta G^2}2=\frac{9}{90}=0.1. For ε=0.1\eps=0.1: T≥(6/0.1)2=3600T\ge(6/0.1)^2=3600, with η=23⋅60=190\eta=\frac{2}{3\cdot60}=\frac1{90}.
Unit 7.7 · Gradient descent

Worked trajectories you should be able to reproduce

Sources: L12 §6 exercises; added least-squares example

Least squares in one variable

f(x)=52(x−1)2f(x)=\tfrac52(x-1)^2 (from A=b=(1,2)⊤A=b=(1,2)\T), f′(x)=5(x−1)f'(x)=5(x-1), x∗=1x^*=1. Start at x0=0x_0=0 with η=0.1\eta=0.1:

xt+1=xt−0.1⋅5(xt−1)=0.5xt+0.5.x_{t+1}=x_t-0.1\cdot5(x_t-1)=0.5x_t+0.5.
ttxtx_tgradient 5(xt−1)5(x_t-1)f(xt)f(x_t)Rt=(xt−1)2R_t=(x_t-1)^2
00−52.51
10.5−2.50.6250.25
20.75−1.250.156250.0625
30.875−0.6250.03906250.015625

For T=4T=4: xˉ4=(0+.5+.75+.875)/4=0.53125\bar x_4=(0+.5+.75+.875)/4=0.53125, and f(xˉ4)=2.5⋅0.468752≈0.5493f(\bar x_4)=2.5\cdot0.46875^2\approx0.5493. The average of the four values is 3.3203/4≈0.83013.3203/4\approx0.8301. Jensen says 0.5493≤0.83010.5493\le0.8301. ✓

The theorem with D=1D=1, G=5G=5 (valid along this trajectory, since ∣f′∣≤5|f'|\le5 there), η=0.1\eta=0.1, T=4T=4: 12⋅0.1⋅4+0.1⋅252=1.25+1.25=2.5\frac{1}{2\cdot0.1\cdot4}+\frac{0.1\cdot25}{2}=1.25+1.25=2.5. That is valid but loose: the actual error is about 0.55. The generic theorem ignores the extra quadratic structure.

L12 exercise: f(x)=x2/2f(x)=x^2/2, η=12\eta=\tfrac12. Check the potential directly

gt=xtg_t=x_t, x∗=0x^*=0, xt+1=xt/2x_{t+1}=x_t/2, Rt=xt2R_t=x_t^2. Exact expansion:

Rt+1=Rt−2⋅12⋅xt2+14xt2=Rt−Rt+14Rt=14Rt.R_{t+1}=R_t-2\cdot\tfrac12\cdot x_t^2+\tfrac14x_t^2=R_t-R_t+\tfrac14R_t=\tfrac14R_t.

Generic proof: the convexity step replaces the true error f(xt)−0=Rt/2f(x_t)-0=R_t/2 by the inner product ⟨gt,xt−x∗⟩=Rt\langle g_t,x_t-x^*\rangle=R_t, twice as large. Using only that inequality would give Rt+1≤Rt−2⋅12⋅Rt2+14Rt=34RtR_{t+1}\le R_t-2\cdot\tfrac12\cdot\tfrac{R_t}2+\tfrac14R_t=\tfrac34R_t instead of the exact 14Rt\tfrac14R_t.

Which inequalities in the general proof lose information specific to this quadratic?
Show answer
(1) The convexity inequality f(xt)−f(x∗)≤⟨gt,xt−x∗⟩f(x_t)-f(x^*)\le\langle g_t,x_t-x^*\rangle is off by a factor 2 here (Rt/2R_t/2 vs RtR_t). (2) Replacing ∥gt∥2=xt2\norm{g_t}^2=x_t^2, which shrinks geometrically, by a uniform G2G^2. (3) Dropping −RT≤0-R_T\le0. (4) Averaging: Jensen's f(xˉ)≤1T∑f(xt)f(\bar x)\le\frac1T\sum f(x_t) and averaging in the early, bad iterates. Together they turn a geometric rate (Rt=4−tR0R_t=4^{-t}R_0) into 1/T1/\sqrt T. With x0=2x_0=2: xt=2⋅2−tx_t=2\cdot2^{-t}, Rt=4⋅4−tR_t=4\cdot4^{-t}, error =2⋅4−t=2\cdot4^{-t}.
Unit 7.8 · Gradient descent

Scope, caveats, and what comes next

Sources: L12 §6

Additive, not multiplicative

The guarantee is f(x)−f(x∗)≤εf(x)-f(x^*)\le\eps. A ratio f(x)/f(x∗)f(x)/f(x^*) can be undefined (f(x∗)=0f(x^*)=0) or misleading (f(x∗)<0f(x^*)<0). The approximation algorithms of Chapter 9 do the opposite: for discrete problems with positive costs they guarantee a ratio, ALG≤α⋅OPT\text{ALG}\le\alpha\cdot\opt.

Count the work per iteration

The theorem counts gradient-oracle calls (TT). Total time also includes the cost of each gradient and the vector arithmetic. Dense least squares costs O(md)O(md) per gradient plus O(d)O(d) for the update and running average, so O(Tmd)O(Tmd) in total.

The bounds are real assumptions

Convexity alone gives neither DD nor GG. It is enough to bound gradients at the iterates actually visited, but that bound has to be justified for the problem and the step size (as on the shrinking least-squares trajectory above).

Nonsmooth functions: subgradients (brief extension)

Subgradient
g is a subgradient of f at x  ⟺  f(y)≥f(x)+⟨g,y−x⟩  ∀y.g \text{ is a subgradient of } f \text{ at } x\iff f(y)\ge f(x)+\langle g,y-x\rangle\ \ \forall y.

In wordsAny slope whose tangent line stays below the graph. At a kink there are many. Where ff is differentiable, the only one is ∇f(x)\nabla f(x).

Symbol by symbol
∣x∣|x| at x>0x>0g=1g=1
∣x∣|x| at x<0x<0g=−1g=-1
∣x∣|x| at x=0x=0any g∈[−1,1]g\in[-1,1]

When you use itReplace ∇f(xt)\nabla f(x_t) by any subgradient gtg_t with ∥gt∥≤G\norm{g_t}\le G. The proof only used the tangent inequality, so it goes through unchanged. A subgradient step may not decrease ff at every step, but the averaged guarantee still holds.

What comes next (L13 covers the first two: see Chapter 8)

IdeaWhy it is introducedTypical gain
ProjectionA gradient step may leave a constrained KK. Project back to the nearest point of KK. Projection does not increase the distance to x∗∈Kx^*\in K, so the analysis survives.constrained problems
Smoothness (gradient changes slowly)An upper bound on curvature allows larger, safer steps.O(1/T)O(1/T) instead of O(1/T)O(1/\sqrt T)
Strong convexity (curvature bounded below)A lower curvature bound gives extra progress for free; together with smoothness it forces geometric progress (as in x2/2x^2/2).O(log⁡T/T)O(\log T/T) with bounded gradients; geometric with smoothness
Unit 8.1 · Projections and smoothness (L13)

Lecture 13 in one page: two upgrades to gradient descent

Sources: Lec13_SecA pp.1, 7

Lecture 12 proved one guarantee: with convexity, a start-distance bound DD and a gradient bound GG, the average iterate is within DG/TDG/\sqrt T of optimal. Lecture 13 makes two upgrades to it.

Upgrade 1 · Constraints

A gradient step can "knock you out of the domain" KK. Project back to the nearest point of KK. This never moves you farther from x∗x^*, so the whole L12 proof still works.

Upgrade 2 · Speed

If the gradient changes slowly (β-smooth), a step of size 1/β1/\beta always decreases ff. Then the last iterate satisfies f(xT)−f∗≤βD2/(2T)f(x_T)-f^*\le\beta D^2/(2T), which is O(1/ε)O(1/\eps) steps instead of O(1/ε2)O(1/\eps^2).

The recap the lecture started from

The one identity behind every GD proof
Rt+1=Rt−2η ⟨∇f(xt), xt−x∗⟩+η2∥∇f(xt)∥2,Rt=∥xt−x∗∥2.R_{t+1}=R_t-2\eta\,\langle\nabla f(x_t),\,x_t-x^*\rangle+\eta^2\norm{\nabla f(x_t)}^2,\qquad R_t=\norm{x_t-x^*}^2.

In wordsNew squared distance to the optimum = old one − a "progress" term + an "overshoot" term. Both L13 results start from this line.

When you use itProjected GD: projecting only makes the left side smaller. Smooth GD: rearrange it as Rt−Rt+1=2η⟨⋅⟩−η2∥⋅∥2R_t-R_{t+1}=2\eta\langle\cdot\rangle-\eta^2\norm{\cdot}^2 and combine it with the descent lemma.

Where we end up (the board's closing table)

AssumptionsOutputStep sizeError after TT steps# steps for error ε\eps
convex, DD, GG (bounded gradients)average xˉT=1T∑t<Txt\bar x_T=\frac1T\sum_{t<T}x_tη=DGT\eta=\frac{D}{G\sqrt T}DGT\frac{DG}{\sqrt T}(DGε)2=O(ε−2)\big(\frac{DG}{\eps}\big)^2=O(\eps^{-2})
convex, DD, β\beta-smoothlast iterate xTx_Tη=1β\eta=\frac1\betaβD22T\frac{\beta D^2}{2T}βD22ε=O(ε−1)\frac{\beta D^2}{2\eps}=O(\eps^{-1})
Unit 8.2 · Projections and smoothness (L13)

Projection onto a convex set

Sources: Lec13_SecA pp.1–2

Constrained problem: min⁡x∈Kf(x)\min_{x\in K}f(x). A plain step xt−η∇f(xt)x_t-\eta\nabla f(x_t) may land outside KK. How do we recover? Move to the closest point of KK.

Definition: projection
ΠK(u)  =  arg⁡min⁡z∈K ∥u−z∥2\Pi_K(u)\;=\;\arg\min_{z\in K}\ \norm{u-z}^2

In wordsThe projection of uu onto KK is the point of KK nearest to uu. If uu is already in KK, it is uu itself.

Symbol by symbol
KKthe feasible set: convex and compact (closed and bounded) in the lecture. Closed + nonempty is enough for existence.
u∈Rdu\in\R^dany point, typically the unconstrained gradient step
ΠK(u)\Pi_K(u)the nearest point. It exists because KK is closed and is unique because KK is convex.
∥u−z∥2\norm{u-z}^2squared distance; same minimizer as the distance itself, but easier to differentiate

When you use itProjected gradient descent: xt+1=ΠK(xt−η∇f(xt))x_{t+1}=\Pi_K\big(x_t-\eta\nabla f(x_t)\big). The method is practical only when ΠK\Pi_K is easy to compute, as in the examples below.

Projections you can compute in one line

Box (the lecture example)
K=∏i=1d[ai,bi]⟹ΠK(u)i=min⁡{ bi, max⁡{ai,ui} }.K=\prod_{i=1}^{d}[a_i,b_i]\quad\Longrightarrow\quad \Pi_K(u)_i=\min\{\,b_i,\ \max\{a_i,u_i\}\,\}.

In wordsClip every coordinate into its interval independently: too small goes up to aia_i, too large comes down to bib_i, and in-range values stay put.

Symbol by symbol
∏i[ai,bi]\prod_i[a_i,b_i]the box {z:ai≤zi≤bi ∀i}\{z: a_i\le z_i\le b_i\ \forall i\} (a product of intervals)
max⁡{ai,ui}\max\{a_i,u_i\}push uiu_i up to at least aia_i
min⁡{bi,⋅}\min\{b_i,\cdot\}then pull it down to at most bib_i

Why it is true∥u−z∥2=∑i(ui−zi)2\norm{u-z}^2=\sum_i(u_i-z_i)^2 is a sum of separate 1-D terms, and each ziz_i has its own interval. So you minimize each term on its own, and the closest point of [ai,bi][a_i,b_i] to uiu_i is the clipped value.

Set KKΠK(u)\Pi_K(u)
box ∏[ai,bi]\prod[a_i,b_i]clip each coordinate
ball {z:∥z∥≤r}\{z:\norm z\le r\}uu if ∥u∥≤r\norm u\le r, else r u/∥u∥r\,u/\norm u (shrink radially)
halfspace {z:a⊤z≤d}\{z:a\T z\le d\}u−max⁡{0, a⊤u−d}∥a∥2 au-\frac{\max\{0,\,a\T u-d\}}{\norm a^2}\,a (move straight back along the normal)
nonnegative orthant {z≥0}\{z\ge0\}max⁡{0,ui}\max\{0,u_i\} coordinatewise (a box with bi=∞b_i=\infty)
Unit 8.3 · Projections and smoothness (L13)

The projection inequality: projecting brings you closer to everything in K

Sources: Lec13_SecA pp.2–3
Decoding
∥p−z∥2⏟projected point to z  +  ∥u−p∥2⏟how far we moved  ≤  ∥u−z∥2⏟original point to z\underbrace{\norm{p-z}^2}_{\text{projected point to }z}\;+\;\underbrace{\norm{u-p}^2}_{\text{how far we moved}}\;\le\;\underbrace{\norm{u-z}^2}_{\text{original point to }z}

In wordsThe distance from pp to zz is smaller than the distance from uu to zz, for every point zz of KK. In fact it is smaller by at least the length of the projection move. It reads like Pythagoras with "≤" because the angle at pp is at least 90°.

Symbol by symbol
uuthe point outside (or anywhere)
p=ΠK(u)p=\Pi_K(u)its nearest point in KK
zzany point of KK; in GD we take z=x∗z=x^*
second ≤\lejust drops −∥u−p∥2≤0-\norm{u-p}^2\le0

Proof (board version, with every step justified)

  1. Move from pp toward zz. For θ∈[0,1]\theta\in[0,1] the point p+θ(z−p)p+\theta(z-p) is in KK, since it lies on the segment between two points of the convex set. Define f(θ)=∥u−p−θ(z−p)∥2=squared distance from u to that point.f(\theta)=\norm{u-p-\theta(z-p)}^2=\text{squared distance from }u\text{ to that point}.
  2. It is minimized at θ=0\theta=0, because pp is the closest point of KK to uu. So moving right from 0 cannot decrease it: f′(0+)≥0f'(0^+)\ge0 (it is increasing).
  3. Differentiate: by the chain rule f′(θ)=2⟨u−p−θ(z−p), p−z⟩f'(\theta)=2\langle u-p-\theta(z-p),\ p-z\rangle. At θ=0\theta=0: ⟨u−p, p−z⟩  ≥  0⟺⟨u−p, z−p⟩≤0.\langle u-p,\ p-z\rangle\;\ge\;0\qquad\Longleftrightarrow\qquad\langle u-p,\ z-p\rangle\le0. This says the angle at pp between "back to uu" and "toward zz" is at least 90°.
  4. Expand (the trick: add and subtract pp): ∥u−z∥2=∥(u−p)+(p−z)∥2=∥u−p∥2+∥p−z∥2+2⟨u−p, p−z⟩  ≥  ∥u−p∥2+∥p−z∥2.\norm{u-z}^2=\norm{(u-p)+(p-z)}^2=\norm{u-p}^2+\norm{p-z}^2+2\langle u-p,\ p-z\rangle\;\ge\;\norm{u-p}^2+\norm{p-z}^2. The cross term is ≥ 0 by step 3. ∎
Unit 8.4 · Projections and smoothness (L13)

Projected gradient descent: "went out? just project!"

Sources: Lec13_SecA p.3
Projected gradient descent
yt+1=xt−η∇f(xt),xt+1=ΠK(yt+1).y_{t+1}=x_t-\eta\nabla f(x_t),\qquad x_{t+1}=\Pi_K(y_{t+1}).

In wordsTake the ordinary gradient step, which may leave KK, then snap back to the nearest feasible point.

Symbol by symbol
yt+1y_{t+1}the unconstrained step (the board calls it xt+1x_{t+1} before projecting)
xt+1∈Kx_{t+1}\in Kevery iterate is feasible
The one new line in the proof
Rt+1=∥ΠK(yt+1)−x∗∥2  ≤  ∥yt+1−x∗∥2=Rt−2η⟨∇f(xt),xt−x∗⟩+η2∥∇f(xt)∥2.R_{t+1}=\norm{\Pi_K(y_{t+1})-x^*}^2\;\le\;\norm{y_{t+1}-x^*}^2=R_t-2\eta\langle\nabla f(x_t),x_t-x^*\rangle+\eta^2\norm{\nabla f(x_t)}^2.

In wordsProjecting can only bring you closer to x∗x^*. So the potential after projecting is at most what the L12 calculation already bounded.

Symbol by symbol
≤\leprojection inequality with u=yt+1u=y_{t+1}, p=ΠK(yt+1)p=\Pi_K(y_{t+1}), z=x∗z=x^* (the board labels these p, u, z)
x∗∈Kx^*\in Krequired. Here x∗x^* is a minimizer over KK, so it is a legal zz.
equalitythe unconstrained expansion from L12, since yt+1−x∗=(xt−x∗)−η∇f(xt)y_{t+1}-x^*=(x_t-x^*)-\eta\nabla f(x_t)

Why everything else carries over: the convexity step ⟨∇f(xt),xt−x∗⟩≥f(xt)−f(x∗)\langle\nabla f(x_t),x_t-x^*\rangle\ge f(x_t)-f(x^*) holds for any xtx_t. Telescoping is unchanged. And the average of points of KK is in KK (convexity of KK, L12 exercise), so the output is feasible.

Unit 8.5 · Projections and smoothness (L13)

β-smoothness: the gradient cannot change too fast

Sources: Lec13_SecA pp.3–4
Definition: β-smooth
∥∇f(x)−∇f(y)∥  ≤  β ∥x−y∥∀x,y∈Rd.\norm{\nabla f(x)-\nabla f(y)}\;\le\;\beta\,\norm{x-y}\qquad\forall x,y\in\R^d.

In wordsThe gradient is β-Lipschitz: moving a distance rr changes the gradient by at most βr\beta r. The slope can't jump, and the curvature is at most β\beta.

Symbol by symbol
β>0\beta>0the smoothness constant, an upper bound on curvature
∥∇f(x)−∇f(y)∥\norm{\nabla f(x)-\nabla f(y)}how much the slope vector changes between two points

Why it is trueFor twice-differentiable ff this is equivalent to −βI⪯∇2f(x)⪯βI-\beta I\preceq\nabla^2 f(x)\preceq\beta I: every directional second derivative is between −β-\beta and β\beta. In 1-D, ∣f′′(x)∣≤β|f''(x)|\le\beta.

When you use itSmoothness is not about convexity but about how the gradient behaves: it is an upper curvature bound. Convexity is a lower one (curvature ≥ 0). The L13 theorem uses both.

ffβ-smooth?bounded gradient (G)?
12x2\tfrac12x^2yes, β=1\beta=1no on R\R (f′=xf'=x)
12x⊤Qx\tfrac12x\T Qx, Q⪰0Q\succeq0yes, β=λmax⁡(Q)\beta=\lambda_{\max}(Q)no on Rd\R^d
12∥Ax−b∥2\tfrac12\norm{Ax-b}^2yes, β=λmax⁡(A⊤A)\beta=\lambda_{\max}(A\T A)no on Rd\R^d
∣x∣|x|no: slope jumps from −1 to 1yes, G=1G=1
log⁡(1+ex)\log(1+e^x) (softplus)yes, β=14\beta=\tfrac14yes, G=1G=1
x4x^4no (f′′=12x2f''=12x^2 unbounded)no
Unit 8.6 · Projections and smoothness (L13)

The descent lemma: a quadratic ceiling (and what s is)

Sources: Lec13_SecA p.4
Decoding (★)
f(y)⏟true value  ≤  f(x)+⟨∇f(x),y−x⟩⏟tangent at x  +  β2∥y−x∥2⏟curvature allowance\underbrace{f(y)}_{\text{true value}}\;\le\;\underbrace{f(x)+\langle\nabla f(x),y-x\rangle}_{\text{tangent at }x}\;+\;\underbrace{\tfrac\beta2\norm{y-x}^2}_{\text{curvature allowance}}

In wordsThe function never rises above the tangent plus a bowl of curvature β\beta. It is a quadratic ceiling touching ff at xx.

Symbol by symbol
tangent partthe first-order Taylor prediction, as in L12
β2∥y−x∥2\frac\beta2\norm{y-x}^2the most the function can bend upward away from its tangent, given curvature ≤ β
no convexity neededthe descent lemma uses only β-smoothness

When you use itCombined with convexity (tangent = floor), smooth convex functions are sandwiched: f(x)+⟨∇f(x),y−x⟩≤f(y)≤f(x)+⟨∇f(x),y−x⟩+β2∥y−x∥2f(x)+\langle\nabla f(x),y-x\rangle\le f(y)\le f(x)+\langle\nabla f(x),y-x\rangle+\frac\beta2\norm{y-x}^2.

Proof, step by step

  1. Subtract the tangent term. ⟨∇f(x),y−x⟩\langle\nabla f(x),y-x\rangle is a constant, so it equals its own integral over [0,1][0,1]: f(y)−f(x)−⟨∇f(x),y−x⟩=∫01⟨∇f(x+s(y−x))−∇f(x), y−x⟩ ds.f(y)-f(x)-\langle\nabla f(x),y-x\rangle=\int_0^1\big\langle\nabla f(x+s(y-x))-\nabla f(x),\ y-x\big\rangle\,ds. The integrand compares the slope at the moving point with the slope at the start.
  2. Bound the integrand (the two factors explained): ⟨∇f(x+s(y−x))−∇f(x), y−x⟩  ≤C–S  ∥∇f(x+s(y−x))−∇f(x)∥⏟≤ β∥s(y−x)∥ = βs∥y−x∥⋅∥y−x∥⏟second factor.\big\langle\nabla f(x+s(y-x))-\nabla f(x),\ y-x\big\rangle\;\overset{\text{C–S}}{\le}\;\underbrace{\norm{\nabla f(x+s(y-x))-\nabla f(x)}}_{\le\ \beta\norm{s(y-x)}\ =\ \beta s\norm{y-x}}\cdot\underbrace{\norm{y-x}}_{\text{second factor}}.
    • First factor, βs∥y−x∥\beta s\norm{y-x}: the two points x+s(y−x)x+s(y-x) and xx are a distance ∥s(y−x)∥=s∥y−x∥\norm{s(y-x)}=s\norm{y-x} apart (s≥0s\ge0). β-smoothness says their gradients differ by at most β\beta times that distance.
    • Second factor, ∥y−x∥\norm{y-x}: this is the other vector in the inner product. Cauchy–Schwarz says ⟨a,b⟩≤∥a∥ ∥b∥\langle a,b\rangle\le\norm a\,\norm b, with a=a= gradient difference and b=y−xb=y-x.
  3. Integrate: ∫01βs∥y−x∥2 ds=β∥y−x∥2∫01s ds=β∥y−x∥2⋅12\displaystyle\int_0^1\beta s\norm{y-x}^2\,ds=\beta\norm{y-x}^2\int_0^1 s\,ds=\beta\norm{y-x}^2\cdot\tfrac12. ∎
Unit 8.7 · Projections and smoothness (L13)

The safe step η = 1/β: guaranteed decrease every time

Sources: Lec13_SecA pp.4–5

Put the gradient step into the descent lemma: x=xtx=x_t, y=xt+1=xt−η∇f(xt)y=x_{t+1}=x_t-\eta\nabla f(x_t), so y−x=−η∇f(xt)y-x=-\eta\nabla f(x_t). Write g=∇f(xt)g=\nabla f(x_t).

One step, any η
f(xt+1)  ≤  f(xt)+⟨g,−ηg⟩+β2∥ηg∥2  =  f(xt)−η(1−βη2)∥g∥2.f(x_{t+1})\;\le\;f(x_t)+\langle g,-\eta g\rangle+\frac\beta2\norm{\eta g}^2\;=\;f(x_t)-\eta\Big(1-\frac{\beta\eta}{2}\Big)\norm{g}^2.

In wordsThe tangent predicts a drop of η∥g∥2\eta\norm g^2. The curvature can eat back at most βη22∥g∥2\frac{\beta\eta^2}2\norm g^2. The net guaranteed drop is positive whenever 0<η<2/β0<\eta<2/\beta.

Symbol by symbol
⟨g,−ηg⟩=−η∥g∥2\langle g,-\eta g\rangle=-\eta\norm g^2the first-order decrease
β2η2∥g∥2\frac\beta2\eta^2\norm g^2the overshoot allowance
η(1−βη/2)\eta(1-\beta\eta/2)largest at η=1/β\eta=1/\beta, where it equals 12β\frac1{2\beta}
The safe step (board)
η=1β⟹f(xt+1)  ≤  f(xt)−1β∥g∥2+12β∥g∥2  =  f(xt)−12β∥∇f(xt)∥2.\eta=\frac1\beta\quad\Longrightarrow\quad f(x_{t+1})\;\le\;f(x_t)-\frac1\beta\norm{g}^2+\frac1{2\beta}\norm g^2\;=\;f(x_t)-\frac1{2\beta}\norm{\nabla f(x_t)}^2.

In wordsWith η=1/β\eta=1/\beta, every step lowers ff by at least ∥∇f∥2/(2β)\norm{\nabla f}^2/(2\beta). Steep spots give big guaranteed progress. Progress only stalls where the gradient is (nearly) zero.

Why it is truePicture: the step xt−1β∇f(xt)x_t-\frac1\beta\nabla f(x_t) is exactly the bottom of the quadratic ceiling (⋆)(\star). The function lies below the ceiling, and the ceiling's minimum is 12β∥g∥2\frac1{2\beta}\norm g^2 below f(xt)f(x_t).

When you use itMakes f(x0)≥f(x1)≥f(x2)≥…f(x_0)\ge f(x_1)\ge f(x_2)\ge\dots (monotone). That is why the smooth theorem can return the last iterate.

Unit 8.8 · Projections and smoothness (L13)

All combined: f(x_T) − f* ≤ βD²/(2T)

Sources: Lec13_SecA pp.5–7

Proof in four steps

Step 1: the distance identity with η = 1/β
Rt−Rt+1=2η⟨gt,xt−x∗⟩−η2∥gt∥2⟹η=1/ββ2 (Rt−Rt+1)=⟨gt,xt−x∗⟩−12β∥gt∥2.R_t-R_{t+1}=2\eta\langle g_t,x_t-x^*\rangle-\eta^2\norm{g_t}^2\quad\overset{\eta=1/\beta}{\Longrightarrow}\quad\frac\beta2\,(R_t-R_{t+1})=\langle g_t,x_t-x^*\rangle-\frac1{2\beta}\norm{g_t}^2.

In wordsRearrange the usual expansion and multiply by β/2\beta/2 (the board's boxed line).

Symbol by symbol
gt=∇f(xt)g_t=\nabla f(x_t)the gradient at the current point (not at x∗x^*)
Rt=∥xt−x∗∥2R_t=\norm{x_t-x^*}^2squared distance, as always
Step 2: descent lemma, then convexity
f(xt+1)−f(x∗)  ≤safe step  f(xt)−f(x∗)−12β∥gt∥2≤convexity  ⟨gt,xt−x∗⟩−12β∥gt∥2=Step 1  β2(Rt−Rt+1).\begin{aligned} f(x_{t+1})-f(x^*)\;&\overset{\text{safe step}}{\le}\;f(x_t)-f(x^*)-\frac1{2\beta}\norm{g_t}^2\\ &\overset{\text{convexity}}{\le}\;\langle g_t,x_t-x^*\rangle-\frac1{2\beta}\norm{g_t}^2\\ &\overset{\text{Step 1}}{=}\;\frac\beta2(R_t-R_{t+1}). \end{aligned}

In wordsThe error of the next point is paid for by the decrease in squared distance. Unlike L12, there is no leftover ηG2/2\eta G^2/2 penalty: smoothness cancelled it exactly.

Symbol by symbol
1st ≤\lesafe-step inequality with f(x∗)f(x^*) subtracted from both sides
2nd ≤\lethe L12 key inequality f(xt)−f(x∗)≤⟨gt,xt−x∗⟩f(x_t)-f(x^*)\le\langle g_t,x_t-x^*\rangle (red "using convexity!")
Step 3: add both sides (telescope)
∑t=0T−1(f(xt+1)−f(x∗))  ≤  β2 (R0−RT)  ≤  β2R0  ≤  βD22.\sum_{t=0}^{T-1}\big(f(x_{t+1})-f(x^*)\big)\;\le\;\frac\beta2\,(R_0-R_T)\;\le\;\frac\beta2R_0\;\le\;\frac{\beta D^2}{2}.
Symbol by symbol
telescoping∑t=0T−1(Rt−Rt+1)=R0−RT\sum_{t=0}^{T-1}(R_t-R_{t+1})=R_0-R_T
RT≥0R_T\ge0, R0≤D2R_0\le D^2as in L12
Step 4: the last term is the smallest
T⋅(f(xT)−f(x∗))  ≤  ∑t=1T(f(xt)−f(x∗))  ≤  βD22⟹f(xT)−f(x∗)≤βD22T.T\cdot\big(f(x_T)-f(x^*)\big)\;\le\;\sum_{t=1}^{T}\big(f(x_t)-f(x^*)\big)\;\le\;\frac{\beta D^2}{2}\quad\Longrightarrow\quad f(x_T)-f(x^*)\le\frac{\beta D^2}{2T}.

In words"The LHS is bigger than T⋅(f(xT)−f(x∗))T\cdot(f(x_T)-f(x^*))" (board, red). The sum has TT terms and the last one is the smallest, because the safe step makes f(x1)≥f(x2)≥⋯≥f(xT)f(x_1)\ge f(x_2)\ge\dots\ge f(x_T).

Why it is trueA sum of TT numbers is at least TT times its smallest number. This is the only place the monotone decrease is used, and it is what lets us return xTx_T instead of an average.

Unit 8.9 · Projections and smoothness (L13)

Comparing the two GD guarantees

Sources: Lec13_SecA p.7 (table)
Bounded gradients (L12)Smooth (L13)
Assumptionsconvex, ∥x0−x∗∥≤D\norm{x_0-x^*}\le D, ∥∇f(xt)∥≤G\norm{\nabla f(x_t)}\le Gconvex, ∥x0−x∗∥≤D\norm{x_0-x^*}\le D, β\beta-smooth
Step sizeη=D/(GT)\eta=D/(G\sqrt T) (needs TT in advance)η=1/β\eta=1/\beta (no TT needed)
Outputaverage xˉT\bar x_T (or best iterate)last iterate xTx_T
Error after TTDG/TDG/\sqrt TβD2/(2T)\beta D^2/(2T)
Steps for error ε\eps(DG/ε)2=O(ε−2)(DG/\eps)^2=O(\eps^{-2})βD2/(2ε)=O(ε−1)\beta D^2/(2\eps)=O(\eps^{-1})
Monotone decrease?no (e.g. ∣x∣|x| bounces)yes, by ≥∥∇f∥2/(2β)\ge\norm{\nabla f}^2/(2\beta) each step
Works with projection?yes (this chapter)yes, with a modified proof (not covered)
Typical example∣x∣|x|, hinge losses, max of affineleast squares, softplus/logistic losses
How big is the difference?
ε=0.01, D=2, G=3, β=3:(DGε)2=360,000vs.βD22ε=600.\eps=0.01,\ D=2,\ G=3,\ \beta=3:\qquad \Big(\frac{DG}{\eps}\Big)^2=360{,}000\quad\text{vs.}\quad\frac{\beta D^2}{2\eps}=600.

In wordsSquaring 1/ε1/\eps is very costly. 10× more accuracy costs 100× more steps without smoothness, but only 10× with it.

Unit 8.10 · Projections and smoothness (L13)

Strong convexity: curvature bounded below

Sources: L12 §6 preview; standard definition

Convexity says the graph is above its tangents. Strong convexity says it is above its tangents plus a bowl. That extra curvature is worth a lot: it forces a unique minimizer and speeds gradient descent up.

Definition: α-strongly convex
f(y)  ≥  f(x)+⟨∇f(x), y−x⟩+α2∥y−x∥2∀x,y,α>0.f(y)\;\ge\;f(x)+\langle\nabla f(x),\,y-x\rangle+\frac\alpha2\norm{y-x}^2\qquad\forall x,y,\qquad\alpha>0.

In wordsThe function lies above its tangent plus a parabola of curvature α\alpha: it curves upward at least as fast as α2∥⋅∥2\tfrac\alpha2\norm{\cdot}^2 in every direction.

Symbol by symbol
α>0\alpha>0the strong convexity constant, a lower bound on curvature
tangent partas in the first-order condition (unit 6.3); with α=0\alpha=0 this is plain convexity
α2∥y−x∥2\frac\alpha2\norm{y-x}^2the guaranteed extra height above the tangent

When you use itMirror image of the descent lemma (unit 8.6). A function that is both α-strongly convex and β-smooth is sandwiched between two parabolas: α2∥y−x∥2≤f(y)−f(x)−⟨∇f(x),y−x⟩≤β2∥y−x∥2\frac\alpha2\norm{y-x}^2\le f(y)-f(x)-\langle\nabla f(x),y-x\rangle\le\frac\beta2\norm{y-x}^2, so α≤β\alpha\le\beta.

Equivalent tests

  • Hessian: for twice-differentiable ff, α-strongly convex ⇔ ∇2f(x)⪰αI\nabla^2f(x)\succeq\alpha I for all xx, i.e. v⊤∇2f(x)v≥α∥v∥2v\T\nabla^2f(x)v\ge\alpha\norm v^2 (in 1-D: f′′≥αf''\ge\alpha).
  • Subtract the bowl: ff is α-strongly convex ⇔ f(x)−α2∥x∥2f(x)-\frac\alpha2\norm x^2 is convex.
  • Chord form: f(λx+(1−λ)y)≤λf(x)+(1−λ)f(y)−α2λ(1−λ)∥x−y∥2f(\lambda x+(1-\lambda)y)\le\lambda f(x)+(1-\lambda)f(y)-\frac\alpha2\lambda(1-\lambda)\norm{x-y}^2 (no differentiability needed).
ffstrongly convex?
12x2\tfrac12x^2yes, α=1\alpha=1
12x⊤Qx\tfrac12x\T Qx, Q≻0Q\succ0yes, α=λmin⁡(Q)\alpha=\lambda_{\min}(Q)
12∥Ax−b∥2\tfrac12\norm{Ax-b}^2yes with α=λmin⁡(A⊤A)\alpha=\lambda_{\min}(A\T A) if the columns of AA are independent; otherwise no
∣x∣|x|, any linear functionno (zero curvature)
exe^x on R\Rno: f′′=ex→0f''=e^x\to0 as x→−∞x\to-\infty
x4x^4no: f′′(0)=0f''(0)=0
convex gg + α2∥x∥2\tfrac\alpha2\norm x^2yes, α\alpha ("regularization")

Consequences you can use in proofs

Strengthened key inequality (put y = x*)
f(x)−f(x∗)  ≤  ⟨∇f(x), x−x∗⟩−α2∥x−x∗∥2.f(x)-f(x^*)\;\le\;\langle\nabla f(x),\,x-x^*\rangle-\frac\alpha2\norm{x-x^*}^2.

In wordsThe L12 inequality "error ≤ slope · displacement" gets an extra negative term proportional to the squared distance. In a gradient-descent analysis this term is extra progress for free.

Why it is trueDefinition with y=x∗y=x^*: f(x∗)≥f(x)+⟨∇f(x),x∗−x⟩+α2∥x∗−x∥2f(x^*)\ge f(x)+\langle\nabla f(x),x^*-x\rangle+\frac\alpha2\norm{x^*-x}^2. Rearrange.

Quadratic growth and uniqueness
f(x)−f(x∗)  ≥  α2∥x−x∗∥2(unconstrained minimizer x∗).f(x)-f(x^*)\;\ge\;\frac\alpha2\norm{x-x^*}^2\qquad(\text{unconstrained minimizer }x^*).

In wordsBeing far from the optimum in distance forces being far from it in value. In particular the minimizer is unique.

Why it is trueDefinition at the point x∗x^* with ∇f(x∗)=0\nabla f(x^*)=0: f(x)≥f(x∗)+0+α2∥x−x∗∥2f(x)\ge f(x^*)+0+\frac\alpha2\norm{x-x^*}^2.

When you use itTurns a bound on the objective error into a bound on the distance ∥x−x∗∥\norm{x-x^*}.

One step with a step size that changes over time
xt+1=xt−ηt∇f(xt)⟹Rt+1=Rt−2ηt⟨gt,xt−x∗⟩+ηt2∥gt∥2.x_{t+1}=x_t-\eta_t\nabla f(x_t)\quad\Longrightarrow\quad R_{t+1}=R_t-2\eta_t\langle g_t,x_t-x^*\rangle+\eta_t^2\norm{g_t}^2.

In wordsThe L12 expansion does not care whether η\eta is constant: it holds step by step with ηt\eta_t. Rearranged, ⟨gt,xt−x∗⟩=Rt−Rt+12ηt+ηt2∥gt∥2\langle g_t,x_t-x^*\rangle=\frac{R_t-R_{t+1}}{2\eta_t}+\frac{\eta_t}{2}\norm{g_t}^2.

When you use itWith a varying ηt\eta_t the terms Rt−Rt+12ηt\frac{R_t-R_{t+1}}{2\eta_t} no longer telescope directly. Use the strengthened inequality above together with "telescoping with changing weights" (unit 0.3), and bound sums such as ∑1t≤1+ln⁡T\sum\frac1t\le1+\ln T.

Unit 9.1 · Approximation algorithms (L14–L15)

Lectures 14–15 in one page: good answers with a proof of how good

Sources: L14 §1, §4; L15 §1; Lec14_SecB; Lec15_SecB; L14 and L15 recordings

Some discrete problems (vertex cover, facility location, edge-disjoint paths, TSP) have no known fast exact algorithm. Instead of giving up, we design a fast algorithm and prove that its answer is within a factor α\alpha of the optimum, even though we never compute the optimum.

LBlower bound we can compute(matching, LP value, counting) OPTunknown! ALGwhat we return α·LB LB ≤ OPT ≤ ALG ≤ α·LB ≤ α·OPT cost →
Minimization. We cannot see OPT, but we can see a lower bound LB. If ALG ≤ α·LB, then ALG ≤ α·OPT automatically.

The two lectures

L14 · Greedy + combinatorial lower bounds

Definitions (α-approximation, PTAS, FPTAS). Vertex cover: greedy by degree is an O(log⁡n)O(\log n)-approximation (proof by counting), and taking both endpoints of a maximal matching is a 2-approximation (proof: every cover is at least as large as every matching).

L15 · LP relaxation + deterministic rounding

Write the problem as an integer program, drop integrality, solve the LP, then round. Vertex cover: keep every vertex with xv∗≥12x^*_v\ge\frac12, a 2-approximation. The dual LP is fractional matching. Facility location: round using balls of radius 2Lj2L_j around clients (a 6-approximation).

Every result in this chapter

ProblemAlgorithmLower bound on OPT used in the proofFactorUnit
Vertex covergreedy: highest remaining degreeOPT vertices share the remaining edges (averaging)1+ln⁡m=O(log⁡n)1+\ln m=O(\log n)9.4
Vertex coverboth endpoints of a maximal matching MM∣M∣≤OPT\lvert M\rvert\le\opt29.5
Edge-disjoint paths (max)greedily route short paths (≤ m\sqrt m edges)charging + counting long pathsO(m)O(\sqrt m)9.6
Vertex cover (also weighted)LP, keep xv∗≥12x^*_v\ge\frac12OPTLP≤OPT\opt_{LP}\le\opt29.9
Covering with ≤ ff variables per constraintLP, keep x∗≥1fx^*\ge\frac1fOPTLP≤OPT\opt_{LP}\le\optff9.10
Metric facility locationLP, balls BjB_j, process clients by increasing LjL_jF∗+D∗≤OPTF^*+D^*\le\opt69.14, 9.15
Unit 9.2 · Approximation algorithms (L14–L15)

α-approximation, PTAS and FPTAS

Sources: L14 §1; Lec14_SecB pp.1–2; L14 recording

To compare an algorithm with the optimum we need a precise notion of "close". For discrete problems we measure closeness by a multiplicative factor.

Definition: α-approximation
minimization: A(I)≤α⋅OPT(I),maximization: A(I)≥OPT(I)α,α≥1.\text{minimization: } A(I)\le\alpha\cdot\opt(I),\qquad\qquad \text{maximization: } A(I)\ge\frac{\opt(I)}{\alpha},\qquad \alpha\ge1.

In wordsOn every input II, the algorithm returns a feasible solution whose cost is at most α\alpha times the best possible cost (for a minimization problem), or whose value is at least a 1/α1/\alpha fraction of the best value (for a maximization problem).

Symbol by symbol
IIan instance (one concrete input, e.g. one graph)
OPT(I)\opt(I)the optimal value for that instance. We never compute it. It only appears in the analysis.
A(I)A(I)the value of the solution the algorithm returns on II
α\alphathe approximation factor (ratio). α=1\alpha=1 means exact. Closer to 1 is better.

Why it is trueFor minimization every feasible solution costs at least OPT, so OPT≤A(I)≤αOPT\opt\le A(I)\le\alpha\opt forces α≥1\alpha\ge1. The answer lands in the interval [OPT, αOPT][\opt,\ \alpha\opt].

When you use itEvery theorem of this chapter has this form. To prove it you need a lower bound on OPT\opt that you can reason about, because OPT\opt itself is unknown.

impossible (below OPT) OPT α·OPT the algorithm's answer is somewhere here cost →
The picture from the board: a minimization problem. No feasible answer is below OPT. An α-approximation is guaranteed to land in the shaded interval.

Approximation schemes: as close to 1 as you want

PTAS and FPTAS
PTAS: for every fixed ε>0, Aε is a (1+ε)-approximation in time poly(n).FPTAS: time poly(n, 1/ε).\text{PTAS: for every fixed }\eps>0,\ A_\eps\text{ is a }(1+\eps)\text{-approximation in time poly}(n).\qquad \text{FPTAS: time poly}(n,\ 1/\eps).

In wordsA scheme is a family of algorithms, one for each accuracy ε\eps. A PTAS (polynomial-time approximation scheme) may pay any price in ε\eps, for example n1/εn^{1/\eps}. An FPTAS (fully polynomial) must keep the dependence on 1/ε1/\eps polynomial too.

Symbol by symbol
ε\epstarget accuracy. The answer is within a factor 1+ε1+\eps of OPT (for maximization, at least (1−ε)OPT(1-\eps)\opt)
AεA_\epsthe algorithm of the family that is tuned for accuracy ε\eps
poly(n)(n)polynomial in the input size nn when ε\eps is treated as a constant
poly(n,1/ε)(n,1/\eps)polynomial in both, e.g. n3/εn^3/\eps

When you use itKnapsack has an FPTAS (the scaling-and-rounding algorithm from earlier in the course). Halving ε\eps only doubles a 1/ε1/\eps factor in the running time.

Running time of AεA_\epsPTAS?FPTAS?Why
n2/εn^2/\epsyesyespolynomial in nn and 1/ε1/\eps
n3/ε5n^3/\eps^5yesyesstill polynomial in 1/ε1/\eps
n1/εn^{1/\eps}yesnofor fixed ε\eps it is a polynomial, but the degree grows with 1/ε1/\eps
21/ε n2^{1/\eps}\,nyesnoexponential in 1/ε1/\eps
2n2^nnononot polynomial in nn

A hierarchy of how well problems can be approximated

LevelExample from the course
solvable exactly in polynomial timeLP, max-flow, shortest paths
FPTAS: 1+ε1+\eps at polynomial priceknapsack
constant factorvertex cover (factor 2), metric facility location (factor 6 in L15)
factor growing slowly with the inputvertex cover by greedy degree: O(log⁡n)O(\log n)
factor growing polynomiallydirected edge-disjoint paths: O(m)O(\sqrt m)
no good factor at allgeneral TSP (no triangle inequality)
Q. An algorithm for a minimization problem returns cost at most OPT+5\opt+5 on every input. Is it an α-approximation for some constant α?
Show answer
Not necessarily. If OPT can be tiny (say OPT=1\opt=1), the ratio (OPT+5)/OPT=6(\opt+5)/\opt=6 is fine, but if OPT\opt can be arbitrarily close to 0 (with real costs) the ratio is unbounded. When costs are positive integers, OPT≥1\opt\ge1 and OPT+5≤6 OPT\opt+5\le6\,\opt, so it is a 6-approximation. Additive and multiplicative guarantees are different statements.
Q. Is "returns all of VV" an approximation algorithm for vertex cover?
Show answer
It is feasible and fast, but its ratio n/OPTn/\opt can be as large as nn (a star has OPT=1\opt=1). So it is only an nn-approximation. The interesting question is always how small α can be made.
Unit 9.3 · Approximation algorithms (L14–L15)

Vertex cover: the running example

Sources: L14 §2; Lec14_SecB p.2; L14 recording

Vertex cover is easy to state and draw, it is hard to solve exactly, and it shows both greedy and LP techniques. It is the main example of both lectures.

The problem
Input G=(V,E).Find S⊆V with u∈S or v∈S  for every edge {u,v}∈E,  minimizing ∣S∣.\text{Input } G=(V,E).\qquad\text{Find } S\subseteq V\text{ with } u\in S\text{ or }v\in S\ \text{ for every edge }\{u,v\}\in E,\ \text{ minimizing } \lvert S\rvert.

In wordsChoose as few vertices as possible so that every edge has at least one chosen endpoint. Think of guards at intersections who must watch every street: a guard at a corner watches all the streets touching it.

Symbol by symbol
SSthe chosen vertices (the cover)
"ee is covered"at least one endpoint of ee is in SS (both is allowed)
n=∣V∣, m=∣E∣n=\lvert V\rvert,\ m=\lvert E\rvertnumber of vertices, number of edges
OPT\optsize of a smallest cover (often written ∣S∗∣\lvert S^*\rvert)

Why it is trueS=VS=V always works, so a cover exists. The difficulty is making it small: no polynomial-time algorithm is known for the exact minimum (the problem is NP-hard).

GraphOPT\optWhy (an optimal cover, and why nothing smaller works)
a single edge1either endpoint
star with kk leaves1the center touches every edge
triangle2one vertex leaves the opposite edge uncovered
path with nn vertices⌊n/2⌋\lfloor n/2\rfloorevery second vertex; the ⌊n/2⌋\lfloor n/2\rfloor disjoint edges each need their own vertex
cycle with nn vertices⌈n/2⌉\lceil n/2\rceileach vertex covers 2 of the nn edges, so at least n/2n/2
complete graph KnK_nn−1n-1if two vertices are both missing, the edge between them is uncovered
complete bipartite Ka,bK_{a,b}min⁡(a,b)\min(a,b)one whole side; a matching of size min⁡(a,b)\min(a,b) shows nothing smaller works
Unit 9.4 · Approximation algorithms (L14–L15)

Greedy by degree: an O(log n)-approximation

Sources: L14 §2.1; Lec14_SecB pp.2–3; L14 recording

The natural greedy idea: repeatedly take the vertex that covers the most still-uncovered edges. It is not optimal, but we can prove it is never worse than about ln⁡m\ln m times optimal.

  1. S←∅S\gets\emptyset, E0←EE_0\gets E (the uncovered edges).
  2. While Et−1≠∅E_{t-1}\neq\emptyset: pick vtv_t with the largest degree in the remaining graph (V,Et−1)(V,E_{t-1}). Add it to SS. Remove every edge touching vtv_t: Et=Et−1∖{edges at vt}E_t=E_{t-1}\setminus\{\text{edges at }v_t\}.
  3. Return SS. It is a cover because the loop only stops when no edge is left uncovered.

The proof, one idea at a time

Fix an optimal cover S∗S^* with ∣S∗∣=OPT\lvert S^*\rvert=\opt. We never compute it. We only use the fact that it exists. Write ∣Et∣\lvert E_t\rvert for the number of uncovered edges after tt greedy steps.

Claim (the only real idea): the greedy vertex covers at least an OPT-th of what is left
deg⁡Et−1(vt)  ≥  ∣Et−1∣OPT.\deg_{E_{t-1}}(v_t)\;\ge\;\frac{\lvert E_{t-1}\rvert}{\opt}.

In wordsWhatever is left, the OPT\opt vertices of S∗S^* share the work of covering it. Someone in S∗S^* must do at least an average share. The greedy vertex does at least as much as anyone.

Symbol by symbol
deg⁡Et−1(v)\deg_{E_{t-1}}(v)number of remaining edges at vv (degree in the remaining graph)
∣Et−1∣\lvert E_{t-1}\rvertnumber of edges not yet covered before step tt
OPT=∣S∗∣\opt=\lvert S^*\rvertsize of an optimal cover of the original graph

Why it is trueS∗S^* covers every edge of EE, so in particular every edge of Et−1⊆EE_{t-1}\subseteq E. Each remaining edge has at least one endpoint in S∗S^*, so counting edges at the vertices of S∗S^* counts every remaining edge at least once: ∑c∈S∗deg⁡Et−1(c)≥∣Et−1∣\sum_{c\in S^*}\deg_{E_{t-1}}(c)\ge\lvert E_{t-1}\rvert. (Equality if no edge has both endpoints in S∗S^*; otherwise some edges are counted twice.) The largest term of a sum is at least the average: max⁡c∈S∗deg⁡Et−1(c)≥∣Et−1∣/OPT\max_{c\in S^*}\deg_{E_{t-1}}(c)\ge\lvert E_{t-1}\rvert/\opt. Greedy picks a vertex of maximum degree over all of VV, so deg⁡Et−1(vt)≥max⁡c∈S∗deg⁡Et−1(c)\deg_{E_{t-1}}(v_t)\ge\max_{c\in S^*}\deg_{E_{t-1}}(c).

Step 2: the number of uncovered edges shrinks by a constant factor
∣Et∣=∣Et−1∣−deg⁡Et−1(vt)  ≤  ∣Et−1∣−∣Et−1∣OPT=∣Et−1∣(1−1OPT).\lvert E_t\rvert=\lvert E_{t-1}\rvert-\deg_{E_{t-1}}(v_t)\;\le\;\lvert E_{t-1}\rvert-\frac{\lvert E_{t-1}\rvert}{\opt}=\lvert E_{t-1}\rvert\Big(1-\frac1\opt\Big).

In wordsEach step removes at least a 1OPT\frac1\opt fraction of the remaining edges, so at most a (1−1OPT)\big(1-\frac1\opt\big) fraction survives.

Why it is trueThe edges removed at step tt are exactly those at vtv_t, and there are deg⁡Et−1(vt)\deg_{E_{t-1}}(v_t) of them. Subtracting a larger number gives a smaller result, so the claim (a lower bound on the degree) becomes an upper bound on ∣Et∣\lvert E_t\rvert. The minus sign flips the inequality.

Step 3: unroll the recursion
∣Et∣≤(1−1OPT)∣Et−1∣≤(1−1OPT)2∣Et−2∣≤⋯≤m(1−1OPT)t≤m e−t/OPT.\lvert E_t\rvert\le\Big(1-\frac1\opt\Big)\lvert E_{t-1}\rvert\le\Big(1-\frac1\opt\Big)^2\lvert E_{t-2}\rvert\le\dots\le m\Big(1-\frac1\opt\Big)^t\le m\,e^{-t/\opt}.

In wordsA multiplicative shrink, repeated tt times, gives a power. The last step uses 1−x≤e−x1-x\le e^{-x}.

Symbol by symbol
m=∣E0∣m=\lvert E_0\rvertthe original number of edges
1−x≤e−x1-x\le e^{-x}true for every real xx. The line 1−x1-x is the tangent of the convex function e−xe^{-x} at x=0x=0, and a tangent is a floor (unit 6.3). Use x=1/OPTx=1/\opt and raise both (nonnegative) sides to the power tt.

Why it is trueThe lecture used the limit (1−1k)k→1e(1-\frac1k)^k\to\frac1e. The inequality 1−x≤e−x1-x\le e^{-x} gives the same conclusion exactly, without a limit.

Step 4: when must the algorithm stop?
t>OPT⋅ln⁡m  ⟹  ∣Et∣≤m e−t/OPT<m e−ln⁡m=1  ⟹  ∣Et∣=0.t>\opt\cdot\ln m\;\Longrightarrow\;\lvert E_t\rvert\le m\,e^{-t/\opt}<m\,e^{-\ln m}=1\;\Longrightarrow\;\lvert E_t\rvert=0.

In wordsOnce the bound drops below 1, the number of remaining edges, which is a whole number, must be 0.

Why it is true∣Et∣\lvert E_t\rvert counts edges, so it is an integer ≥0\ge0. An integer that is strictly less than 1 is 0. (The bound never says ∣Et∣=0\lvert E_t\rvert=0 directly, since me−t/OPTm e^{-t/\opt} is never 0. Integrality closes the gap.)

When you use itEach loop iteration adds exactly one vertex, so ∣S∣\lvert S\rvert = number of iterations. The loop runs at most ⌊OPTln⁡m⌋+1\lfloor\opt\ln m\rfloor+1 times.

Theorem (log approximation)
∣S∣  ≤  ⌊OPTln⁡m⌋+1  ≤  OPT (1+ln⁡m)  ≤  OPT (1+2ln⁡n)=O(log⁡n)⋅OPT.\lvert S\rvert\;\le\;\lfloor\opt\ln m\rfloor+1\;\le\;\opt\,(1+\ln m)\;\le\;\opt\,(1+2\ln n)=O(\log n)\cdot\opt.

In wordsThe approximation factor grows with the size of the graph, but only logarithmically: for a million vertices, 1+2ln⁡n≈291+2\ln n\approx29.

Symbol by symbol
⌊OPTln⁡m⌋+1≤OPT(1+ln⁡m)\lfloor\opt\ln m\rfloor+1\le\opt(1+\ln m)because OPT≥1\opt\ge1 whenever m≥1m\ge1
ln⁡m≤2ln⁡n\ln m\le2\ln na simple graph has m≤n(n−1)/2<n2m\le n(n-1)/2<n^2 edges
Unit 9.5 · Approximation algorithms (L14–L15)

Matchings: a lower bound and a 2-approximation

Sources: L14 §2.2; Lec14_SecB pp.3–4; L14 recording

Taking one vertex per step was too timid. Take an edge and add both endpoints. This sounds wasteful, but it gives a constant factor, because the chosen edges form a structure (a matching) that forces every cover to be large.

Definition: matching
M⊆E  is a matching   ⟺  no two edges of M share an endpoint.M\subseteq E\ \text{ is a matching }\iff\text{no two edges of }M\text{ share an endpoint.}

In wordsA set of edges that are pairwise disjoint: every vertex touches at most one of them.

Symbol by symbol
maximal matchingyou cannot add any edge to MM and keep it a matching (every edge of GG touches some edge of MM)
maximum matchinga matching of the largest possible size

Why it is trueEvery maximum matching is maximal, but not conversely. On the path a ⁣− ⁣b ⁣− ⁣c ⁣− ⁣da\!-\!b\!-\!c\!-\!d, {bc}\{bc\} is maximal (both other edges touch it) but {ab,cd}\{ab,cd\} is larger.

Claim: every matching is at most every vertex cover
∣M∣  ≤  ∣C∣for every matching M and every vertex cover C.In particular ∣M∣≤OPT.\lvert M\rvert\;\le\;\lvert C\rvert\qquad\text{for every matching }M\text{ and every vertex cover }C.\qquad\text{In particular }\lvert M\rvert\le\opt.

In wordsTo cover the edges of a matching, you need a separate vertex for each of them, since no vertex touches two of them.

Why it is trueCC covers every edge, in particular every edge of MM. Give each edge e∈Me\in M one endpoint of ee that lies in CC. Different matching edges have no common endpoint, so they get different vertices. This is a one-to-one map from MM into CC, so ∣M∣≤∣C∣\lvert M\rvert\le\lvert C\rvert.

When you use itAny matching you can find is a certificate that OPT is at least its size, exactly like a feasible dual solution certifies a bound on a primal LP.

The algorithm

The lecture first suggested a greedier version (pick the edge whose endpoints touch the most uncovered edges), then relaxed it: any uncovered edge works.

  1. C←∅C\gets\emptyset, E′←EE'\gets E.
  2. While E′≠∅E'\neq\emptyset: pick any {u,v}∈E′\{u,v\}\in E'. Add both uu and vv to CC. Remove from E′E' every edge touching uu or vv.
  3. Return CC. Equivalently: build a maximal matching MM (the picked edges) and return all endpoints of MM.
Theorem: the matching algorithm is a 2-approximation
∣C∣  =  2∣M∣  ≤  2 OPT.\lvert C\rvert\;=\;2\lvert M\rvert\;\le\;2\,\opt.
Symbol by symbol
MMthe edges the algorithm picked
∣C∣=2∣M∣\lvert C\rvert=2\lvert M\rverteach picked edge contributes two new vertices, and they are new because edges touching earlier picks were deleted
∣M∣≤OPT\lvert M\rvert\le\optthe claim above

Why it is trueM is a matching: after picking {u,v}\{u,v\} we delete every edge touching uu or vv, so no later pick shares an endpoint with it. C is a cover (feasibility): an edge is deleted from E′E' only when one of its endpoints is put in CC, and the loop ends only when E′E' is empty. (Equivalently, MM is maximal.) Ratio: ∣C∣=2∣M∣≤2OPT\lvert C\rvert=2\lvert M\rvert\le2\opt.

When you use itMaximality gives feasibility. Disjointness gives the lower bound. The algorithm never needs a maximum matching.

Q. Why is ∣C∣\lvert C\rvert exactly 2∣M∣2\lvert M\rvert, and not just at most?
Show answer
When an edge {u,v}\{u,v\} is picked, it is still in E′E', so neither uu nor vv is in CC yet (otherwise every edge at that vertex, including this one, would already have been deleted). So each pick adds two new vertices.
Q. Does the claim ∣M∣≤∣C∣\lvert M\rvert\le\lvert C\rvert need MM maximal or CC minimal?
Show answer
Neither. It holds for every matching and every cover. Maximality of MM is only needed to make the algorithm's output a cover.
Unit 9.6 · Approximation algorithms (L14–L15)

Edge-disjoint paths: greedy plus charging (posted L14 notes)

Sources: L14 notes §3 (posted version); L14 recording (problem posed at the end)

This is a maximization problem: route as many source–sink pairs as possible with paths that never share an edge.

The problem
directed G=(V,E),  m=∣E∣, pairs (s1,t1),…,(sk,tk):  max⁡ #{i: si connected to ti}  by edge-disjoint paths.\text{directed } G=(V,E),\ \ m=\lvert E\rvert,\ \text{pairs }(s_1,t_1),\dots,(s_k,t_k):\ \ \max\ \#\{i:\ s_i\text{ connected to }t_i\}\ \text{ by edge-disjoint paths.}

In wordsEach pair may get at most one directed path. Different chosen paths may share vertices but not edges. Maximize the number of connected pairs.

Why it is trueFor a single source and sink this is max-flow (polynomial). With many different pairs (a multicommodity problem) it becomes computationally hard.

  1. Let L=max⁡{1,⌊m⌋}L=\max\{1,\lfloor\sqrt m\rfloor\}.
  2. Repeatedly find an unrouted pair that still has a directed path with at most LL edges in the remaining graph (BFS finds shortest paths). Route it, delete its edges, and mark the pair as done.
  3. Stop when no such pair remains. Call the routed set AA. Also, if AA is empty, route any one pair that has some path (if any): this guarantees at least one path whenever OPT>0\opt>0.
greedy path P (≤ L edges) short optimal path Q (not routed by greedy) shared edge → charge Q to P long optimal paths: > L edges each
Short optimal paths are charged to greedy paths. Long optimal paths are few, because they are edge-disjoint and each uses more than LL edges.
Theorem: an O(√m)-approximation
OPT  ≤  (L+1) ∣A∣+mL+1  ≤  (2m+1)⋅a,a=number of paths returned (≥1 if OPT>0).\opt\;\le\;(L+1)\,\lvert A\rvert+\frac{m}{L+1}\;\le\;(2\sqrt m+1)\cdot a,\qquad a=\text{number of paths returned }(\ge1\text{ if }\opt>0).

In wordsFix an optimal solution OO and split its paths into short (≤ LL edges) and long (> LL edges). Short ones are charged to greedy paths, and each greedy path receives at most L+1L+1 charges. Long ones are few.

Why it is trueLong paths: they are edge-disjoint and each uses at least L+1L+1 edges, so there are at most m/(L+1)m/(L+1) of them. Short paths: take a short optimal path QQ for pair ii. If greedy routed pair ii, charge QQ to that greedy path. Otherwise QQ must share an edge with some greedy path, since if all its edges were still present at the end, greedy would have routed pair ii along QQ. Charge QQ to that path. Charges per greedy path PP: PP has at most LL edges, and each edge lies on at most one optimal path (they are edge-disjoint), so at most LL charges come through shared edges, plus at most one for the same pair. So ∣Oshort∣≤(L+1)∣A∣\lvert O_\text{short}\rvert\le(L+1)\lvert A\rvert. Arithmetic: with L=⌊m⌋L=\lfloor\sqrt m\rfloor we have L+1≤m+1L+1\le\sqrt m+1 and m/(L+1)<m/m=mm/(L+1)<m/\sqrt m=\sqrt m. Since a≥max⁡(∣A∣,1)a\ge\max(\lvert A\rvert,1), OPT≤(m+1)a+m a\opt\le(\sqrt m+1)a+\sqrt m\,a.

Unit 9.7 · Approximation algorithms (L14–L15)

From integer programs to LP relaxations

Sources: L15 §1; Lec15_SecB p.1; L15 recording

LPs can be solved in polynomial time, and they come with duality. Most discrete problems are naturally integer programs, and integer programming is hard. Lecture 15's plan: solve the LP version anyway, then repair the fractional answer.

Integer program and its relaxation
OPTIP=min⁡{c⊤x: Ax≥b, x≥0, x∈Zn}≥OPTLP=min⁡{c⊤x: Ax≥b, x≥0}.\opt_{IP}=\min\{c\T x:\ Ax\ge b,\ x\ge0,\ x\in\Z^n\}\qquad\ge\qquad\opt_{LP}=\min\{c\T x:\ Ax\ge b,\ x\ge0\}.

In wordsThe relaxation drops "xx must be integer". It has more feasible points, so its minimum can only be lower (or equal).

Symbol by symbol
x∈Znx\in\Z^nevery coordinate is an integer (the dots of the picture below)
relaxationthe same LP without the integrality constraint (the whole shaded region)
OPTLP≤OPTIP\opt_{LP}\le\opt_{IP}minimizing over a bigger set gives a smaller or equal value. For a maximization problem the inequality flips: OPTLP≥OPTIP\opt_{LP}\ge\opt_{IP}.

Why it is trueEvery integer feasible point is also LP feasible. So the LP minimum is at most the cost of the best integer point.

When you use itOPTLP\opt_{LP} is the lower bound we were looking for: we can compute it, and it is ≤OPT\le\opt.

The LP-rounding template

  1. Model the problem as an integer program (IP), usually with 0/1 variables "is this object chosen?". Check that IP solutions correspond to solutions of the problem with the same cost.
  2. Relax: drop integrality and keep 0≤x0\le x (and x≤1x\le1 if needed).
  3. Solve the LP in polynomial time: optimum x∗x^*, value OPTLP≤OPT\opt_{LP}\le\opt.
  4. Round x∗x^* to an integral x^\hat x. Prove two things: x^\hat x is feasible, and c⊤x^≤α c⊤x∗c\T\hat x\le\alpha\,c\T x^*.
Why the template proves an approximation factor
c⊤x^  ≤  α c⊤x∗  =  α OPTLP  ≤  α OPT.c\T\hat x\;\le\;\alpha\,c\T x^*\;=\;\alpha\,\opt_{LP}\;\le\;\alpha\,\opt.

In wordsThe rounding loses at most a factor α\alpha compared with the LP, and the LP is no worse than the true optimum.

Unit 9.8 · Approximation algorithms (L14–L15)

Vertex cover as an integer program

Sources: L15 §2; Lec15_SecB pp.1–2; L15 recording
The integer program
min⁡ ∑v∈Vxvs.t.xu+xv≥1  ∀{u,v}∈E,xv≥0,  xv∈Z.\min\ \sum_{v\in V}x_v\quad\text{s.t.}\quad x_u+x_v\ge1\ \ \forall\{u,v\}\in E,\qquad x_v\ge0,\ \ x_v\in\Z.

In wordsOne variable per vertex: xv=1x_v=1 means "vv is chosen". The objective counts chosen vertices. Each edge demands that at least one of its endpoints is chosen.

Symbol by symbol
xvx_v1 if v∈Sv\in S, 0 otherwise (the 0/1 modeling trick for "choose a subset")
∑vxv=1⊤x\sum_vx_v=\mathbf 1\T xthe size of the chosen set, a linear objective
xu+xv≥1x_u+x_v\ge1with 0/1 values, the two cannot both be 0, so the edge is covered
Claim 1: optimal solutions automatically have x ≤ 1
x∗ optimal (for the IP or the LP) ⟹ 0≤xv∗≤1  for every v.x^*\text{ optimal (for the IP or the LP)}\ \Longrightarrow\ 0\le x^*_v\le1\ \text{ for every }v.

In wordsThere is no reason to "choose a vertex 1.5 times". Lowering it to 1 keeps every edge satisfied and saves cost.

Why it is trueSuppose xv>1x_v>1. Replace it by 1. Every constraint containing xvx_v still holds, since 1+xu≥11+x_u\ge1 because xu≥0x_u\ge0. Constraints without xvx_v are unchanged. The objective strictly decreases. So a point with some xv>1x_v>1 is never optimal. With integrality this means x∗∈{0,1}Vx^*\in\{0,1\}^V, so we do not need to write x≤1x\le1.

Claim 2: the IP is exactly vertex cover
S a vertex cover ⟹ xvS={1v∈S0v∉S  is feasible with ∑vxvS=∣S∣;x∈{0,1}V feasible ⟹ {v:xv=1} is a cover.S\text{ a vertex cover}\ \Longrightarrow\ x^S_v=\begin{cases}1&v\in S\\0&v\notin S\end{cases}\ \text{ is feasible with }\sum_vx^S_v=\lvert S\rvert;\qquad x\in\{0,1\}^V\text{ feasible}\ \Longrightarrow\ \{v:x_v=1\}\text{ is a cover.}

Why it is trueFor an edge {u,v}\{u,v\}, "u∈Su\in S or v∈Sv\in S" is the same as "xu+xv≥1x_u+x_v\ge1" for 0/1 values. Both directions keep the cost equal, so the minimum of the IP equals the minimum cover size: OPTIP=OPT\opt_{IP}=\opt.

When you use itThis two-way correspondence is the same check as when modeling any problem as an LP (unit 1.2).

The LP relaxation
OPTLP=min⁡ ∑vxvs.t.xu+xv≥1  ∀{u,v}∈E,x≥0⟹OPTLP≤OPT.\opt_{LP}=\min\ \sum_vx_v\quad\text{s.t.}\quad x_u+x_v\ge1\ \ \forall\{u,v\}\in E,\quad x\ge0\qquad\Longrightarrow\qquad\opt_{LP}\le\opt.

In wordsNow a vertex may be chosen "halfway". By Claim 1, optimal LP solutions still lie in [0,1]V[0,1]^V.

GraphAn optimal LP solutionOPTLP\opt_{LP}OPT\optProof that the LP cannot do better
single edge uvuv(1,0)(1,0) or (12,12)(\frac12,\frac12)11the one constraint says xu+xv≥1x_u+x_v\ge1
triangleall 12\frac1232\frac322add the 3 edge constraints: 2∑x≥32\sum x\ge3
KnK_nall 12\frac12n2\frac n2n−1n-1add all edge constraints: (n−1)∑x≥(n2)(n-1)\sum x\ge\binom n2
star, kk leavescenter 1, leaves 011one edge constraint
Kn,nK_{n,n}one side 1, or everything 12\frac12nnnnadd the constraints of a perfect matching
Unit 9.9 · Approximation algorithms (L14–L15)

Threshold rounding: a 2-approximation from the LP

Sources: L15 §2; Lec15_SecB p.2; L15 recording
The rounding rule
x^v={1if xv∗≥120otherwiseC^={v: xv∗≥12}.\hat x_v=\begin{cases}1&\text{if }x^*_v\ge\frac12\\[2pt]0&\text{otherwise}\end{cases}\qquad\qquad\hat C=\{v:\ x^*_v\ge\tfrac12\}.

In wordsSolve the LP. Keep every vertex that the LP chose at least halfway. Throw away the rest.

Symbol by symbol
x∗x^*an optimal solution of the LP relaxation (computed in polynomial time)
x^\hat xthe rounded 0/1 vector; C^\hat C is the corresponding set of vertices
12\frac12the threshold. It comes from the constraints (two variables per constraint), not from "round to the nearest integer"
Lemma: the rounded set is a vertex cover
xu∗+xv∗≥1 ⟹ max⁡{xu∗,xv∗}≥12 ⟹ x^u=1  or  x^v=1.x^*_u+x^*_v\ge1\ \Longrightarrow\ \max\{x^*_u,x^*_v\}\ge\tfrac12\ \Longrightarrow\ \hat x_u=1\ \text{ or }\ \hat x_v=1.

In wordsTwo numbers that add up to at least 1 cannot both be below 12\frac12. The larger one is at least the average, so it survives the threshold.

Why it is true2max⁡{xu∗,xv∗}≥xu∗+xv∗≥12\max\{x^*_u,x^*_v\}\ge x^*_u+x^*_v\ge1. Equivalently, by contradiction: if edge uvuv were uncovered, then xu∗<12x^*_u<\frac12 and xv∗<12x^*_v<\frac12, so xu∗+xv∗<1x^*_u+x^*_v<1, contradicting LP feasibility.

Theorem: threshold rounding is a 2-approximation
∣C^∣=∑vx^v  ≤  ∑v2xv∗  =  2 OPTLP  ≤  2 OPT.\lvert\hat C\rvert=\sum_v\hat x_v\;\le\;\sum_v2x^*_v\;=\;2\,\opt_{LP}\;\le\;2\,\opt.

In wordsRounding at most doubles each variable, so it at most doubles the LP cost, and the LP cost is a lower bound on OPT.

Symbol by symbol
x^v≤2xv∗\hat x_v\le2x^*_vif x^v=1\hat x_v=1 then xv∗≥12x^*_v\ge\frac12, so 2xv∗≥12x^*_v\ge1. If x^v=0\hat x_v=0 then 2xv∗≥02x^*_v\ge0. True for every vv.
∑vxv∗=OPTLP\sum_vx^*_v=\opt_{LP}x∗x^* is an optimal LP solution
OPTLP≤OPT\opt_{LP}\le\optrelaxation (unit 9.7)

Why it is trueThe lecture wrote the same chain by splitting the sum: ∑v2xv∗=∑x^v=12xv∗+∑x^v=02xv∗≥∑x^v=11+0=∑vx^v\sum_v2x^*_v=\sum_{\hat x_v=1}2x^*_v+\sum_{\hat x_v=0}2x^*_v\ge\sum_{\hat x_v=1}1+0=\sum_v\hat x_v, and ∑v2xv∗≤2∣S∗∣\sum_v2x^*_v\le2\lvert S^*\rvert because xS∗x^{S^*} is LP-feasible.

When you use itRunning time: one LP solve plus one pass over the vertices.

Unit 9.10 · Approximation algorithms (L14–L15)

The same idea, one level up: weights and bigger constraints

Sources: L15 recording (averaging idea flagged for the exam); standard extensions

The instructor singled out the idea behind the last unit as good exam material: numbers that add up to something have a largest member at least as big as their average, so a threshold at the average keeps at least one of them. Here is how far it reaches.

The averaging principle
a1,…,ak≥0,a1+⋯+ak≥1⟹max⁡iai≥1k.a_1,\dots,a_k\ge0,\quad a_1+\dots+a_k\ge1\quad\Longrightarrow\quad\max_ia_i\ge\frac1k.

In wordsIf kk nonnegative numbers add up to at least 1, at least one of them is at least 1k\frac1k.

Why it is trueIf every ai<1ka_i<\frac1k, the sum would be <k⋅1k=1<k\cdot\frac1k=1.

When you use itPart 2 used it again and again: the greedy-degree claim (some OPT vertex has degree ≥ the average), the max-flow averaging argument (some threshold cut is at most the average cut, unit 4.4), the best response in a game (a weighted average is at least its minimum, unit 3.8), vertex cover rounding, and the facility-location proof (the cheapest facility is at most the average cost).

Extension 1: weighted vertex cover

Weights change nothing in the rounding proof
min⁡∑vwvxv  s.t. xu+xv≥1, x≥0⟹∑vwvx^v≤∑vwv 2xv∗=2 OPTLP≤2 OPT.\min\sum_vw_vx_v\ \text{ s.t. }x_u+x_v\ge1,\ x\ge0\qquad\Longrightarrow\qquad\sum_vw_v\hat x_v\le\sum_vw_v\,2x^*_v=2\,\opt_{LP}\le2\,\opt.

In wordsEach vertex has a cost wv≥0w_v\ge0, and we minimize the total cost of the cover. Same LP constraints, same threshold, same per-vertex inequality x^v≤2xv∗\hat x_v\le2x^*_v, now multiplied by wv≥0w_v\ge0.

Extension 2: constraints with up to f variables

f-approximation by rounding at 1/f
min⁡ c⊤x  s.t. ∑v∈Texv≥1  ∀e,  x≥0,∣Te∣≤f⟹x^v=1[xv∗≥1f]  is feasible and  c⊤x^≤f⋅OPT.\min\ c\T x\ \text{ s.t. }\sum_{v\in T_e}x_v\ge1\ \ \forall e,\ \ x\ge0,\quad\lvert T_e\rvert\le f\qquad\Longrightarrow\qquad\hat x_v=\mathbb 1\big[x^*_v\ge\tfrac1f\big]\ \text{ is feasible and }\ c\T\hat x\le f\cdot\opt.

In wordsA covering problem where every requirement ee can be satisfied by at most ff different objects (the set TeT_e). Keep every object the LP chose to an extent of at least 1f\frac1f.

Symbol by symbol
TeT_ethe objects able to satisfy requirement ee. Vertex cover: TeT_e is the 2 endpoints of edge ee, so f=2f=2.
ffthe largest ∣Te∣\lvert T_e\rvert (in set cover: the maximum number of sets containing one element, its "frequency")
c≥0c\ge0object costs

Why it is trueFeasible: the ≤f\le f values xv∗x^*_v, v∈Tev\in T_e, add up to at least 1, so by the averaging principle one of them is ≥1f\ge\frac1f and is kept. Cost: x^v≤f xv∗\hat x_v\le f\,x^*_v for every vv (if kept, fxv∗≥1fx^*_v\ge1), so c⊤x^≤f c⊤x∗=f OPTLP≤f OPTc\T\hat x\le f\,c\T x^*=f\,\opt_{LP}\le f\,\opt.

Unit 9.11 · Approximation algorithms (L14–L15)

The dual of the vertex cover LP is fractional matching

Sources: L15 §2; Lec15_SecB p.3; L15 recording

Lecture 14 used matchings as lower bounds. Lecture 15 used the LP. Duality shows they are the same idea: the dual of the vertex cover LP is a matching problem.

Primal (vertex cover LP) and its dual
(P) min⁡∑v∈Vxv  s.t. xu+xv≥1  ∀e={u,v}∈E,  x≥0(D) max⁡∑e∈Eye  s.t. ∑e∋vye≤1  ∀v∈V,  y≥0.\text{(P)}\ \min\sum_{v\in V}x_v\ \ \text{s.t. } x_u+x_v\ge1\ \ \forall e=\{u,v\}\in E,\ \ x\ge0\qquad\qquad\text{(D)}\ \max\sum_{e\in E}y_e\ \ \text{s.t. }\sum_{e\ni v}y_e\le1\ \ \forall v\in V,\ \ y\ge0.

In wordsOne dual variable yey_e per edge (each primal constraint is an edge). One dual constraint per vertex (each primal variable is a vertex): the edges at vv may carry total weight at most 1.

Symbol by symbol
yey_eweight on edge ee, the multiplier of the constraint xu+xv≥1x_u+x_v\ge1
e∋ve\ni vthe edges that have vv as an endpoint
∑e∋vye≤1\sum_{e\ni v}y_e\le1comes from column vv of the constraint matrix: xvx_v appears (with coefficient 1) exactly in the rows of the edges at vv

Why it is trueRules for a min primal (unit 3.5): ≥ rows give multipliers ye≥0y_e\ge0; variables xv≥0x_v\ge0 give "≤ cost" constraints, here cost 1; the objective of the dual is the right-hand sides, all 1. Certificate view: multiply each edge constraint by ye≥0y_e\ge0 and add: ∑eye(xu+xv)=∑vxv∑e∋vye≥∑eye\sum_ey_e(x_u+x_v)=\sum_vx_v\sum_{e\ni v}y_e\ge\sum_ey_e. If every ∑e∋vye≤1\sum_{e\ni v}y_e\le1, then ∑vxv≥∑vxv∑e∋vye\sum_vx_v\ge\sum_vx_v\sum_{e\ni v}y_e (because x≥0x\ge0), so ∑vxv≥∑eye\sum_vx_v\ge\sum_ey_e.

Primal constraint matrix (triangle a, b, c) abc ab110≥ 1 bc011≥ 1 ac101≥ 1 column a = the edges at a transpose Dual constraint matrix abbcac a101≤ 1 b110≤ 1 c011≤ 1 row a: y_ab + y_ac ≤ 1
The primal matrix is the edge–vertex incidence matrix. Each edge row has two 1s (its endpoints). Transposing gives one row per vertex, with a 1 for each edge at that vertex.
Integral dual solutions are exactly matchings
y∈{0,1}E  dual feasible  ⟺  M={e:ye=1} is a matching,value ∑eye=∣M∣.y\in\{0,1\}^E\ \text{ dual feasible}\iff M=\{e:y_e=1\}\text{ is a matching},\qquad\text{value }\sum_ey_e=\lvert M\rvert.

In words"Total weight at most 1 at every vertex" with 0/1 weights means "at most one chosen edge at every vertex", which is the definition of a matching. Fractional dual solutions are fractional matchings.

Why it is trueIf two chosen edges shared a vertex vv, the constraint at vv would read 1+1≤11+1\le1.

Everything in one chain
∣M∣  ≤  OPTD  =  OPTLP  ≤  OPT  ≤  ∣C^∣  ≤  2 OPTLP,OPT≤∣Cmatching alg∣=2∣M∣.\lvert M\rvert\;\le\;\opt_{D}\;=\;\opt_{LP}\;\le\;\opt\;\le\;\lvert\hat C\rvert\;\le\;2\,\opt_{LP},\qquad\opt\le\lvert C_{\text{matching alg}}\rvert=2\lvert M\rvert.

In wordsLecture 14's lower bound (a matching) is an integral dual solution. Lecture 15's lower bound (the LP optimum) is the best fractional one. Weak duality is what makes both of them lower bounds.

Symbol by symbol
∣M∣≤OPTD\lvert M\rvert\le\opt_Da matching is a feasible dual solution (integral)
OPTD=OPTLP\opt_D=\opt_{LP}strong duality (both LPs are feasible: x=1x=\mathbf 1, y=0y=0)
OPTLP≤OPT\opt_{LP}\le\optrelaxation
Unit 9.12 · Approximation algorithms (L14–L15)

Integrality gaps: how good can an LP lower bound be?

Sources: L15 §2 (integrality gap); Lec15 notes; standard facts
Definition (minimization problems)
integrality gap=sup⁡instances I OPTIP(I)OPTLP(I)  ≥  1.\text{integrality gap}=\sup_{\text{instances }I}\ \frac{\opt_{IP}(I)}{\opt_{LP}(I)}\;\ge\;1.

In wordsThe worst ratio between the true optimum and the LP lower bound, over all instances.

When you use itAny proof of the form "ALG ≤ α·OPTLP\opt_{LP}" must have α≥\alpha\ge the gap, since on the worst instance even OPT\opt itself is that far above OPTLP\opt_{LP}. The gap limits what this LP can certify, whatever rounding you use.

Vertex cover on the complete graph: the gap approaches 2
OPT(Kn)=n−1,OPTLP(Kn)=n2,n−1n/2=2−2n →n→∞ 2.\opt(K_n)=n-1,\qquad\opt_{LP}(K_n)=\frac n2,\qquad\frac{n-1}{n/2}=2-\frac2n\ \xrightarrow{n\to\infty}\ 2.

Why it is trueAll xv=12x_v=\frac12 is feasible, so OPTLP≤n2\opt_{LP}\le\frac n2. Adding all (n2)\binom n2 edge constraints, each vertex appears in n−1n-1 of them: (n−1)∑vxv≥n(n−1)2(n-1)\sum_vx_v\ge\frac{n(n-1)}2, so ∑vxv≥n2\sum_vx_v\ge\frac n2 for every feasible xx. The integral optimum is n−1n-1 (unit 9.3).

Q. The triangle has OPT=2\opt=2 and OPTLP=32\opt_{LP}=\frac32. What does this say about rounding?
Show answer
Every integral solution costs at least 2=43OPTLP2=\frac43\opt_{LP}, so any rounding of the LP loses at least a factor 43\frac43 on the triangle. Rounding cannot be lossless here, unlike max-flow/min-cut, where the rounding lost nothing (unit 4.5).
Unit 9.13 · Approximation algorithms (L14–L15)

Facility location: the model

Sources: L15 §3; Lec15_SecB pp.3–4; L15 recording

Facilities (say coffee shops) can be opened at a cost, and every client must be served by an open facility, paying a connection cost (think: distance). Open too few and clients travel far. Open too many and opening costs add up.

The problem
min⁡S⊆F, S≠∅  ∑i∈Sfi+∑j∈C min⁡i∈Sdij.\min_{S\subseteq F,\ S\neq\emptyset}\ \ \sum_{i\in S}f_i+\sum_{j\in C}\ \min_{i\in S}d_{ij}.

In wordsChoose which facilities to open. Each client then goes to its nearest open facility. Pay the opening costs plus every client's distance.

Symbol by symbol
F, CF,\ Ccandidate facilities, clients
fi≥0f_i\ge0cost of opening facility ii
dij≥0d_{ij}\ge0cost of serving client jj from facility ii (a distance)
metricdistances come from a metric on F∪CF\cup C, so the triangle inequality holds: d(a,c)≤d(a,b)+d(b,c)d(a,c)\le d(a,b)+d(b,c). The proof uses chains like client → facility → client → facility.

Why it is trueThe triangle inequality is a "physical" assumption: going through an intermediate point is never shorter than going directly. Without it, a facility could be close to two clients that are very far from each other, which breaks the geometric reasoning of the algorithm.

Integer program
min⁡ ∑i∈Ffixi+∑i∈F, j∈Cdijyijs.t.∑i∈Fyij=1  ∀j,yij≤xi  ∀i,j,xi,yij∈{0,1}.\min\ \sum_{i\in F}f_ix_i+\sum_{i\in F,\,j\in C}d_{ij}y_{ij}\quad\text{s.t.}\quad\sum_{i\in F}y_{ij}=1\ \ \forall j,\qquad y_{ij}\le x_i\ \ \forall i,j,\qquad x_i,y_{ij}\in\{0,1\}.

In wordsxi=1x_i=1: facility ii is open. yij=1y_{ij}=1: client jj is assigned to facility ii. Pay for open facilities and for each assignment.

Symbol by symbol
∑iyij=1\sum_iy_{ij}=1every client is assigned to exactly one facility
yij≤xiy_{ij}\le x_i"you cannot be assigned to a closed facility": if xi=0x_i=0 then yijy_{ij} is forced to 0. If xi=1x_i=1 the constraint allows yij∈{0,1}y_{ij}\in\{0,1\}.
{0,1}\{0,1\}dropped in the relaxation, replaced by x,y≥0x,y\ge0. Upper bounds of 1 are not needed: yij≤1y_{ij}\le1 follows from ∑iyij=1\sum_iy_{ij}=1, and any xix_i can be lowered to max⁡jyij≤1\max_jy_{ij}\le1 without breaking a constraint or increasing the cost.

Why it is trueThe constraint yij≤xiy_{ij}\le x_i is the contrapositive of "assigned ⇒ open". It is the standard way to link two families of 0/1 variables. Any choice of open facilities plus assignments gives a feasible 0/1 point with the same cost, and conversely, so the IP solves facility location.

The LP relaxation and the numbers it gives us
(x∗,y∗) optimal for the LP,F∗=∑ifixi∗,D∗=∑i,jdijyij∗,OPTLP=F∗+D∗≤OPT.(x^*,y^*)\text{ optimal for the LP},\qquad F^*=\sum_if_ix^*_i,\qquad D^*=\sum_{i,j}d_{ij}y^*_{ij},\qquad\opt_{LP}=F^*+D^*\le\opt.

In wordsIn the "fractional universe" facility ii is open to an extent xi∗x^*_i, and client jj spends a fraction yij∗y^*_{ij} of its time at facility ii, never more than the facility is open. F∗F^* is the fractional opening cost, and D∗D^* the fractional travel cost.

A client's fractional average distance
Lj=∑i∈Fdij yij∗,∑j∈CLj=D∗.L_j=\sum_{i\in F}d_{ij}\,y^*_{ij},\qquad\sum_{j\in C}L_j=D^*.

In wordsThe yij∗y^*_{ij} for a fixed client add up to 1, so LjL_j is a weighted average distance: how far client jj travels on average in the LP solution.

Unit 9.14 · Approximation algorithms (L14–L15)

Facility location rounding: balls around clients

Sources: L15 §3.1–3.2; Lec15_SecB pp.5–6; L15 recording

The rounding is geometric. Each client looks only at facilities within twice its LP average distance. Clients with small balls (tight budgets) choose first, and clients whose balls overlap an earlier ball share that earlier client's facility.

The ball of a client
Bj={i∈F: dij≤2Lj}.B_j=\{i\in F:\ d_{ij}\le2L_j\}.

In wordsAll candidate facilities within twice client jj's average LP distance.

Lemma (in Lec15_SecB): every ball contains at least half a facility
∑i∈Bjyij∗  ≥  12and therefore∑i∈Bjxi∗  ≥  12.\sum_{i\in B_j}y^*_{ij}\;\ge\;\tfrac12\qquad\text{and therefore}\qquad\sum_{i\in B_j}x^*_i\;\ge\;\tfrac12.

In wordsAt most half of a client's LP "time" can be spent at facilities more than twice its average distance away. This is Markov's inequality: a nonnegative quantity exceeds twice its average with probability at most one half.

Why it is trueFor i∉Bji\notin B_j we have dij>2Ljd_{ij}>2L_j, i.e. 1<dij2Lj1<\frac{d_{ij}}{2L_j}. Multiply by yij∗≥0y^*_{ij}\ge0 and add over those ii: ∑i∉Bjyij∗≤∑i∉Bjdij2Ljyij∗≤12Lj∑i∈Fdijyij∗=Lj2Lj=12\sum_{i\notin B_j}y^*_{ij}\le\sum_{i\notin B_j}\frac{d_{ij}}{2L_j}y^*_{ij}\le\frac1{2L_j}\sum_{i\in F}d_{ij}y^*_{ij}=\frac{L_j}{2L_j}=\frac12. Since ∑iyij∗=1\sum_iy^*_{ij}=1, the rest, ∑i∈Bjyij∗\sum_{i\in B_j}y^*_{ij}, is at least 12\frac12. Finally xi∗≥yij∗x^*_i\ge y^*_{ij} for each ii (the LP constraint), so ∑i∈Bjxi∗≥12\sum_{i\in B_j}x^*_i\ge\frac12. (If Lj=0L_j=0, all of client jj's LP mass sits at distance 0, inside BjB_j, and the sum is 1.)

When you use itTwo consequences: BjB_j is never empty, and opening the cheapest facility of BjB_j costs at most twice the fractional opening cost inside the ball (next unit).

The algorithm

  1. Sort the clients so that Lj1≤Lj2≤…L_{j_1}\le L_{j_2}\le\dots (small balls first). Set R=∅R=\emptyset (the "representatives", clients that open a facility) and S=∅S=\emptyset (open facilities).
  2. For each client jj in this order:
    • If Bj∩Br=∅B_j\cap B_r=\emptyset for every r∈Rr\in R: open the cheapest facility ij∈arg⁡min⁡i∈Bjfii_j\in\arg\min_{i\in B_j}f_i, add jj to RR, and assign jj to iji_j.
    • Otherwise pick some r∈Rr\in R with Bj∩Br≠∅B_j\cap B_r\neq\emptyset, and assign jj to iri_r, the facility opened for rr.
  3. Return the open facilities and the assignments. Several clients may share a facility.
Unit 9.15 · Approximation algorithms (L14–L15)

Why it is a 6-approximation (the proof promised for the next lecture)

Sources: Completes L15 §3 (stated, proof deferred in class); standard argument
Opening cost: at most 2F*
fir  ≤  ∑i∈Brfixi∗∑i∈Brxi∗  ≤  2∑i∈Brfixi∗⟹∑r∈Rfir≤2∑r∈R∑i∈Brfixi∗≤2F∗.f_{i_r}\;\le\;\frac{\sum_{i\in B_r}f_ix^*_i}{\sum_{i\in B_r}x^*_i}\;\le\;2\sum_{i\in B_r}f_ix^*_i\qquad\Longrightarrow\qquad\sum_{r\in R}f_{i_r}\le2\sum_{r\in R}\sum_{i\in B_r}f_ix^*_i\le2F^*.

In wordsThe cheapest facility in a ball costs at most the weighted average cost in that ball. The weights inside each representative's ball add up to at least 12\frac12, so the average costs at most twice the fractional cost spent in the ball. Representatives' balls are disjoint, so no fractional cost is counted twice.

Symbol by symbol
first ≤\lea minimum is at most any weighted average (the averaging principle, with weights xi∗x^*_i)
second ≤\lethe denominator is ≥12\ge\frac12 by the lemma
last ≤\lethe balls BrB_r, r∈Rr\in R, are disjoint, so the double sum counts each facility at most once, and ∑ifixi∗=F∗\sum_if_ix^*_i=F^*
Connection cost: every client pays at most 6 L_j
j∈R: d(j,ij)≤2Lj;j∉R: d(j,ir)≤d(j,i)+d(i,r)+d(r,ir)≤2Lj+2Lr+2Lr≤6Lj.j\in R:\ d(j,i_j)\le2L_j;\qquad j\notin R:\ d(j,i_r)\le d(j,i)+d(i,r)+d(r,i_r)\le2L_j+2L_r+2L_r\le6L_j.

In wordsA representative is served inside its own ball. Any other client walks to a shared facility i∈Bj∩Bri\in B_j\cap B_r, then to the representative rr, then to rr's open facility: three legs, each at most twice an average distance, and Lr≤LjL_r\le L_j.

Symbol by symbol
i∈Bj∩Bri\in B_j\cap B_rexists because the balls intersect. So d(j,i)≤2Ljd(j,i)\le2L_j and d(r,i)≤2Lrd(r,i)\le2L_r
d(r,ir)≤2Lrd(r,i_r)\le2L_rir∈Bri_r\in B_r
Lr≤LjL_r\le L_jrr was processed earlier (sorting)
triangle inequalityapplied twice along the path j→i→r→irj\to i\to r\to i_r
B_j (radius 2L_j) B_r (radius 2L_r ≤ 2L_j) j i r i_r (open) ≤ 2L_j ≤ 2L_r ≤ 2L_r d(j, i_r) ≤ 2L_j + 4L_r ≤ 6L_j
Why a non-representative client is never far from its facility.
Theorem: a 6-approximation
cost  ≤  2F∗+∑j6Lj  =  2F∗+6D∗  ≤  6 (F∗+D∗)  =  6 OPTLP  ≤  6 OPT.\text{cost}\;\le\;2F^*+\sum_j6L_j\;=\;2F^*+6D^*\;\le\;6\,(F^*+D^*)\;=\;6\,\opt_{LP}\;\le\;6\,\opt.

In wordsOpening costs lose a factor 2, connection costs lose a factor 6, so overall at most 6 times the LP lower bound.

Unit 9.16 · Approximation algorithms (L14–L15)

The approximation toolbox: patterns, proofs and traps

Sources: Synthesis of L14–L15

The proof skeleton (minimization)

  1. Feasibility. Why is the output a valid solution? (Loop stops only when everything is covered; the averaging principle keeps a variable in every constraint; every client gets an open facility.)
  2. A lower bound LB≤OPTLB\le\opt. Name it and prove it.
  3. Compare. Show ALG≤α⋅LB\text{ALG}\le\alpha\cdot LB, usually term by term.
  4. Chain. ALG≤α LB≤α OPT\text{ALG}\le\alpha\,LB\le\alpha\,\opt. For maximization, flip: an upper bound UB≥OPTUB\ge\opt and ALG≥UB/α\text{ALG}\ge UB/\alpha.

Where lower bounds come from

Lower boundWhy it is ≤ OPTUsed for
counting / averaging over an optimal solutionthe optimal solution must do the work, so one of its parts does an average sharegreedy degree (9.4), edge-disjoint paths (9.6)
a disjoint structure (matching)each disjoint piece needs its own element of any solutionmaximal matching (9.5)
LP relaxation valuethe LP minimizes over a larger setthreshold rounding (9.9, 9.10), facility location (9.14)
any feasible dual solutionweak dualitymatching = integral dual (9.11)

Proof moves to recognize

MoveFormulaWhere
largest ≥ average∑i=1kai≥1⇒max⁡iai≥1k\sum_{i=1}^ka_i\ge1\Rightarrow\max_ia_i\ge\frac1kgreedy claim, rounding feasibility
smallest ≤ weighted averagemin⁡ifi≤∑fixi∑xi\min_if_i\le\frac{\sum f_ix_i}{\sum x_i}cheapest facility in a ball
multiplicative shrinkat≤(1−1k)at−1⇒at≤a0e−t/ka_t\le(1-\frac1k)a_{t-1}\Rightarrow a_t\le a_0e^{-t/k}greedy degree
integer below 1 is 00≤at<1, at∈Z⇒at=00\le a_t<1,\ a_t\in\Z\Rightarrow a_t=0stopping time of greedy
per-variable rounding lossx^v≤1τxv∗\hat x_v\le\frac1\tau x^*_vany threshold rounding
Markovmass beyond c×c\times average ≤1c\le\frac1cfacility balls
chargingmap each optimal piece to an algorithm piece; bound the load per algorithm pieceedge-disjoint paths
balancing two lossesLL vs m/L⇒L=mm/L\Rightarrow L=\sqrt medge-disjoint paths (like choosing η)

Traps

  1. The ratio is for every instance, and the output must be feasible.
  2. Minimization: α≥1\alpha\ge1 and ALG ≤ α·OPT. Maximization: ALG ≥ OPT/α. Don't mix the directions of the bounds.
  3. For minimization the relaxation gives OPTLP≤OPT\opt_{LP}\le\opt (a lower bound). For maximization, OPTLP≥OPT\opt_{LP}\ge\opt.
  4. Degrees in greedy are in the remaining graph, and the proof uses the original optimal cover.
  5. Maximal ≠ maximum. The 2-approximation only needs maximal.
  6. ∣M∣≤∣C∣\lvert M\rvert\le\lvert C\rvert holds for every matching and every cover.
  7. A tight example for an algorithm is not a hardness result for the problem.
  8. Threshold above 12\frac12 can make the vertex cover rounding infeasible. With ff variables per constraint the threshold must be 1f\frac1f.
  9. The matching algorithm does not handle weights. LP rounding does.
  10. PTAS: polynomial for each fixed ε\eps (e.g. n1/εn^{1/\eps} is allowed). FPTAS: polynomial in 1/ε1/\eps too.
  11. Facility location: the 6 needs the triangle inequality and the processing order by LjL_j.
Unit 10.1 · Exam toolkit

Choose the argument before writing algebra

Sources: Synthesis of L9–L15
TaskArgument to useChecks to include
Model a problem as an LPvariables (with units) → objective → one constraint per rule → two-way correspondencereal vs integer; signs of variables; polynomial size
Prove a candidate is optimalfeasible xx + feasible yy + equal values (weak duality)check every row and sign of both
Write the dualone multiplier per row (sign from table/S-O-B) → one constraint per column → objective from RHSmax↔min, transpose, counts, equality↔free
Find / explain an optimal pointcomplementary slackness forces equations; solve; verify the restproducts are zero, not "exactly one factor"
Show an LP is infeasibleFarkas witness ww (or contradictory combination of rows)signs of the multipliers
Show an LP is unboundedfeasible x0x_0 + ray vv with Av≤0, v≥0, c⊤v>0Av\le0,\ v\ge0,\ c\T v>0stays feasible for all t≥0t\ge0
Max-flow = min-cutflow ≤ cut; rounding: cut ≤ dual; strong duality: dual = flowdirected edges; nonnegative lengths; clipped distances
Strong dualityif c∉c\notin cone of tight normals, Farkas ⇒ improving feasible direction ⇒ contradictioninclude −xi≤0-x_i\le0; one ε\eps for all slack rows; build y,zy,z
Prove a function is convexchord definition / tangent / Hessian PSD / composition rules (max, inf, sum, affine)domain convex; joint convexity for inf
Local = globalassume strictly better feasible yy → segment → arbitrarily close better pointsconvex ff and convex KK
Analyze gradient descentexpand Rt+1R_{t+1} → convexity + GG → telescope → R0≤D2, RT≥0R_0\le D^2,\ R_T\ge0 → Jensen → balance η\etawhich points are averaged; fixed η\eta; additive error
Analyze projected GDsame as L12, plus one line: ∥ΠK(y)−x∗∥2≤∥y−x∗∥2\norm{\Pi_K(y)-x^*}^2\le\norm{y-x^*}^2 (projection inequality with z=x∗z=x^*)x∗∈Kx^*\in K; KK convex; output average is in KK
Analyze smooth GDdescent lemma → safe step −12β∥g∥2-\frac1{2\beta}\norm{g}^2 → convexity → β2(Rt−Rt+1)\frac\beta2(R_t-R_{t+1}) → telescope → monotone ⇒ last iterateη=1/β\eta=1/\beta; no GG needed; index t+1t+1 on the left
Prove a projection/nearest-point factmove from pp toward z∈Kz\in K: f(θ)f(\theta) minimized at 0 ⇒ f′(0+)≥0f'(0^+)\ge0 ⇒ ⟨u−p,z−p⟩≤0\langle u-p,z-p\rangle\le0 ⇒ expand the squareuses convexity of KK (segment stays in KK)
Prove a lower bound for a min LPnonnegative combination of ≥ rows whose coefficients are ≤\le the costsx≥0x\ge0 is what lets you compare coefficients
Linearize an objective with ∣⋅∣|\cdot| or max/minnew variable per awkward term, bounded by linear inequalitiesonly in the convex direction (min of convex, max of concave)
Show one LP form expresses anothertransform → map feasible solutions both ways with equal value → recoverpolynomial size; signs of new variables
Derive a Farkas variantrewrite the system with slacks / split variables → apply the known version → read off each column blockslack columns ⇒ y≥0y\ge0; ±\pm columns ⇒ equality
Analyze a zero-sum gamebest responses are pure (linear over simplex) → max-min as an LP → dual is the other player's LPwhich variables are free; the simplex equality row
GD with strong convexity / varying ηt\eta_texpand Rt+1R_{t+1} with ηt\eta_t → strengthened key inequality → weighted telescoping → bound the sumcoefficients must line up; harmonic sum; Jensen
Prove an α-approximation (min)feasibility → name a lower bound LB≤OPTLB\le\opt → show ALG≤α LB\text{ALG}\le\alpha\,LBevery instance; polynomial time; direction of the ratio (max: ALG≥OPT/α\text{ALG}\ge\opt/\alpha)
Analyze a greedy that removes a share of what is left"OPT's pieces share the remaining work" → greedy step removes ≥1OPT\ge\frac1\opt of it → at≤a0(1−1OPT)t≤a0e−t/OPTa_t\le a_0(1-\frac1\opt)^t\le a_0e^{-t/\opt} → integer below 1 is 0degrees in the remaining instance; use the original optimum
Lower-bound OPT combinatoriallyfind disjoint structures (a matching): each needs its own element of any solution"every matching ≤ every cover"; maximal suffices for the algorithm
Design and analyze LP roundingIP with 0/1 variables (check both directions) → relax → OPTLP≤OPT\opt_{LP}\le\opt → rounding rule → feasibility (largest ≥ average) → per-variable loss x^v≤αxv∗\hat x_v\le\alpha x^*_v → chainthreshold =1f=\frac1f for ff variables per constraint; costs ≥0\ge0
Dual of a covering LPone multiplier per covering row, one ≤-cost row per variable (transpose the incidence matrix); integral dual = packing (matching)weak duality ⇒ any dual solution is a lower bound
Show a factor cannot be improvedtight example for the algorithm (single edge, Kn,nK_{n,n}); integrality gap for the LP (KnK_n)tight algorithm ≠ hard problem

How to write a contradiction proof (used three times in Part 2)

  1. State what you assume fails (e.g. "x^\hat x is not a global min", "cc is not in the cone").
  2. Produce a witness of the failure: a better point yy, or a Farkas vector ww.
  3. Use the witness to build an object the hypotheses forbid: a better point arbitrarily close to x^\hat x, or a better feasible point x∗+εvx^*+\eps v.

The sentence that keeps proofs honest

After every inequality write "this uses ___". In Part 2 the blank is almost always one of: nonnegative multipliers, x≥0x\ge0, coordinatewise feasibility, the tangent (first-order convexity) inequality, the chord inequality, Cauchy–Schwarz, ∥g∥≤G\norm{g}\le G, R0≤D2R_0\le D^2, RT≥0R_T\ge0, or "a square is ≥ 0". If you cannot fill it in, check the direction of the inequality.

Unit 10.2 · Exam toolkit

The traps, all in one place

Sources: Collected from every chapter
  1. Feasible ≠ optimal. A feasible point gives only a lower bound (for max).
  2. Vector inequalities are coordinatewise.
  3. Negative coefficients are allowed in an LP. Products of variables are not. Strict inequalities are not allowed.
  4. "Unbounded" refers to the objective, not the region.
  5. Vertex = nn independent tight constraints, counting sign constraints. Not "nn tight constraints".
  6. Some optimal solution is a vertex. Not every one, and not necessarily a unique one.
  7. Short answer ≠ fast algorithm (Cramer). Polynomial in bit length, not in magnitudes (knapsack is pseudo-polynomial).
  8. Dual constraints come from columns (transpose).
  9. Don't use the max-primal sign table on a min primal. Use S-O-B.
  10. Equality ↔ free.
  11. Weak duality alone proves a matching feasible pair optimal.
  12. Primal infeasible does not imply dual unbounded (both can be infeasible).
  13. Complementary slackness: "tight ⇒ positive multiplier" is false. The product is zero.
  14. Verify feasibility after using slackness to generate a candidate.
  15. Gap bounds are additive.
  16. Path LP is exponential. Don't propose enumerating paths as an algorithm.
  17. Only edges leaving SS count in a directed cut.
  18. Two integrality facts: 0/1 optimal dual (any real capacities) vs integral flow (integer capacities).
  19. Dijkstra needs nonnegative lengths.
  20. Farkas sign orientation: w=−vw=-v. Generators score ≥ 0, pp scores < 0, and ww is free in sign.
  21. Cone weights are ≥ 0, not > 0. Conclusions are v⊤aj≤0v\T a_j\le0, not < 0.
  22. Include −xi≤0-x_i\le0 normals in the active-constraint argument.
  23. Convex set ≠ convex function. Local ⇒ global needs both.
  24. Tangent is a floor: f(x)−f(x∗)≤⟨∇f(x),x−x∗⟩f(x)-f(x^*)\le\langle\nabla f(x),x-x^*\rangle (≤, not ≥).
  25. PSD ≠ nonnegative entries.
  26. Min of convex functions is not convex. Max is. Partial minimization needs joint convexity.
  27. Boundary optimum ⇒ gradient need not be 0.
  28. Convex ≠ unique minimizer, and convex ≠ a minimizer exists.
  29. Multiplying an inequality by −2η-2\eta flips it.
  30. GD theorem bounds the average of x0..xT−1x_0..x_{T-1} (or the best iterate), not the last iterate.
  31. DD and GG are assumptions, not consequences of convexity.
  32. η=D/(GT)\eta=D/(G\sqrt T) is constant for a fixed horizon, not ηt∝1/t\eta_t\propto1/\sqrt t.
  33. TT iterations ≠ O(T)O(T) time. Multiply by the cost of a gradient.
  34. Telescoping requires Rt−Rt+1R_t-R_{t+1}, not Rt−Rt−1R_t-R_{t-1}.
  35. Projection needs a convex KK and x∗∈Kx^*\in K (a minimizer over KK, not over Rd\R^d).
  36. β-smooth is not convex (sin⁡x\sin x is 1-smooth). Smoothness bounds curvature from above, convexity from below.
  37. Bounded gradient and smooth are different: x2/2x^2/2 is smooth but has unbounded gradient; ∣x∣|x| has G=1G=1 but is not smooth.
  38. Last iterate is only guaranteed in the smooth theorem, because the safe step makes f(xt)f(x_t) monotone.
  39. Rates: bounded gradients need O(ε−2)O(\eps^{-2}) steps; smooth needs O(ε−1)O(\eps^{-1}). Not O(ε−1)O(\sqrt{\eps^{-1}}).
  40. Safe step is η=1/β\eta=1/\beta; any η<2/β\eta<2/\beta still decreases ff, and η>2/β\eta>2/\beta can diverge.
  41. Min-LP certificates flip everything: y≥0y\ge0 on ≥ rows and combined coefficients ≤c\le c give a lower bound.
  42. Linearization tricks only work in the convex direction. You cannot maximize ∣x∣|x| with an LP.
  43. Intersections of convex sets are convex; unions need not be.
  44. Products and differences of convex functions need not be convex; sums with nonnegative weights and maxima are.
  45. Farkas variants differ in the certificate's sign: free for equality systems, ≥0\ge0 for inequality systems; A⊤y=0A\T y=0 when xx is free.
  46. p⊤Aqp\T Aq is not jointly linear in (p,q)(p,q). Fix one player, then the best response is a pure strategy.
  47. Strong convexity + a global gradient bound can only hold on a bounded region or at the visited iterates.
  48. Approximation ratios are multiplicative and hold for every instance; the output must always be feasible.
  49. Min: ALG ≤ α·OPT with α ≥ 1. Max: ALG ≥ OPT/α. The relaxation is a lower bound for min (OPTLP≤OPT\opt_{LP}\le\opt) and an upper bound for max.
  50. Greedy degree: degrees are in the remaining graph, and the proof uses the original optimal cover.
  51. Maximal ≠ maximum. The 2-approximation needs only a maximal matching; ∣M∣≤∣C∣\lvert M\rvert\le\lvert C\rvert holds for every matching and every cover.
  52. Rounding threshold: above 12\frac12 the vertex cover rounding can be infeasible; with ff variables per constraint use 1f\frac1f. Nearest-integer rounding is not feasible in general.
  53. The matching algorithm ignores weights; LP rounding handles weighted vertex cover.
  54. Tight example ≠ integrality gap ≠ hardness. They limit one algorithm, one LP, and all algorithms respectively.
  55. PTAS allows n1/εn^{1/\eps}; FPTAS must be polynomial in 1/ε1/\eps too.
  56. Facility location's 6 needs the triangle inequality, balls of radius 2Lj2L_j, and processing clients by increasing LjL_j. Balls are sets of facilities.
Unit 10.3 · Exam toolkit

Formula sheet, decoded

Sources: All lectures
FormulaIn wordsValid when
max⁡c⊤x, Ax≤b, x≥0\max c\T x,\ Ax\le b,\ x\ge0canonical primalany LP after conversion
min⁡b⊤y, A⊤y≥c, y≥0\min b\T y,\ A\T y\ge c,\ y\ge0its dual: cheapest valid row weightscanonical primal
c⊤x≤x⊤A⊤y=y⊤Ax≤b⊤yc\T x\le x\T A\T y=y\T Ax\le b\T yweak duality chainxx, yy both feasible
max⁡c⊤x=min⁡b⊤y\max c\T x=\min b\T ystrong dualityeither side has a finite optimum
b⊤y−c⊤x=y⊤s+x⊤rb\T y-c\T x=y\T s+x\T rgap = priced leftovers + losses on produced itemsfeasible pair; s=b−Ax, r=A⊤y−cs=b-Ax,\ r=A\T y-c
yjsj=0, xiri=0y_j s_j=0,\ x_ir_i=0complementary slacknessiff both optimal
OPT−c⊤x≤b⊤y−c⊤x\opt-c\T x\le b\T y-c\T xgap bounds the errorfeasible pair
rank of tight normals =n=nvertex testinclude sign rows
xi=det⁡Bi/det⁡Bx_i=\det B_i/\det BCramer: vertices have short encodingsBB nonsingular
Mλ=p,λ≥0M\lambda=p,\lambda\ge0 XOR M⊤w≥0,p⊤w<0M\T w\ge0,p\T w<0Farkas: in the cone, or a witnessany real M,pM,p
v⊤p>v⊤q≥v⊤z ∀z∈Cv\T p>v\T q\ge v\T z\ \forall z\in Cseparation, v=p−qv=p-q, qq nearestCC closed, convex, nonempty; p∉Cp\notin C
c=∑r∈Sλrar=A⊤y−zc=\sum_{r\in S}\lambda_ra_r=A\T y-zobjective in cone of tight normals → dualat an optimum x∗x^*
max⁡∑pxp:∑p∋exp≤ce\max\sum_px_p:\sum_{p\ni e}x_p\le c_epath-flow LPx≥0x\ge0
min⁡∑eceye:∑e∈pye≥1\min\sum_ec_ey_e:\sum_{e\in p}y_e\ge1length dualy≥0y\ge0
ℓ(v)=min⁡{d(v),1}, Sr={ℓ≤r}\ell(v)=\min\{d(v),1\},\ S_r=\{\ell\le r\}threshold roundingr∈(0,1)r\in(0,1)
∫01c(δ+(Sr))dr≤∑ceye\int_0^1c(\delta^+(S_r))dr\le\sum c_ey_eaverage cut ≤ fractional costfeasible lengths
f(θx+(1−θ)y)≤θf(x)+(1−θ)f(y)f(\theta x+(1-\theta)y)\le\theta f(x)+(1-\theta)f(y)convex: below chordsx,y∈Kx,y\in K, θ∈[0,1]\theta\in[0,1]
f(y)≥f(x)+⟨∇f(x),y−x⟩f(y)\ge f(x)+\langle\nabla f(x),y-x\rangletangent is a global floorff differentiable convex
f(x)−f(x∗)≤⟨∇f(x),x−x∗⟩f(x)-f(x^*)\le\langle\nabla f(x),x-x^*\rangleerror ≤ slope · displacementsame
v⊤∇2f(x)v≥0v\T\nabla^2f(x)v\ge0Hessian PSD ⇔ convexf∈C2f\in C^2
max⁡ifi\max_if_i, inf⁡y∈Yf(x,y)\inf_{y\in Y}f(x,y)convexity-preserving operationsfif_i convex; ff jointly convex, YY convex
∇12∥Ax−b∥2=A⊤(Ax−b)\nabla\tfrac12\norm{Ax-b}^2=A\T(Ax-b), Hessian A⊤AA\T Aleast squaresalways
⟨v,w⟩≥−∥v∥∥w∥\langle v,w\rangle\ge-\norm v\norm wCauchy–Schwarz ⇒ −∇f-\nabla f steepestalways
xt+1=xt−η∇f(xt)x_{t+1}=x_t-\eta\nabla f(x_t)gradient descentK=RdK=\R^d
Rt+1=Rt−2η⟨gt,xt−x∗⟩+η2∥gt∥2R_{t+1}=R_t-2\eta\langle g_t,x_t-x^*\rangle+\eta^2\norm{g_t}^2one-step expansionalways (algebra)
f(xt)−f∗≤Rt−Rt+12η+ηG22f(x_t)-f^*\le\frac{R_t-R_{t+1}}{2\eta}+\frac{\eta G^2}2one-step inequalityconvex, ∥gt∥≤G\norm{g_t}\le G
f(xˉT)−f∗≤D22ηT+ηG22f(\bar x_T)-f^*\le\frac{D^2}{2\eta T}+\frac{\eta G^2}2GD theoremconvex, minimizer, DD, GG, fixed η\eta
η=DGT⇒≤DGT\eta=\frac{D}{G\sqrt T}\Rightarrow\le\frac{DG}{\sqrt T}; T≥(DG/ε)2T\ge(DG/\eps)^2balanced step; iteration countsame
ΠK(u)=arg⁡min⁡z∈K∥u−z∥2\Pi_K(u)=\arg\min_{z\in K}\norm{u-z}^2projection = nearest pointKK convex, closed
box: ΠK(u)i=min⁡{bi,max⁡{ai,ui}}\Pi_K(u)_i=\min\{b_i,\max\{a_i,u_i\}\}clip each coordinateK=∏[ai,bi]K=\prod[a_i,b_i]
∥p−z∥2≤∥u−z∥2−∥u−p∥2\norm{p-z}^2\le\norm{u-z}^2-\norm{u-p}^2projecting brings you closer to all of KKp=ΠK(u)p=\Pi_K(u), z∈Kz\in K, KK convex
xt+1=ΠK(xt−η∇f(xt))x_{t+1}=\Pi_K(x_t-\eta\nabla f(x_t))projected GD; same DG/TDG/\sqrt T boundx∗∈Kx^*\in K
∥∇f(x)−∇f(y)∥≤β∥x−y∥\norm{\nabla f(x)-\nabla f(y)}\le\beta\norm{x-y}β-smooth (gradient β-Lipschitz)⇔ ∣f′′∣≤β|f''|\le\beta in 1-D
f(y)≤f(x)+⟨∇f(x),y−x⟩+β2∥y−x∥2f(y)\le f(x)+\langle\nabla f(x),y-x\rangle+\frac\beta2\norm{y-x}^2descent lemma: quadratic ceilingβ-smooth (no convexity needed)
f(xt+1)≤f(xt)−12β∥∇f(xt)∥2f(x_{t+1})\le f(x_t)-\frac1{2\beta}\norm{\nabla f(x_t)}^2safe step η=1/β\eta=1/\betaβ-smooth
f(xT)−f∗≤βD22Tf(x_T)-f^*\le\frac{\beta D^2}{2T}; T≥βD22εT\ge\frac{\beta D^2}{2\eps}smooth GD theorem, last iterateconvex, β-smooth, DD, η=1/β\eta=1/\beta
y≥0, A⊤y≤c⇒c⊤x≥b⊤yy\ge0,\ A\T y\le c\Rightarrow c\T x\ge b\T ylower-bound certificate for min⁡c⊤x, Ax≥b, x≥0\min c\T x,\ Ax\ge b,\ x\ge0xx feasible
min⁡∣e∣⇝min⁡t, t≥±e\min|e|\leadsto\min t,\ t\ge\pm e; min⁡max⁡iei⇝min⁡t, t≥ei\min\max_ie_i\leadsto\min t,\ t\ge e_ilinearization tricksminimizing convex piecewise-linear objectives
Ax≤bAx\le b infeasible ⇔ ∃y≥0: A⊤y=0, b⊤y<0\exists y\ge0:\ A\T y=0,\ b\T y<0Farkas (inequality form)xx free
Ax≤b, x≥0Ax\le b,\ x\ge0 infeasible ⇔ ∃y≥0: A⊤y≥0, b⊤y<0\exists y\ge0:\ A\T y\ge0,\ b\T y<0Farkas (canonical form)always
min⁡q∈Δnc⊤q=min⁡jcj\min_{q\in\Delta_n}c\T q=\min_jc_jbest response is pureΔn\Delta_n = probability simplex
max⁡pmin⁡qp⊤Aq≤min⁡qmax⁡pp⊤Aq\max_p\min_qp\T Aq\le\min_q\max_pp\T Aq (equality by duality)weak / strong minimaxmixed strategies
f(y)≥f(x)+⟨∇f(x),y−x⟩+α2∥y−x∥2f(y)\ge f(x)+\langle\nabla f(x),y-x\rangle+\frac\alpha2\norm{y-x}^2α-strongly convex⇔ ∇2f⪰αI\nabla^2f\succeq\alpha I
f(x)−f∗≤⟨∇f(x),x−x∗⟩−α2∥x−x∗∥2f(x)-f^*\le\langle\nabla f(x),x-x^*\rangle-\frac\alpha2\norm{x-x^*}^2strengthened key inequalityα-strongly convex
∑t=1T1t≤1+ln⁡T\sum_{t=1}^T\frac1t\le1+\ln Tharmonic sumalways
A(I)≤αOPT(I)A(I)\le\alpha\opt(I) (min), A(I)≥OPT(I)/αA(I)\ge\opt(I)/\alpha (max)α-approximationevery instance, feasible output, poly time
PTAS: (1+ε)(1+\eps), poly(n)(n) per fixed ε\eps; FPTAS: poly(n,1/ε)(n,1/\eps)approximation schemesa family AεA_\eps
deg⁡Et−1(vt)≥∣Et−1∣/OPT\deg_{E_{t-1}}(v_t)\ge\lvert E_{t-1}\rvert/\optgreedy picks at least an OPT-th of what is leftmax-degree greedy for vertex cover
∣Et∣≤m(1−1OPT)t≤me−t/OPT\lvert E_t\rvert\le m(1-\frac1\opt)^t\le me^{-t/\opt}multiplicative shrink, 1−x≤e−x1-x\le e^{-x}⇒ ∣S∣≤OPT(1+ln⁡m)\lvert S\rvert\le\opt(1+\ln m)
∣M∣≤∣C∣\lvert M\rvert\le\lvert C\rvert; ∣Calg∣=2∣M∣≤2OPT\lvert C_{alg}\rvert=2\lvert M\rvert\le2\optmatching lower bound; 2-approximationMM any matching, CC any cover; MM maximal for the algorithm
OPT≤(L+1)∣A∣+mL+1≤(2m+1)a\opt\le(L+1)\lvert A\rvert+\frac m{L+1}\le(2\sqrt m+1)aedge-disjoint paths, short/long splitL=⌊m⌋L=\lfloor\sqrt m\rfloor
OPTLP≤OPTIP\opt_{LP}\le\opt_{IP}relaxation is a lower boundminimization
min⁡∑xv, xu+xv≥1, x≥0\min\sum x_v,\ x_u+x_v\ge1,\ x\ge0vertex cover LPoptimal x∈[0,1]Vx\in[0,1]^V
x^v=1[xv∗≥12]≤2xv∗\hat x_v=\mathbb 1[x^*_v\ge\frac12]\le2x^*_vthreshold rounding ⇒ ∣C^∣≤2OPTLP≤2OPT\lvert\hat C\rvert\le2\opt_{LP}\le2\optalso weighted (w≥0w\ge0)
∑i=1kai≥1⇒max⁡iai≥1k\sum_{i=1}^ka_i\ge1\Rightarrow\max_ia_i\ge\frac1kaveraging principle ⇒ threshold 1f\frac1f gives an ff-approximationai≥0a_i\ge0; ≤f\le f variables per covering row
max⁡∑eye, ∑e∋vye≤1, y≥0\max\sum_ey_e,\ \sum_{e\ni v}y_e\le1,\ y\ge0dual of the vertex cover LP = fractional matchingintegral yy = matching
OPT(Kn)/OPTLP(Kn)=n−1n/2→2\opt(K_n)/\opt_{LP}(K_n)=\frac{n-1}{n/2}\to2integrality gap of the vertex cover LPall xv=12x_v=\frac12
min⁡∑fixi+∑dijyij, ∑iyij=1, yij≤xi\min\sum f_ix_i+\sum d_{ij}y_{ij},\ \sum_iy_{ij}=1,\ y_{ij}\le x_ifacility location LP; F∗+D∗≤OPTF^*+D^*\le\optx,y≥0x,y\ge0
Lj=∑idijyij∗L_j=\sum_id_{ij}y^*_{ij}, Bj={i:dij≤2Lj}B_j=\{i:d_{ij}\le2L_j\}, ∑i∈Bjxi∗≥12\sum_{i\in B_j}x^*_i\ge\frac12average distance, ball, Markovany feasible LP solution
cost≤2F∗+6D∗≤6OPT\text{cost}\le2F^*+6D^*\le6\optfacility location roundingmetric distances; clients by increasing LjL_j
Unit 10.4 · Exam toolkit

Practice A: LP models, geometry, duality

Sources: L9–L10 exercises + added questions

Try each one before opening the answer. Questions marked ★ are new practice beyond the lecture exercises.

A1. Which are plain LP constraints/objectives: 3u−2v≥73u-2v\ge7; uv≤5uv\le5; objective u2+v2u^2+v^2; vv free; u∈{0,1}u\in\{0,1\}; u<2u<2?
Show answer
3u−2v≥73u-2v\ge7: yes (flip to ≤). uv≤5uv\le5: no (product). u2+v2u^2+v^2: no (quadratic, though convex). vv free: yes, via v=v+−v−v=v^+-v^-. u∈{0,1}u\in\{0,1\}: no (integer program). u<2u<2: no (strict; the optimum might not be attained).
A2. Convert min⁡(2u−v)\min(2u-v) s.t. u−v=3, u≥0, vu-v=3,\ u\ge0,\ v free to canonical form and solve.
Show answer
See unit 1.5: max⁡−2u+v+−v−\max -2u+v^+-v^- s.t. u−v++v−≤3, −u+v+−v−≤−3u-v^++v^-\le3,\ -u+v^+-v^-\le-3, all variables ≥ 0. Optimum u=0, v=−3u=0,\ v=-3, original min value 3.
A3. For max⁡2x1+3x2\max2x_1+3x_2 with x1+x2≤5, x1≥1, x2≥0x_1+x_2\le5,\ x_1\ge1,\ x_2\ge0: list the vertices, two independent tight constraints at each, and the optimum. What changes for objective x1+x2x_1+x_2?
Show answer
(1,0)(1,0): x1=1, x2=0x_1=1,\ x_2=0, value 2. (5,0)(5,0): x1+x2=5, x2=0x_1+x_2=5,\ x_2=0, value 10. (1,4)(1,4): x1=1, x1+x2=5x_1=1,\ x_1+x_2=5, value 14 (optimum). For x1+x2x_1+x_2 the whole edge (1,4)(1,4)–(5,0)(5,0) is optimal with value 5. Two optimal vertices, infinitely many optimal points.
A4. Prove: with box bounds 0≤xi≤10\le x_i\le1 and kk other inequalities, any vertex has at most kk fractional coordinates.
Show answer
See unit 2.6: rank count n≤(n−q)+kn\le(n-q)+k.
A5. Write A,b,cA,b,c and the dual of the smoothie LP. Verify x=(3,3,0), y=(5,0,2)x=(3,3,0),\ y=(5,0,2). Explain the unused banana and the missing smoothie 3 with complementary slackness.
Show answer
See unit 3.3 and 3.6. Both have value 27. Bananas are slack, so yB=0y_B=0. Smoothie 3's dual row is slack (7>67>6), so x3=0x_3=0.
A6. Verify y=(3,1,2)y=(3,1,2) for the smoothie dual. What additive error guarantee does it give for x=(3,3,0)x=(3,3,0)?
Show answer
Feasible (5≥5, 5≥4, 6≥6), value 31. Gap 31−27=431-27=4, so xx is within 4 of optimal, using this pair alone.
A7. Dual of max⁡2u+v\max2u+v s.t. u+v≤4, u−v=1, u≥0, vu+v\le4,\ u-v=1,\ u\ge0,\ v free, and a matching pair.
Show answer
min⁡4α+β\min4\alpha+\beta s.t. α+β≥2, α−β=1, α≥0, β\alpha+\beta\ge2,\ \alpha-\beta=1,\ \alpha\ge0,\ \beta free. Pair: (u,v)=(2.5,1.5)(u,v)=(2.5,1.5), (α,β)=(1.5,0.5)(\alpha,\beta)=(1.5,0.5), value 6.5.
A8. Give an LP with a unique optimum and a tight primal row whose multiplier is 0 in an optimal dual. Why is this consistent with complementary slackness?
Show answer
max⁡x1\max x_1 s.t. x1≤1, x2≤0, x≥0x_1\le1,\ x_2\le0,\ x\ge0. Optimum (1,0)(1,0). Row 2 is tight, and the dual optimum y=(1,0)y=(1,0) gives it multiplier 0. The product 0⋅0=00\cdot0=0 is fine. Slackness only forbids both factors being positive.
A9 ★. Write the dual of min⁡2x1+3x2+x3\min2x_1+3x_2+x_3 s.t. x1+x2+x3≥6, x1−x3=1, x1,x2≥0, x3≤0x_1+x_2+x_3\ge6,\ x_1-x_3=1,\ x_1,x_2\ge0,\ x_3\le0. Solve both and check complementary slackness.
Show answer

Dual (max, by S-O-B): max⁡6y1+y2\max6y_1+y_2 s.t. y1+y2≤2y_1+y_2\le2 (col x1x_1, sensible), y1≤3y_1\le3 (col x2x_2), y1−y2≥1y_1-y_2\ge1 (col x3≤0x_3\le0, bizarre → ≥ in a max), y1≥0y_1\ge0 (≥ row in a min, sensible), y2y_2 free.

Primal: x1=1+x3x_1=1+x_3 with x3∈[−1,0]x_3\in[-1,0]. Row 1: x2≥5−2x3x_2\ge5-2x_3. Cost ≥17−3x3\ge17-3x_3, minimized at x3=0x_3=0: x=(1,5,0)x=(1,5,0), value 17. Dual: y=(3,−1)y=(3,-1): 3−1=2≤23-1=2\le2, 3≤33\le3, 3+1=4≥13+1=4\ge1. Value 18−1=1718-1=17. ✓ Slackness: x1,x2>0x_1,x_2>0 and their dual rows are tight. ✓

A10 ★. max⁡3x1+2x2\max3x_1+2x_2 s.t. x1+x2≤4, x1+3x2≤6, x1≤3, x≥0x_1+x_2\le4,\ x_1+3x_2\le6,\ x_1\le3,\ x\ge0. Someone claims x=(3,1)x=(3,1) is optimal. Use complementary slackness to find a certificate.
Show answer
All three rows are tight at (3,1)(3,1) (4, 6, 3), value 11. x1,x2>0x_1,x_2>0 force the dual rows tight: y1+y2+y3=3y_1+y_2+y_3=3, y1+3y2=2y_1+3y_2=2. This is degenerate (more tight rows than needed), so try y2=0y_2=0: y1=2, y3=1y_1=2,\ y_3=1, all ≥ 0. Dual value 4⋅2+6⋅0+3⋅1=114\cdot2+6\cdot0+3\cdot1=11. Matches, so (3,1)(3,1) is optimal. (y3=0y_3=0 would force y2=−12<0y_2=-\tfrac12<0, which is infeasible. With degeneracy, try another choice.)
A11 ★. True or false? (a) Primal infeasible ⇒ dual unbounded. (b) If both primal and dual are feasible, both have optimal solutions with equal value. (c) Every optimal solution of an LP is a vertex. (d) If some optimal y∗y^* has yj∗>0y^*_j>0, then row jj is tight at every optimal xx. (e) A vertex in Rn\R^n has exactly nn tight constraints.
Show answer
(a) False: both can be infeasible. (b) True: weak duality bounds both, so neither is unbounded. A feasible LP with a bounded objective attains its optimum, and strong duality makes the values equal. (c) False (optimal edges). (d) True: any optimal xx and any optimal yy form a zero-gap pair, so complementary slackness applies to every such pair. (e) False: at least nn independent ones. Degenerate vertices have more.
A12 ★. Diet LP: foods ii cost cic_i per unit and contain AjiA_{ji} units of nutrient jj. You need at least bjb_j of each nutrient. Write the LP and its dual, and interpret the dual.
Show answer
Primal: min⁡c⊤x\min c\T x s.t. Ax≥b, x≥0Ax\ge b,\ x\ge0. Dual: max⁡b⊤y\max b\T y s.t. A⊤y≤c, y≥0A\T y\le c,\ y\ge0. Interpretation: a pill seller sets a price yjy_j per unit of nutrient jj. To stay competitive, the nutrients in each food must not cost more than the food (A⊤y≤cA\T y\le c). The seller maximizes revenue b⊤yb\T y from selling exactly your requirements. Strong duality: the best pill revenue equals the cheapest diet.
A13 ★. Show that max⁡x1+x2\max x_1+x_2 s.t. x1−x2≤1, −x1+x2≤1, x≥0x_1-x_2\le1,\ -x_1+x_2\le1,\ x\ge0 is unbounded, and conclude something about its dual without writing it.
Show answer
x0=(0,0)x_0=(0,0) and ray v=(1,1)v=(1,1): Av=(0,0)≤0Av=(0,0)\le0, v≥0v\ge0, c⊤v=2>0c\T v=2>0. So x0+tvx_0+tv is feasible for all t≥0t\ge0 with objective 2t→∞2t\to\infty. By weak duality the dual must be infeasible. Check: the dual requires y1−y2≥1y_1-y_2\ge1 and −y1+y2≥1-y_1+y_2\ge1, whose sum is 0≥20\ge2, impossible.
A14 ★. A farmer mixes feeds: feed 1 costs $2/kg and has 3 units of protein and 1 of fat; feed 2 costs $5/kg and has 2 protein and 4 fat. The mix needs at least 12 protein and 8 fat. Write the LP, find a feasible plan, and prove it is optimal with a nonnegative combination of the constraints.
Show answer
min⁡2x1+5x2\min 2x_1+5x_2 s.t. 3x1+2x2≥123x_1+2x_2\ge12, x1+4x2≥8x_1+4x_2\ge8, x≥0x\ge0. Corners: (0,6)(0,6) costs 30, (8,0)(8,0) costs 16, and the intersection 3x1+2x2=12, x1+4x2=83x_1+2x_2=12,\ x_1+4x_2=8 gives x=(3.2,1.2)x=(3.2,1.2), cost 6.4+6=12.46.4+6=12.4. Certificate: at (3.2,1.2)(3.2,1.2) both rows are tight and both xi>0x_i>0, so by complementary slackness try making both "coefficient" conditions tight: 3y1+y2=23y_1+y_2=2, 2y1+4y2=52y_1+4y_2=5, giving y=(0.3,1.1)≥0y=(0.3,1.1)\ge0. Then 0.3(3x1+2x2)+1.1(x1+4x2)=2x1+5x2≥0.3⋅12+1.1⋅8=12.40.3(3x_1+2x_2)+1.1(x_1+4x_2)=2x_1+5x_2\ge0.3\cdot12+1.1\cdot8=12.4 for every feasible xx. Optimal.
A15 ★. Write an LP for min⁡x∈R2 ∣x1−x2∣+∣x1+x2−4∣+∣x2−1∣\min_{x\in\R^2}\ |x_1-x_2|+|x_1+x_2-4|+|x_2-1|. How many variables and constraints?
Show answer
min⁡t1+t2+t3\min t_1+t_2+t_3 s.t. t1≥x1−x2t_1\ge x_1-x_2, t1≥x2−x1t_1\ge x_2-x_1, t2≥x1+x2−4t_2\ge x_1+x_2-4, t2≥4−x1−x2t_2\ge4-x_1-x_2, t3≥x2−1t_3\ge x_2-1, t3≥1−x2t_3\ge1-x_2, with x1,x2,tx_1,x_2,t free. 5 variables and 6 constraints. (Optimum 0 is impossible here, since it would need x1=x2=1x_1=x_2=1 and x1+x2=4x_1+x_2=4. For example x=(2,2)x=(2,2) gives 0+0+1=10+0+1=1, and x=(3,1)x=(3,1) gives 2+0+0=22+0+0=2.)
A16 ★. Write an LP that finds x∈Rnx\in\R^n with Ax≤bAx\le b minimizing the largest coordinate max⁡ixi\max_ix_i.
Show answer
min⁡t\min t s.t. xi≤tx_i\le t for all ii, Ax≤bAx\le b, with tt and xx free. At the optimum t=max⁡ixit=\max_ix_i.
A17 ★. Show that an algorithm for canonical LPs (max⁡c⊤x, Ax≤b, x≥0\max c\T x,\ Ax\le b,\ x\ge0) can solve LPs of the form max⁡c⊤x\max c\T x s.t. Ax=b, x≥0Ax=b,\ x\ge0.
Show answer
Replace Ax=bAx=b by Ax≤bAx\le b and −Ax≤−b-Ax\le-b, i.e. the matrix (A−A)\binom{A}{-A} and right side (b−b)\binom{b}{-b}. The feasible sets are identical, so values and optimal solutions coincide. The size doubles, which is polynomial.
Unit 10.5 · Exam toolkit

Practice B: flows, Farkas, strong duality

Sources: L10–L11 exercises + added questions
B1. What does primal unboundedness imply about the dual, and dual unboundedness about the primal? Can both be infeasible? Give the lecture example.
Show answer
Primal unbounded ⇒ dual infeasible. Dual unbounded ⇒ primal infeasible. Yes, both can be infeasible: max⁡2x1−x2\max2x_1-x_2 s.t. x1−x2≤1, −x1+x2≤−2, x≥0x_1-x_2\le1,\ -x_1+x_2\le-2,\ x\ge0, whose dual needs y1−y2≥2y_1-y_2\ge2 and y1−y2≤1y_1-y_2\le1.
B2. Write the edge-flow LP and the path-flow LP. Why do they have the same optimum? Which one has polynomial size?
Show answer
See 1.4 and 4.1. Path → edge by summing paths; edge → path by flow decomposition (cycles discarded). The edge LP is polynomial (∣E∣|E| variables). The path LP can have exponentially many variables.
B3. Why does every ss–tt cut give a feasible y∈{0,1}Ey\in\{0,1\}^E? Why doesn't that alone finish max-flow/min-cut?
Show answer
Every path crosses out of SS at least once, so it has length ≥ 1. This shows OPT(D)≤\opt(D)\le min cut. To get equality we must show some cut costs at most the fractional optimum, which is the threshold-rounding step.
B4. On s→a→ts\to a\to t, s→b→ts\to b\to t with csa=3,cat=2,csb=2,cbt=3c_{sa}=3,c_{at}=2,c_{sb}=2,c_{bt}=3 and lengths .4,.6,.7,.3.4,.6,.7,.3: compute the clipped distances, all threshold cuts, the average capacity, and a matching max flow.
Show answer
ℓ=(0,.4,.7,1)\ell=(0,.4,.7,1) for (s,a,b,t)(s,a,b,t). Cuts 5, 4, 5 on intervals of length .4, .3, .3. Average 4.7 = ∑ceye\sum c_ey_e. Best cut {s,a}\{s,a\} = 4. Flow 2+2 = 4 matches.
B5. How does one shortest-path computation verify all path constraints of DlengthD_\text{length}? What if tt is unreachable?
Show answer
Dijkstra with lengths y≥0y\ge0. If d(t)≥1d(t)\ge1, all constraints hold. Otherwise the shortest path is a violated constraint. Unreachable tt means d(t)=∞d(t)=\infty: there are no paths and nothing is violated.
B6. For a1=(1,0), a2=(1,1), p=(0,1)a_1=(1,0),\ a_2=(1,1),\ p=(0,1) show p∉p\notin cone and give a witness.
Show answer
Cone points have first coordinate ≥ second. w=(1,−1)w=(1,-1): a1⊤w=1a_1\T w=1, a2⊤w=0a_2\T w=0, p⊤w=−1p\T w=-1.
B7 ★. Same generators, p=(−1,2)p=(-1,2). In the cone? If not, give a witness and the nearest cone point.
Show answer
(λ1+λ2,λ2)=(−1,2)(\lambda_1+\lambda_2,\lambda_2)=(-1,2) forces λ2=2, λ1=−3<0\lambda_2=2,\ \lambda_1=-3<0, so not in the cone. Witness w=(1,−1)w=(1,-1): 1≥0, 0≥01\ge0,\ 0\ge0, p⊤w=−3<0p\T w=-3<0. Nearest point: project pp onto the ray of a2a_2: p⊤a2∥a2∥2a2=12(1,1)\frac{p\T a_2}{\norm{a_2}^2}a_2=\tfrac12(1,1). Then v=p−q=(−1.5,1.5)v=p-q=(-1.5,1.5) and −v=(1.5,−1.5)-v=(1.5,-1.5) is a positive multiple of ww.
B8 ★. Separation: CC = unit disk, p=(3,4)p=(3,4). Find qq, vv, and check v⊤z≤v⊤qv\T z\le v\T q for all z∈Cz\in C.
Show answer
q=p/∥p∥=(0.6,0.8)q=p/\norm p=(0.6,0.8), v=(2.4,3.2)v=(2.4,3.2). v⊤q=1.44+2.56=4v\T q=1.44+2.56=4. Over the disk max⁡v⊤z=∥v∥=4\max v\T z=\norm v=4 (Cauchy–Schwarz), so v⊤z≤4v\T z\le4. v⊤p=7.2+12.8=20>4v\T p=7.2+12.8=20>4.
B9. Rebuild the strong-duality proof: at an optimal x∗x^*, suppose cc is not a nonnegative combination of active normals. What does Farkas give, how do you choose ε\eps, and how does the cone identity produce a dual of the same value?
Show answer
Farkas: ww with ar⊤w≥0a_r\T w\ge0 (tight rr), c⊤w<0c\T w<0. Set v=−wv=-w. Then ε=min⁡{δr/ar⊤v: r slack, ar⊤v>0}\eps=\min\{\delta_r/a_r\T v:\ r\text{ slack},\ a_r\T v>0\} (or any positive number if no such row), and x∗+εvx^*+\eps v is feasible and better, a contradiction. So c=A⊤y−zc=A\T y-z with y,z≥0y,z\ge0 supported on tight rows. Then yy is dual feasible and c⊤x∗=b⊤yc\T x^*=b\T y. See 5.6–5.7.
B10 ★. Why must the strong-duality argument include the normals of −xi≤0-x_i\le0? Give an example.
Show answer
max⁡(−x)\max(-x) s.t. x≤1, x≥0x\le1,\ x\ge0: at x∗=0x^*=0 the only tight constraint is −x≤0-x\le0 with normal −1-1, and c=−1c=-1 is in its cone. Without it, the tight set is empty, the cone is {0}\{0\}, and c∉{0}c\notin\{0\} would wrongly "prove" x∗x^* is not optimal.
B11 ★. Explain in one paragraph why rounding loses nothing for min-cut but might for other problems.
Show answer
For cuts, the averaging argument shows that a random threshold's expected cut cost is at most the fractional cost, so some threshold cut is no worse and the 0/1 and fractional optima coincide. For problems like vertex cover, the LP optimum can be strictly smaller than every integral solution (a triangle has fractional cover 3/23/2 and integral cover 2). Then any rounding must lose something, and approximation algorithms bound the loss by a factor.
B12 ★. Show that x1+x2≤2, −x1≤−2, −x2≤−1x_1+x_2\le2,\ -x_1\le-2,\ -x_2\le-1 (with xx free) is infeasible by giving a Farkas certificate of the form (F3).
Show answer
Take y=(1,1,1)≥0y=(1,1,1)\ge0. A⊤yA\T y: first column (1,−1,0)⋅y=0(1,-1,0)\cdot y=0, second (1,0,−1)⋅y=0(1,0,-1)\cdot y=0. So A⊤y=0A\T y=0. b⊤y=2−2−1=−1<0b\T y=2-2-1=-1<0 ✓. Adding the three rows gives 0≤−10\le-1.
B13 ★. Find the value and optimal mixed strategies of the game A=(2−1−11)A=\begin{pmatrix}2&-1\\-1&1\end{pmatrix} (Alice picks the row).
Show answer
Alice plays row 1 with probability pp. Her payoff against column 1 is 2p−(1−p)=3p−12p-(1-p)=3p-1, against column 2 it is −p+(1−p)=1−2p-p+(1-p)=1-2p. Her guarantee is min⁡(3p−1,1−2p)\min(3p-1,1-2p), maximized where they are equal: p=25p=\tfrac25, value 15\tfrac15. Bob plays column 1 with probability qq: row payoffs 3q−13q-1 and 1−2q1-2q, and the max is minimized at q=25q=\tfrac25, also 15\tfrac15. Both guarantees are 15\tfrac15: the value is 15\tfrac15, with p∗=q∗=(25,35)p^*=q^*=(\tfrac25,\tfrac35).
B14 ★. Why is min⁡q∈Δnc⊤q=min⁡jcj\min_{q\in\Delta_n}c\T q=\min_jc_j? Why does this matter for writing a game as an LP?
Show answer
c⊤qc\T q is a weighted average of the cjc_j (weights qj≥0q_j\ge0, sum 1), so it is at least min⁡jcj\min_jc_j, with equality at q=ej∗q=e_{j^*}. It replaces a minimization over infinitely many mixed strategies by finitely many linear constraints (one per pure column).
Unit 10.6 · Exam toolkit

Practice C: convexity and gradient descent

Sources: L12 exercises + added questions
C1. Prove the first-order inequality from the chord definition, then set y=x∗y=x^*.
Show answer
See 6.3. Divide by θ\theta and let θ↓0\theta\downarrow0. Result: f(x)−f(x∗)≤⟨∇f(x),x−x∗⟩f(x)-f(x^*)\le\langle\nabla f(x),x-x^*\rangle.
C2. Prove local ⇒ global for convex f,Kf,K. Must a constrained differentiable optimum satisfy ∇f=0\nabla f=0?
Show answer
See 6.7. No: min⁡[0,1]x\min_{[0,1]}x is at 0 with f′(0)=1f'(0)=1.
C3. Gradient and Hessian of 12∥Ax−b∥2\tfrac12\norm{Ax-b}^2. Prove convexity and explain the transpose.
Show answer
A⊤(Ax−b)A\T(Ax-b) and A⊤AA\T A. v⊤A⊤Av=∥Av∥2≥0v\T A\T Av=\norm{Av}^2\ge0. The transpose maps residuals (mm-dimensional) back to variable space (dd-dimensional).
C4. For f(x)=x2/2f(x)=x^2/2, classify all η>0\eta>0.
Show answer
(0,1)(0,1): monotone convergence. 11: one step. (1,2)(1,2): alternating convergence. 22: oscillation. >2>2: divergence.
C5. Reproduce the convergence proof, stating which iterates are averaged.
Show answer
See 7.4–7.5. Average of x0,…,xT−1x_0,\dots,x_{T-1}.
C6. D=2,G=3,T=900D=2,G=3,T=900: find η\eta and the error. TT for ε=0.1\eps=0.1?
Show answer
η=1/45\eta=1/45, error ≤ 0.2. T≥3600T\ge3600, η=1/90\eta=1/90.
C7. Prove that the average of TT points in a convex set is in the set, and prove the many-point convexity inequality.
Show answer
Induction. xˉT=T−1TxˉT−1+1TxT−1\bar x_T=\frac{T-1}T\bar x_{T-1}+\frac1Tx_{T-1} is a two-point blend, so it stays in the set and f(xˉT)≤T−1Tf(xˉT−1)+1Tf(xT−1)≤1T∑f(xt)f(\bar x_T)\le\frac{T-1}Tf(\bar x_{T-1})+\frac1Tf(x_{T-1})\le\frac1T\sum f(x_t).
C8. A student claims: "convexity alone gives a bounded GG; the theorem guarantees the last iterate; TT iterations means O(T)O(T) total time; the approximation is multiplicative." Fix all four.
Show answer
(1) No: x2/2x^2/2 has unbounded gradient. GG is an assumption on the iterates. (2) No: average (or best) of the queried points. (3) No: T×T\times (cost per gradient + O(d)O(d)), e.g. O(Tmd)O(Tmd) for least squares. (4) No: additive, f(xˉ)−f(x∗)≤εf(\bar x)-f(x^*)\le\eps.
C9 ★. Which are convex on their domain? (a) max⁡(x2,1−x)\max(x^2,1-x) (b) ex+∣x∣e^x+|x| (c) x1x2x_1x_2 on R2\R^2 (d) −log⁡x-\log x on x>0x>0 (e) min⁡(x,0)\min(x,0) (f) dist(x,[0,1])\mathrm{dist}(x,[0,1]) (g) x2−∣x∣x^2-|x|
Show answer
(a) yes (max of convex). (b) yes (sum). (c) no: Hessian (0110)\begin{pmatrix}0&1\\1&0\end{pmatrix} has eigenvalue −1. (d) yes (f′′=1/x2>0f''=1/x^2>0). (e) no: it is concave (min of linear functions), with a corner pointing up. (f) yes (partial minimization). (g) no: two dips at ±12\pm\tfrac12.
C10 ★. Is f(x,y)=x2+3xy+y2f(x,y)=x^2+3xy+y^2 convex?
Show answer
H=(2332)H=\begin{pmatrix}2&3\\3&2\end{pmatrix}. det⁡=4−9<0\det=4-9<0, so one eigenvalue is negative and ff is not convex. Direction v=(1,−1)v=(1,-1): v⊤Hv=2−6+2=−2<0v\T Hv=2-6+2=-2<0.
C11 ★. D=10D=10, G=1G=1, target ε=0.01\eps=0.01. How many iterations and which η\eta?
Show answer
T≥(10⋅1/0.01)2=106T\ge(10\cdot1/0.01)^2=10^6. η=10/(1⋅1000)=0.01\eta=10/(1\cdot1000)=0.01.
C12 ★. Subgradient descent on f(x)=∣x∣f(x)=|x| from x0=0.25x_0=0.25 with η=0.1\eta=0.1, using g=sign⁡(x)g=\operatorname{sign}(x) (and g=1g=1 at 0). Compute a few iterates. What do the last iterate, the best iterate and the average do? Compare with the bound.
Show answer
0.25→0.15→0.05→−0.05→0.05→−0.05…0.25\to0.15\to0.05\to-0.05\to0.05\to-0.05\dots The last iterate never converges (it bounces with error 0.05). The best iterate has error 0.05. The average tends to ≈ 0. Bound with D=0.25, G=1D=0.25,\ G=1: 0.06250.2T+0.05\frac{0.0625}{0.2T}+0.05. The floor ηG2/2=0.05\eta G^2/2=0.05 is exactly the bounce size, the "discrete step penalty" made visible. To shrink it, take smaller η\eta (and more steps).
C13 ★. Why can the analysis use x∗x^* though the algorithm cannot?
Show answer
The algorithm's steps only use gradients at its own iterates. x∗x^* appears only in the potential RtR_t used to reason about those iterates. Any fixed reference point is allowed in a proof. We pick a minimizer because that turns the inner product into the objective error.
C14 ★. Show that η=D/(GT)\eta=D/(G\sqrt T) minimizes h(η)=D22ηT+ηG22h(\eta)=\frac{D^2}{2\eta T}+\frac{\eta G^2}2. What happens to the bound if you use 2η⋆2\eta^\star instead?
Show answer
h′(η)=−D22η2T+G22=0h'(\eta)=-\frac{D^2}{2\eta^2T}+\frac{G^2}2=0 gives η⋆\eta^\star, and h′′>0h''>0. With 2η⋆2\eta^\star: first term DG4T\frac{DG}{4\sqrt T}, second DGT\frac{DG}{\sqrt T}, total 1.25DGT1.25\frac{DG}{\sqrt T}, only 25% worse. The bound is not very sensitive to a constant-factor error in η\eta.
Unit 10.7 · Exam toolkit

Practice D: projections and smoothness (L13)

Sources: Lec13 + added questions
D1. Project u=(5,−1)u=(5,-1) onto the box [0,2]×[0,3][0,2]\times[0,3], and u=(3,4)u=(3,4) onto the unit ball.
Show answer
Box: clip each coordinate: min⁡{2,max⁡{0,5}}=2\min\{2,\max\{0,5\}\}=2, min⁡{3,max⁡{0,−1}}=0\min\{3,\max\{0,-1\}\}=0, so (2,0)(2,0). Ball: ∥u∥=5>1\norm u=5>1, so u/∥u∥=(0.6,0.8)u/\norm u=(0.6,0.8).
D2. Prove: if p=ΠK(u)p=\Pi_K(u) for convex KK, then ∥p−z∥2≤∥u−z∥2−∥u−p∥2\norm{p-z}^2\le\norm{u-z}^2-\norm{u-p}^2 for all z∈Kz\in K.
Show answer
See unit 8.3: f(θ)=∥u−p−θ(z−p)∥2f(\theta)=\norm{u-p-\theta(z-p)}^2 is minimized at θ=0\theta=0 over [0,1][0,1] (convexity keeps p+θ(z−p)∈Kp+\theta(z-p)\in K), so f′(0+)=2⟨u−p,p−z⟩≥0f'(0^+)=2\langle u-p,p-z\rangle\ge0. Expand ∥u−z∥2=∥u−p∥2+∥p−z∥2+2⟨u−p,p−z⟩\norm{u-z}^2=\norm{u-p}^2+\norm{p-z}^2+2\langle u-p,p-z\rangle.
D3. Why does projected GD keep the L12 bound? Where exactly is x∗∈Kx^*\in K used? Why is the output feasible?
Show answer
Only the first line changes: Rt+1=∥ΠK(yt+1)−x∗∥2≤∥yt+1−x∗∥2R_{t+1}=\norm{\Pi_K(y_{t+1})-x^*}^2\le\norm{y_{t+1}-x^*}^2, the projection inequality with z=x∗z=x^*. That needs x∗∈Kx^*\in K. The rest of the proof (convexity, GG, telescoping, Jensen) is identical. The average of points of the convex set KK lies in KK.
D4. Projected GD: min⁡x∈[0,1](x−3)2\min_{x\in[0,1]}(x-3)^2, x0=0x_0=0, η=0.25\eta=0.25. Compute two steps. Is the gradient zero at the optimum?
Show answer
f′(x)=2(x−3)f'(x)=2(x-3). t=0t=0: y=0−0.25⋅(−6)=1.5y=0-0.25\cdot(-6)=1.5, projected to 1. t=1t=1: y=1−0.25⋅(−4)=2y=1-0.25\cdot(-4)=2, projected to 1. The method sits at x∗=1x^*=1, where f′(1)=−4≠0f'(1)=-4\neq0: a boundary optimum with nonzero gradient.
D5. Which are β-smooth on R\R, and with which β? x2/2x^2/2, ∣x∣|x|, 52(x−1)2\tfrac52(x-1)^2, log⁡(1+ex)\log(1+e^x), x4x^4, sin⁡x\sin x.
Show answer
x2/2x^2/2: β=1. ∣x∣|x|: no. 52(x−1)2\tfrac52(x-1)^2: β=5. Softplus: β=1/4. x4x^4: no (f′′f'' unbounded). sin⁡x\sin x: β=1, but it is not convex.
D6. Prove the descent lemma. What is ss and why is it there?
Show answer
See unit 8.6. s∈[0,1]s\in[0,1] parametrizes the segment from xx to yy, turning ff into the 1-D function g(s)=f(x+s(y−x))g(s)=f(x+s(y-x)), so the fundamental theorem of calculus applies. Then Cauchy–Schwarz and smoothness bound the integrand by βs∥y−x∥2\beta s\norm{y-x}^2, and ∫01s ds=12\int_0^1 s\,ds=\tfrac12.
D7. For which step sizes does the descent lemma guarantee f(xt+1)<f(xt)f(x_{t+1})<f(x_t) (when ∇f(xt)≠0\nabla f(x_t)\neq0)? Which step maximizes the guaranteed decrease?
Show answer
f(xt+1)≤f(xt)−η(1−βη/2)∥g∥2f(x_{t+1})\le f(x_t)-\eta(1-\beta\eta/2)\norm{g}^2. The decrease is positive for 0<η<2/β0<\eta<2/\beta. The factor η(1−βη/2)\eta(1-\beta\eta/2) is maximized at η=1/β\eta=1/\beta, with value 1/(2β)1/(2\beta).
D8. Reproduce the proof of f(xT)−f∗≤βD2/(2T)f(x_T)-f^*\le\beta D^2/(2T). Where are convexity, smoothness and monotonicity each used?
Show answer
Smoothness: safe step f(xt+1)≤f(xt)−12β∥gt∥2f(x_{t+1})\le f(x_t)-\frac1{2\beta}\norm{g_t}^2. Convexity: f(xt)−f∗≤⟨gt,xt−x∗⟩f(x_t)-f^*\le\langle g_t,x_t-x^*\rangle. Algebra: ⟨gt,xt−x∗⟩−12β∥gt∥2=β2(Rt−Rt+1)\langle g_t,x_t-x^*\rangle-\frac1{2\beta}\norm{g_t}^2=\frac\beta2(R_t-R_{t+1}). Telescope to β2R0≤βD22\frac\beta2R_0\le\frac{\beta D^2}2. Monotonicity (from the safe step): the sum of TT errors is ≥T(f(xT)−f∗)\ge T(f(x_T)-f^*).
D9. β=4\beta=4, D=3D=3, ε=0.01\eps=0.01. How many steps does smooth GD need? How many would the bounded-gradient method need if G=2G=2?
Show answer
Smooth: T≥βD2/(2ε)=36/0.02=1800T\ge\beta D^2/(2\eps)=36/0.02=1800. Bounded gradients: T≥(DG/ε)2=(6/0.01)2=360,000T\ge(DG/\eps)^2=(6/0.01)^2=360{,}000.
D10. A summary table claims the bounded-gradient method needs O(ε−1)O(\sqrt{\eps^{-1}}) steps. Is that right? Explain.
Show answer
DG/T≤ε  ⟺  T≥(DG/ε)2DG/\sqrt T\le\eps\iff T\ge(DG/\eps)^2, so O(ε−2)O(\eps^{-2}). It must be slower than the smooth O(ε−1)O(\eps^{-1}), because it uses weaker assumptions.
D11. GD with η=1/β\eta=1/\beta on f=12(x12+4x22)f=\tfrac12(x_1^2+4x_2^2) from x0=(2,1)x_0=(2,1): compute x1,x2x_1,x_2, their errors, and the bound.
Show answer
β=4\beta=4, η=1/4\eta=1/4: x1=(1.5,0)x_1=(1.5,0), f=1.125f=1.125; x2=(1.125,0)x_2=(1.125,0), f≈0.633f\approx0.633. D2=5D^2=5, bound βD2/(2T)=10/T\beta D^2/(2T)=10/T: 10 and 5. Valid but loose.
D12. True or false? (a) β-smooth ⇒ convex. (b) For convex β-smooth ff with η=1/β\eta=1/\beta, f(xt)f(x_t) is nonincreasing. (c) The smooth theorem needs a gradient bound GG. (d) The projection argument works for any closed set. (e) The safe step needs TT in advance.
Show answer
(a) False (sin⁡x\sin x). (b) True (safe-step inequality; convexity not even needed). (c) False. (d) False: it needs convexity (the segment from pp to zz must stay in KK). (e) False: η=1/β\eta=1/\beta does not depend on TT, unlike D/(GT)D/(G\sqrt T).
D13 ★. Give the strong convexity constant α (or say "not strongly convex"): 3x23x^2; x2+∣x∣x^2+|x|; 12(x12+9x22)\tfrac12(x_1^2+9x_2^2); log⁡(1+ex)\log(1+e^x); 12∥Ax−b∥2\tfrac12\norm{Ax-b}^2 with A=(1002)A=\begin{pmatrix}1&0\\0&2\end{pmatrix}.
Show answer
3x23x^2: f′′=6f''=6, α=6. x2+∣x∣x^2+|x|: x2x^2 is 2-strongly convex and ∣x∣|x| is convex, so α=2. 12(x12+9x22)\tfrac12(x_1^2+9x_2^2): Hessian diag(1,9), α=1 (and β=9). Softplus: f′′→0f''\to0 at ±∞, not strongly convex. A⊤A=diag(1,4)A\T A=\mathrm{diag}(1,4), α=1.
D14 ★. ff is 2-strongly convex with unconstrained minimizer x∗x^*, and f(x)−f(x∗)≤0.01f(x)-f(x^*)\le0.01. How close is xx to x∗x^*?
Show answer
Quadratic growth: α2∥x−x∗∥2≤f(x)−f(x∗)≤0.01\frac\alpha2\norm{x-x^*}^2\le f(x)-f(x^*)\le0.01, so ∥x−x∗∥2≤0.01\norm{x-x^*}^2\le0.01 and ∥x−x∗∥≤0.1\norm{x-x^*}\le0.1.
D15 ★. Prove that an α-strongly convex differentiable ff on Rd\R^d has at most one minimizer.
Show answer
If x∗x^* and y∗y^* both minimize, then ∇f(x∗)=0\nabla f(x^*)=0 and the definition gives f(y∗)≥f(x∗)+α2∥y∗−x∗∥2f(y^*)\ge f(x^*)+\frac\alpha2\norm{y^*-x^*}^2. Since f(y∗)=f(x∗)f(y^*)=f(x^*), this forces ∥y∗−x∗∥=0\norm{y^*-x^*}=0.
D16 ★. Verify the regrouping identity ∑t=0T−1(atRt−btRt+1)=a0R0+∑t=1T−1(at−bt−1)Rt−bT−1RT\sum_{t=0}^{T-1}(a_tR_t-b_tR_{t+1})=a_0R_0+\sum_{t=1}^{T-1}(a_t-b_{t-1})R_t-b_{T-1}R_T and say when the middle terms can be dropped.
Show answer
Shift the index in the second sum: ∑t=0T−1btRt+1=∑t=1Tbt−1Rt\sum_{t=0}^{T-1}b_tR_{t+1}=\sum_{t=1}^{T}b_{t-1}R_t. Collect the coefficient of each RtR_t. The middle terms are ≤0\le0 (droppable in an upper bound) when at≤bt−1a_t\le b_{t-1} and Rt≥0R_t\ge0. The last term −bT−1RT≤0-b_{T-1}R_T\le0 can be dropped when bT−1≥0b_{T-1}\ge0.
Unit 10.8 · Exam toolkit

Practice E: approximation algorithms (L14–L15)

Sources: L14–L15 + added questions

Questions marked ★ go beyond the lecture examples. None of them needs anything outside Chapter 9.

E1. State what an α-approximation is for a minimization and for a maximization problem. Why is α ≥ 1? What does a 3-approximation for a maximization problem guarantee?
Show answer
Min: on every instance the output is feasible and costs A(I)≤α OPT(I)A(I)\le\alpha\,\opt(I). Max: value A(I)≥OPT(I)/αA(I)\ge\opt(I)/\alpha. For min, every feasible solution costs at least OPT, so OPT≤A(I)≤αOPT\opt\le A(I)\le\alpha\opt forces α≥1\alpha\ge1 (similarly for max). A 3-approximation for max returns at least a third of the optimal value on every input.
E2. Which are PTAS running times, and which are FPTAS? (a) n2/εn^{2/\eps} (b) n4/ε2n^4/\eps^2 (c) 31/εn23^{1/\eps}n^2 (d) (n/ε)3(n/\eps)^3
Show answer
(a) PTAS, not FPTAS (degree grows with 1/ε1/\eps). (b) FPTAS. (c) PTAS, not FPTAS (exponential in 1/ε1/\eps). (d) FPTAS. Every FPTAS is also a PTAS.
E3 ★. Run greedy-by-degree on the spider with four legs c−ai−bic-a_i-b_i, i=1,…,4i=1,\dots,4. Compare with OPT and check the claim deg⁡(vt)≥∣Et−1∣/OPT\deg(v_t)\ge\lvert E_{t-1}\rvert/\opt at every step.
Show answer
m=8m=8, OPT=4\opt=4 ({a1,…,a4}\{a_1,\dots,a_4\}; the four edges aibia_ib_i are a matching, so no cover is smaller). Step 1: cc has degree 4 (unique max) ≥ 8/4 = 2 ✓. Then 4 disjoint edges remain; each step picks degree 1, and 1≥∣E∣/41\ge\lvert E\rvert/4 for ∣E∣=4,3,2,1\lvert E\rvert=4,3,2,1 ✓. Greedy uses 5 vertices. The bound 8(3/4)t8(3/4)^t drops below 1 at t=8t=8, consistent with ⌊4ln⁡8⌋+1=9\lfloor4\ln8\rfloor+1=9.
E4. Prove: if S∗S^* is an optimal cover and E′E' is any set of remaining edges, some vertex has at least ∣E′∣/OPT\lvert E'\rvert/\opt edges of E′E'.
Show answer
Every edge of E′E' has an endpoint in S∗S^*, so ∑c∈S∗deg⁡E′(c)≥∣E′∣\sum_{c\in S^*}\deg_{E'}(c)\ge\lvert E'\rvert. The largest of these OPT\opt numbers is at least their average, ∣E′∣/OPT\lvert E'\rvert/\opt.
E5. From ∣Et∣≤m e−t/OPT\lvert E_t\rvert\le m\,e^{-t/\opt}, show the greedy loop runs at most ⌊OPTln⁡m⌋+1\lfloor\opt\ln m\rfloor+1 times. Why is integrality needed?
Show answer
For t=⌊OPTln⁡m⌋+1>OPTln⁡mt=\lfloor\opt\ln m\rfloor+1>\opt\ln m we get me−t/OPT<me−ln⁡m=1m e^{-t/\opt}<me^{-\ln m}=1, so ∣Et∣<1\lvert E_t\rvert<1. The bound itself is never 0. Only because ∣Et∣\lvert E_t\rvert is a nonnegative integer can we conclude ∣Et∣=0\lvert E_t\rvert=0, i.e. the loop has stopped. Each iteration adds one vertex, so ∣S∣≤t\lvert S\rvert\le t.
E6. On the path a−b−c−da-b-c-d, what can the matching algorithm return? Compare with OPT and with the maximum matching.
Show answer
If it picks bcbc first, both other edges are removed: C={b,c}C=\{b,c\}, size 2 = OPT, but ∣M∣=1<2=\lvert M\rvert=1<2= maximum matching. If it picks abab first, cdcd remains and is picked: C={a,b,c,d}C=\{a,b,c,d\}, size 4 = 2·OPT. Both outcomes respect ∣M∣≤OPT≤∣C∣=2∣M∣\lvert M\rvert\le\opt\le\lvert C\rvert=2\lvert M\rvert.
E7. Prove that every matching is at most every vertex cover. Does this need the cover to be minimal or the matching to be maximal?
Show answer
Each matching edge has an endpoint in the cover. Choose one such endpoint per edge. Distinct matching edges share no endpoint, so the chosen vertices are distinct: an injection from MM into CC. Neither minimality nor maximality is needed.
E8 ★. Give an infinite family of graphs on which the matching algorithm always returns exactly 2·OPT, whatever edges it picks.
Show answer
kk disjoint edges: the algorithm must pick every edge (each is its own component), returns 2k2k, while OPT=k\opt=k. Another family: Kn,nK_{n,n}, where every maximal matching is perfect, so the output is all 2n2n vertices and OPT=n\opt=n.
E9 ★. Show that any maximal matching MM has at least half as many edges as a maximum matching M∗M^*.
Show answer
Every edge of M∗M^* shares an endpoint with some edge of MM (maximality). An edge {u,v}∈M\{u,v\}\in M has two endpoints, and each endpoint lies on at most one edge of M∗M^*, so at most 2 edges of M∗M^* are charged to it. Hence ∣M∗∣≤2∣M∣\lvert M^*\rvert\le2\lvert M\rvert: the same disjointness argument gives a 2-approximation for maximum matching.
E10. Write the IP and the LP relaxation for vertex cover, and prove that an optimal LP solution never has a coordinate above 1.
Show answer
min⁡∑vxv\min\sum_vx_v s.t. xu+xv≥1x_u+x_v\ge1 for each edge, x≥0x\ge0, plus x∈ZVx\in\Z^V for the IP. If xv>1x_v>1, lowering it to 1 keeps every constraint (1+xu≥11+x_u\ge1) and strictly lowers the objective, so such a point is not optimal. (With weights wv≥0w_v\ge0: lowering never increases the cost, so some optimal solution lies in [0,1]V[0,1]^V.)
E11. Find OPTLP\opt_{LP} and OPT for the 5-cycle and for K4K_4. What does threshold rounding return from the all-½ solution? Check the 2-approximation bound.
Show answer
C5C_5: all ½ gives 5/2. Summing the 5 edge constraints gives 2∑x≥52\sum x\ge5, so OPTLP=52\opt_{LP}=\frac52. OPT = 3. Rounding keeps all 5 vertices: 5≤2⋅52=5≤2⋅35\le2\cdot\frac52=5\le2\cdot3. K4K_4: OPTLP=2\opt_{LP}=2 (all ½; summing the 6 constraints gives 3∑x≥63\sum x\ge6), OPT = 3, rounding keeps 4 ≤ 4.
E12. Why can a threshold of 0.6 make vertex cover rounding infeasible? What happens with 0.4?
Show answer
An edge may have xu∗=xv∗=12x^*_u=x^*_v=\frac12 (e.g. a single edge or a triangle). With threshold 0.6 both endpoints are dropped and the edge is uncovered. With 0.4 the rounding is still feasible (the larger value is ≥ ½ ≥ 0.4), but each kept vertex now only satisfies x^v≤xv∗/0.4\hat x_v\le x^*_v/0.4, so the guarantee weakens to 2.5.
E13. Write the dual of the weighted vertex cover LP min⁡∑vwvxv\min\sum_vw_vx_v s.t. xu+xv≥1, x≥0x_u+x_v\ge1,\ x\ge0. Interpret it.
Show answer
max⁡∑eye\max\sum_ey_e s.t. ∑e∋vye≤wv\sum_{e\ni v}y_e\le w_v for every vertex, y≥0y\ge0. Edges receive "payments" yey_e, and the total payment at a vertex cannot exceed its weight. Any such yy lower-bounds the cheapest cover by weak duality. With unit weights and integral yy it is a matching.
E14. Derive the vertex cover dual by the multiplier method (no rulebook) and explain where ∑e∋v\sum_{e\ni v} comes from.
Show answer
Multiply each edge constraint xu+xv≥1x_u+x_v\ge1 by ye≥0y_e\ge0 and add: ∑eye(xu+xv)≥∑eye\sum_ey_e(x_u+x_v)\ge\sum_ey_e. Regroup the left side by vertex: xvx_v appears once for every edge at vv, giving ∑vxv∑e∋vye\sum_vx_v\sum_{e\ni v}y_e. If ∑e∋vye≤1\sum_{e\ni v}y_e\le1 for all vv, then ∑vxv≥∑vxv∑e∋vye\sum_vx_v\ge\sum_vx_v\sum_{e\ni v}y_e (as x≥0x\ge0), so ∑vxv≥∑eye\sum_vx_v\ge\sum_ey_e. The best such bound is the dual.
E15 ★. Is the odd cycle C2k+1C_{2k+1} a good example of a large integrality gap for vertex cover?
Show answer
No. OPTLP=2k+12\opt_{LP}=\frac{2k+1}2 (all ½, and summing the constraints gives 2∑x≥2k+12\sum x\ge2k+1) and OPT=k+1\opt=k+1, so the ratio 2k+22k+1→1\frac{2k+2}{2k+1}\to1. The complete graph KnK_n gives n−1n/2→2\frac{n-1}{n/2}\to2.
E16 ★. In a set cover instance every element lies in at most ff sets. Give an LP-rounding ff-approximation in steps.
Show answer
(1) IP: min⁡∑ScSxS\min\sum_Sc_Sx_S s.t. ∑S∋exS≥1\sum_{S\ni e}x_S\ge1 for each element ee, x∈{0,1}x\in\{0,1\}. (2) Relax to x≥0x\ge0 and solve: OPTLP≤OPT\opt_{LP}\le\opt. (3) Round x^S=1\hat x_S=1 iff xS∗≥1fx^*_S\ge\frac1f. (4) Feasible: the at most ff values in each row add up to ≥ 1, so the largest is ≥ 1f\frac1f. (5) Cost: x^S≤fxS∗\hat x_S\le fx^*_S, so ∑cSx^S≤fOPTLP≤fOPT\sum c_S\hat x_S\le f\opt_{LP}\le f\opt.
E17. In the facility location IP, explain yij≤xiy_{ij}\le x_i and ∑iyij=1\sum_iy_{ij}=1. Why are upper bounds x,y≤1x,y\le1 unnecessary in the relaxation?
Show answer
yij≤xiy_{ij}\le x_i: a client cannot be assigned to a closed facility (xi=0⇒yij=0x_i=0\Rightarrow y_{ij}=0). ∑iyij=1\sum_iy_{ij}=1: every client is assigned to exactly one facility. yij≤1y_{ij}\le1 follows from the sum constraint and y≥0y\ge0, and any xi>max⁡jyijx_i>\max_jy_{ij} can be lowered to max⁡jyij≤1\max_jy_{ij}\le1 without increasing the cost.
E18. Prove that at least half of client jj's LP assignment lies in Bj={i:dij≤2Lj}B_j=\{i:d_{ij}\le2L_j\}.
Show answer
For i∉Bji\notin B_j, dij>2Ljd_{ij}>2L_j, so yij∗≤dij2Ljyij∗y^*_{ij}\le\frac{d_{ij}}{2L_j}y^*_{ij}. Summing over i∉Bji\notin B_j: ∑i∉Bjyij∗≤12Lj∑idijyij∗=12\sum_{i\notin B_j}y^*_{ij}\le\frac1{2L_j}\sum_id_{ij}y^*_{ij}=\frac12. Since the yij∗y^*_{ij} sum to 1, ∑i∈Bjyij∗≥12\sum_{i\in B_j}y^*_{ij}\ge\frac12, and xi∗≥yij∗x^*_i\ge y^*_{ij} gives the same for x∗x^*. (If Lj=0L_j=0, all mass is at distance 0, inside BjB_j.)
E19 ★. In the facility location rounding, which step breaks if clients are processed in an arbitrary order instead of by increasing LjL_j?
Show answer
The connection bound for a non-representative: d(j,ir)≤2Lj+2Lr+2Lrd(j,i_r)\le2L_j+2L_r+2L_r. Sorting gives Lr≤LjL_r\le L_j, hence ≤6Lj\le6L_j. In another order LrL_r could be much larger than LjL_j, and client jj could be sent far away. The opening-cost bound (disjoint balls, ball mass ≥ ½) does not need the order.
E20 ★. Why does the edge-disjoint paths algorithm use the cutoff L≈mL\approx\sqrt m?
Show answer
Each greedy path can block about LL short optimal paths (charging), and there are at most m/(L+1)m/(L+1) long optimal paths (edge-disjointness). The bound OPT≤(L+1)a+mL+1\opt\le(L+1)a+\frac m{L+1} is smallest in order of magnitude when L≈m/LL\approx m/L, i.e. L≈mL\approx\sqrt m, giving O(m)O(\sqrt m).
Unit 10.9 · Exam toolkit

Coverage checklist

Sources: Lec_9_SecB, Lec10_SecB, Lec11_SecB, Lec12_secB, Lec12_Unmarked, Lec13_SecA, Lec13_Unmarked, Lec14_SecB, Lec14 unmarked, Lec15_SecB, Lec15_Unmarked, L14 and L15 recordings, Part 2 class notes (60 pp.), Homework 3

Use this page to check that you can do everything Part 2 asks for. Each line links to the unit that covers it.

1 · Sources and where they are covered

SourceContentUnits
Lecture 9Part 2 overview; LP definition and dimensions; smoothie model; max-flow LP; equivalent forms; convex sets; 2-D picture; three outcomes; tight constraints and vertices; basic optimal solution; polynomial solvability and Cramer; box-constraint exercise; first certificate0.1, 1.1–1.5, 2.1–2.6, 3.1
Lecture 10certificates; dual derivation; weak and strong duality; smoothie dual and prices; infeasible vs unbounded; dual rulebook (exam question); path LP; length dual; threshold rounding; averaging; max-flow = min-cut; Dijkstra check3.1–3.7, 4.1–4.5
Lecture 11proof plan; free-variable split; cones and Farkas; separation; cone case; active-constraint argument; dual construction; summary; exercises1.5, 5.1–5.7, 3.6
Lecture 12 (typed + board)offline problem; convex functions; first-order and Hessian tests; max of convex and partial minimization; least squares; local = global; steepest descent; step sizes; bounded-gradient theorem and proof; subgradients; scope6.1–6.7, 7.1–7.8
Lecture 13 (board + typed)projection and box example; projection inequality; projected GD; β-smoothness; descent lemma; safe step; smooth convex theorem; comparison table; caveats8.1–8.9
Lecture 14 (board, typed, recording)α-approximation; PTAS/FPTAS; hierarchy and TSP remark; vertex cover; greedy by degree and the O(log⁡n)O(\log n) proof; matchings as lower bounds; maximal-matching 2-approximation; tight example; duality connection; edge-disjoint paths (posted notes)9.1–9.6
Lecture 15 (board, typed, recording)IP vs LP picture; rounding template; vertex cover IP and claims; threshold rounding and its proof; averaging idea flagged for the exam; dual = matching; integrality gap; facility location model, LjL_j, balls, Markov lemma, rounding algorithm (6-approximation stated); exam-scope announcement9.7–9.14
Homework 3 topicsmin-LP certificates; LP modeling tricks and reductions; Farkas variants; zero-sum games; operations on convex sets/functions; strong convexity and varying step sizes3.1, 1.6, 5.5, 3.8, 2.1, 6.5, 8.10

2 · Skills checklist

You should be able to do each of these without looking.

SkillWhere
Read any LP formula: rows vs columns, dimensions, coordinatewise inequalities, transpose0.2, 1.1
Model a word problem as an LP (max or min), and justify the model both ways1.2, 1.3, 1.4
Linearize ∣⋅∣|\cdot|, max⁡\max, min⁡\min objectives; know when this is impossible1.6
Convert between LP forms; argue a reduction between forms is correct and polynomial1.5, 1.6
Prove a set is convex / give a counterexample; intersections, unions, affine images2.1
Solve a 2-D LP graphically; identify vertices by independent tight constraints2.2, 2.4
Classify an LP as infeasible / unbounded / finite; prove unboundedness with a ray2.3
Explain why an optimal vertex exists and why the answer has polynomial bit length2.5, 2.6
Prove optimality with a certificate, for max and min problems3.1
Derive the dual from scratch and with the rulebook / S-O-B, for any mixed form3.2, 3.5
State and prove weak duality; state strong duality; know the possible status pairs3.3, 3.4
Use complementary slackness to find or verify optimal solutions3.6
Use a duality gap as an additive error certificate3.7
Set up zero-sum games, mixed strategies, max-min vs min-max; best responses are pure3.8
Write the path LP and length dual; turn a cut into a dual solution4.1, 4.2
Threshold rounding and the averaging argument; prove max-flow = min-cut via duality4.3–4.5
Check exponentially many constraints with a separation oracle (Dijkstra)4.5
State Farkas' lemma (all forms), give certificates, convert between forms5.2, 5.5
Prove separation from the nearest point; derive Farkas from separation5.3, 5.4
Reproduce the strong duality proof (tight normals, ε step, dual construction)5.1, 5.6, 5.7
Prove a function is convex (chord, tangent, Hessian, operations) or refute it, without assuming differentiability6.2–6.5
Prove the first-order condition (both directions) and local = global6.3, 6.7
Compute gradients and Hessians (least squares and other quadratics)0.3, 6.6
Explain steepest descent and step-size behaviour7.1, 7.2
Prove the DG/TDG/\sqrt T theorem; compute η, error and T7.3–7.6
Projections (box, ball, halfspace), the projection inequality, projected GD8.2–8.4
Smoothness, descent lemma, safe step, the βD2/(2T)\beta D^2/(2T) theorem8.5–8.8
Strong convexity: definition, tests, consequences, varying step sizes, harmonic sums, weighted telescoping8.10, 0.3
Define α-approximation (min and max), PTAS, FPTAS; classify running times9.2
Run greedy-by-degree; prove the OPT(1+ln⁡m)\opt(1+\ln m) bound (claim, shrink, 1−x≤e−x1-x\le e^{-x}, integrality)9.4
Prove every matching ≤ every cover; analyze the maximal-matching 2-approximation; give tight examples9.5
Model a selection problem as a 0/1 IP, relax it, and explain OPTLP≤OPT\opt_{LP}\le\opt9.7, 9.8
Threshold rounding for vertex cover (feasibility + cost); generalize to weights and to ff variables per constraint9.9, 9.10
Write the dual of the vertex cover LP; explain why integral duals are matchings9.11
Integrality gap of KnK_n; distinguish tight examples, gaps, and hardness9.12
Facility location: IP, relaxation, LjL_j, balls, the ball lemma, the rounding algorithm (and the 6-approximation proof)9.13–9.15

3 · Homework 3 map (concepts only, no solutions)

ProblemWhat you needUnits
Fruit-party LP (write it, feasible point, lower bound)modeling a min LP with ≥ constraints; checking feasibility; lower-bound certificate from a nonnegative combination1.2, 3.1, 3.6
LP equivalent formulationsfree-variable split, slack variables, the three parts of a reduction argument1.5, 1.6
Farkas A ⇒ Bthe variants table, the conversion recipe (slack columns force y≥0y\ge0, split columns force equality)5.2, 5.5
ℓ₁ and ℓ∞ regression LPs and their dualsabsolute-value and min-max tricks; free variables; dual rulebook (free ↔ equality)1.6, 3.5
Minimax theorem via LP dualitymixed strategies, linear functions over the simplex, max-min trick, writing the dual of a mixed-form LP, strong duality, reading optimal solutions as strategies3.8, 1.6, 3.5, 3.4
Convex sets and functions (∩, ∪, +, ×, max)definitions via segments and chords (no derivatives); operations tables; how to refute with one counterexample2.1, 6.2, 6.5
GD for strongly convex functionsstrong convexity, strengthened key inequality, one-step expansion with ηt\eta_t, weighted telescoping, ∑1/t≤1+ln⁡T\sum1/t\le1+\ln T, Jensen for the average8.10, 0.3, 7.5

4 · Not covered here

Lectures after 15 (randomized rounding, hardness of approximation) were not available. Strong convexity combined with smoothness (the geometric rate) is stated but not proved. Exam scope for facility location and edge-disjoint paths: see the notes at the top of 9.1, 9.6 and 9.15.

5 · Material added beyond the lecture notes

The math toolkit; the modeling checklist and tricks; worked reductions; S-O-B mnemonic and worked duals; min-problem certificates; full complementary-slackness derivation; zero-sum games; numeric threshold sweep; separation-oracle remark; Farkas variants; set-operation table; convexity-preserving rules beyond the board remarks; extra projection formulas; strong convexity; the spider and bipartite-trap greedy examples; 1−x≤e−x1-x\le e^{-x} in place of the limit; weighted vertex cover and the ff-approximation; the Fano-plane example; the multiplier derivation of the matching dual; tightness/gap/hardness comparison; the 6-approximation proof and the c=43c=\frac43 variant; hardness remarks; all ★ practice questions. These explain the material. They do not claim to report anything said in class that is not in the lecture notes.