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.
Block
Lectures
The main question
Linear programming
9–11
How do we model a problem with linear constraints? How can we certify that a solution is optimal?
Convex optimization
12–13
What still works when the objective is not linear? How does gradient descent find an approximately optimal solution?
Approximation algorithms
14–15
When 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.
Read left to right along the top, then back along the bottom row. Each box is a chapter.
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=1∑ncixi
In words"c-transpose-x" is just a weighted sum: multiply each choice by its score and add.
Symbol by symbol
xi
how much of choice i you make (a decision variable)
ci
score (revenue, cost, …) per unit of choice i
∑i=1n
"add up, for i=1,2,…,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
Picture first. Before reading a formula, describe the figure: what moves, what stays feasible, what blocks improvement.
Decode. Read the "In words" line and the symbol table, then cover them and explain the formula aloud.
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".
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∈Rn is a column of n real numbers x=(x1,…,xn)⊤. Comparisons between vectors are coordinatewise:
Vector inequality
x≥0⟺xi≥0 for every i,Ax≤b⟺(Ax)j≤bj for every row j.
In wordsA vector inequality is many ordinary inequalities written at once, one per coordinate.
Symbol by symbol
Rn
the set of all lists of n real numbers
⟺
"if and only if": the two statements are equivalent
(Ax)j
the j-th entry of the vector Ax
When you use itWhenever you see ≤ between vectors, write out the rows to check signs.
Transpose and the dot product
Dot product (inner product)
⟨u,v⟩=u⊤v=i∑uivi=∥u∥∥v∥cosα
In wordsMultiply matching coordinates and add. Geometrically, it is length × length × cosine of the angle between the vectors.
Symbol by symbol
u⊤
"u transpose": the column turned into a row, so that row × column gives one number
⟨u,v⟩
other notation for the same number (used in L12)
∥u∥=∑iui2
Euclidean length of u (the 2-norm, sometimes written ∥u∥2)
α
the angle between u and v
Why it is trueThe cosine form comes from the law of cosines applied to the triangle with sides u, v, u−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.
The sign of a dot product tells you whether two vectors point "with" or "against" each other.The dot product measures how much of v points along u.
Matrix times vector: the row view and the column view
For A∈Rm×n (m rows, n columns) and x∈Rn, there are two equally correct ways to read Ax∈Rm:
Rows are restrictions; columns are recipes. Duality swaps the two (the transpose A⊤ turns columns into rows).
In wordsAx runs along a row of A. A⊤y runs down a column of A.
Symbol by symbol
Aji
entry in row j, column i: how much of resource j one unit of choice i uses
m
number of constraints (rows)
n
number of variables (columns)
A⊤
transpose: (A⊤)ij=Aji, an n×m matrix
When you use itDual constraints are (A⊤y)i≥ci: one per primal variable, built from a primal column.
Two identities are used constantly:
(A⊤y)⊤x=y⊤Ax=j∑i∑yjAjixi,(AB)⊤=B⊤A⊤.
In wordsA number equals its own transpose, so you can move A 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⊤b.
Linear combinations, cones and convex combinations
Name
Form
Allowed weights
Picture of all of them
Linear combination
∑jλjaj
any real λj
a line / plane through 0 (a subspace)
Conic (nonnegative) combination
∑jλjaj
λj≥0
a cone (a wedge from 0)
Convex combination
∑jλjaj
λj≥0,∑jλj=1
the 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 at most n vectors can be independent, and n independent vectors spanRn: 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
In wordsThe vector version of (a−b)2=a2−2ab+b2.
Symbol by symbol
∥a∥2=⟨a,a⟩
squared length (no square root, easier to handle)
Why it is true∥a−b∥2=⟨a−b,a−b⟩. Expand the inner product like a product of brackets, using ⟨a,b⟩=⟨b,a⟩.
When you use itTwice: in the separation proof (L11, with a=p−q, b=θ(z−q)) and in the gradient-descent proof (L12, with a=xt−x∗, b=ηgt).
Cauchy–Schwarz inequality
−∥u∥∥v∥≤⟨u,v⟩≤∥u∥∥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 v points opposite to u (or one of them is 0).
Why it is true⟨u,v⟩=∥u∥∥v∥cosα and −1≤cosα≤1. The lowest value, cosα=−1, occurs at α=180∘.
When you use itProving that −∇f(x) is the steepest descent direction (L12 §4.1).
Quick check: with A=120012111 and y=(5,0,2)⊤, compute A⊤y.
Show answer
Go down each column: column 1 gives 1⋅5+2⋅0+0⋅2=5, column 2 gives 0⋅5+1⋅0+2⋅2=4, column 3 gives 1⋅5+1⋅0+1⋅2=7. So A⊤y=(5,4,7)⊤. 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)=(∂x1∂f(x),…,∂xd∂f(x))⊤∈Rd
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→R
a function that takes d numbers and returns one number (a "landscape")
∂f/∂xi
rate of change of f if you move only coordinate i
When you use itGradient descent moves in direction −∇f.
Hessian
∇2f(x)=[∂xi∂xj∂2f(x)]i,j=1d∈Rd×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.
When you use itTesting convexity: f is convex exactly when v⊤∇2f(x)v≥0 for all v and x (Chapter 6).
Useful gradients to know by heart:
f(x)
∇f(x)
∇2f(x)
c⊤x (linear)
c
0
21∥x∥2
x
I
21x⊤Qx (Q symmetric)
Qx
Q
21∥Ax−b∥2 (least squares)
A⊤(Ax−b)
A⊤A
First-order Taylor expansion and little-o
Linear approximation
f(x+h)=f(x)+⟨∇f(x),h⟩+o(∥h∥)
In wordsNear x a smooth function looks like a plane (its tangent). The error is negligible compared to the step size ∥h∥ when h is tiny.
Symbol by symbol
h
a small step (a vector)
⟨∇f(x),h⟩
the predicted change, i.e. the directional derivative times the step
o(∥h∥)
"little-o": some error term e(h) with e(h)/∥h∥→0 as h→0
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
Symbol
Read as
Example
∀
for every
∀z∈C:v⊤z≤v⊤q
∃
there exists
∃y≥0 with A⊤y≥c
⟺, "iff"
if and only if (both directions)
f convex ⟺ tangent inequality
⇒
implies (one direction only)
primal unbounded ⇒ dual infeasible
{x:…}
the set of all x such that …
P={x:Ax≤b,x≥0}
argminx∈Kf(x)
a point of K where f is smallest (not the value)
x∗∈argminf; f(x∗) is the value
min vs inf
inf = greatest lower bound, may not be attained
infx>0x=0 but no minimum
max vs sup
sup = least upper bound
sup{x:x<1}=1, no maximum
θ↓0
θ tends to 0 from above
used in "take the limit" proofs
δ+(S)
edges leaving set S
a directed cut
P
set of all simple s-t paths
path-flow LP
Sums you will meet in convergence proofs
Harmonic sum
t=1∑Tt1≤1+lnT.
In wordsAdding 1+21+31+⋯+T1 grows only like a logarithm.
Symbol by symbol
ln
natural logarithm (in algorithm analysis log usually means ln or log2; they differ by a constant factor)
Why it is trueFor t≥2, t1≤∫t−1txdx because x1≥t1 on [t−1,t]. Summing from t=2 to T: ∑t=2Tt1≤∫1Txdx=lnT. Add the t=1 term.
When you use itStep-size schedules like ηt∝t1 produce such sums.
Why it is trueArithmetic and geometric series; the last one by the same integral comparison as above (∫0Tx−1/2dx=2T).
Six proof patterns used again and again
"Weighted sum of valid inequalities is valid": if a1≤b1 and a2≤b2 and y1,y2≥0, then y1a1+y2a2≤y1b1+y2b2. A negative weight flips the inequality. This one fact is all of LP duality.
"Take a tiny step along a segment": x+θ(y−x) with θ→0. It appears in convexity of sets, the tangent inequality, local ⇒ global, and separation.
"Telescoping": ∑t=0T−1(Rt−Rt+1)=R0−RT. Every middle term cancels. This is the core of the gradient-descent proof.
"Telescoping with changing weights": if each step gives a term atRt−btRt+1 with nonnegative Rt and coefficients that change with t, regroup by Rt:
t=0∑T−1(atRt−btRt+1)=a0R0+t=1∑T−1(at−bt−1)Rt−bT−1RT.
If at≤bt−1 for every t, each middle term is ≤0 and can be dropped; if also bT−1≥0, the whole sum is at most a0R0. Choosing step sizes or a potential functionΦt=(weight)⋅Rt so that the coefficients line up is how analyses with time-varying step sizes are done.
"The largest is at least the average" (and the smallest is at most the average): if a1+⋯+ak≥s, some ai≥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.
"Multiplicative shrinking": if at≤(1−k1)at−1, then at≤(1−k1)ta0≤e−t/ka0, using 1−x≤e−x (the tangent line of e−x at 0). The quantity falls below any target after about kln(a0/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)
maximizesubject toc⊤xAx≤bx≥0A∈Rm×n,b∈Rm,c∈Rn.
In wordsPick n nonnegative numbers x1,…,xn that make a linear score ∑icixi as large as possible, while m linear "budget" rows ∑iAjixi≤bj all hold.
Symbol by symbol
x∈Rn
the decision variables: what you choose (an n×1 column)
c∈Rn
objective coefficients: score per unit of each variable (n×1)
c⊤x=∑icixi
the objective, the number you maximize
A∈Rm×n
constraint matrix: one row per constraint, one column per variable
b∈Rm
right-hand sides: the limits (m×1)
Ax≤b
m inequalities ∑i=1nAjixi≤bj, one for each j=1,…,m
x≥0
n sign constraints xi≥0
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.
Dimension check: an m×n matrix times an n×1 vector gives an m×1 vector, the same shape as b.
The vocabulary, side by side
Word
Meaning
What it proves (max problem)
Feasible point x
satisfies all constraints
OPT≥c⊤x (a lower bound)
Optimal point x∗
feasible and best
OPT=c⊤x∗
OPT
a number, the best objective value
Certificate y (Chapter 3)
constraint weights
OPT≤b⊤y (an upper bound)
Why bother? What LPs give you
Modeling. Real variables and linear constraints express resource allocation, flows and many graph problems.
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).
Certificates. A feasible solution plus a matching dual solution proves optimality without rerunning anything (Chapter 3).
Geometry. At an optimum, tight constraints block every improving direction (Chapter 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.
Define the decisions and their units. For example "xi = liters of smoothie i" or "fe = flow on edge e". State whether each variable is ≥0, ≤0 or free. LP variables are real numbers.
Write the goal as a linear score. If one unit of choice i contributes ci, the total is ∑icixi. Use max for revenue or throughput and min for cost or error.
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.
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
Expression
Plain LP?
Why
3x1−2x2+7 as objective
Yes
Affine. The constant 7 shifts every value equally and does not change the optimizer.
3u−2v≥7
Yes
Linear. Multiply by −1 to get the ≤ form.
x1x2≤1
No
Product of two variables (nonlinear).
objective x12+x22
No
Quadratic. It is a convex optimization problem (Chapter 6), but not an LP.
xi∈{0,1} or xi∈Z
No
Discrete. This makes an integer program, which is NP-hard in general. Chapter 9 drops the integrality, solves the LP, and rounds.
x<2 (strict)
Not allowed
"max x s.t. x<2" has supremum 2 but no maximizing point.
∣x1∣≤3
Yes, after rewriting
Same as x1≤3 and −x1≤3.
max(x1,x2)≤3
Yes, after rewriting
Same as x1≤3 and x2≤3.
min(x1,x2)≤3
No
"x1≤3orx2≤3" 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.
Smoothie
Oranges
Bananas
Strawberries
Revenue / liter
1
1
2
0
$5
2
0
1
2
$4
3
1
1
1
$6
Let xi = liters of smoothie i. Each ingredient gives a constraint (a row) and each smoothie gives a variable (a column):
In wordsRows of A are fruits (orange, banana, strawberry). Columns are smoothies 1, 2, 3. m=n=3.
When you use itThe L9 exercise "write A,b,c" (the instructor wrote this A on the board).
Checking a candidate: x=(3,3,0)
Fruit
Usage at x=(3,3,0)
Stock
Status
Oranges
3+0=3
3
tight (all used)
Bananas
2⋅3+3+0=9
10
slack 1
Strawberries
2⋅3+0=6
6
tight
All variables are ≥ 0, so x is feasible. Its revenue is 5⋅3+4⋅3+6⋅0=27. This proves OPT≥27. 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∈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) 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 maxx1 s.t. 2x1≤1).
Is x=(1,4,1) feasible? What about (0,2,2)?
Show answer
(1,4,1): strawberries 2⋅4+1=9>6, so infeasible. (0,2,2): oranges 0+2=2≤3, bananas 0+2+2=4≤10, strawberries 4+2=6≤6. Feasible, with revenue 8+12=20≤27.
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 e a real variable fe, the amount of flow on it.
In wordsMaximize the net flow leaving the source. At every vertex other than s and t, what flows in must flow out. Every edge carries between 0 and its capacity.
Symbol by symbol
E, V
directed edges and vertices of the network
fuv
flow on edge u→v (a variable)
ce
capacity of edge e (given data, ≥ 0)
∑(u,v)∈Efuv
inflow into v: sum over all edges ending at v
∑(v,w)∈Efvw
outflow from v: sum over all edges starting at v
Why it is trueEach constraint is linear in the f's, so this is an LP. The objective uses net outflow because flow that leaves s and later returns to it should not count as throughput.
When you use itSize: ∣E∣ variables and O(∣E∣+∣V∣) constraints, i.e. polynomial. Compare the path LP in Chapter 4, which can have exponentially many variables.
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.
Solve by elimination:u−v=3 gives v=u−3, so 2u−v=u+3. This is smallest when u is smallest, i.e. u=0. So v=−3 and the minimum is 3. The transformed maximum is −3, attained for example at u=0,v+=0,v−=3.
Standard (equality) form with slack variables
Ax≤b,x≥0⟺Ax+s=b,x≥0,s≥0
In wordsAdd one nonnegative slack per row to absorb the unused amount.
Symbol by symbol
s=b−Ax
slack vector: sj is how much of resource j is left over
sj=0
row j is tight (fully used)
When you use itSlacks reappear in complementary slackness: yjsj=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)∣⇝mints.t.t≥e(x),t≥−e(x).
In wordsReplace ∣e∣ by a new variable t that must sit above both e and −e. Minimizing pushes t down until it equals the larger of the two, which is ∣e∣.
Symbol by symbol
e(x)
any affine expression in the variables, e.g. 3x1−x2+2
t
new free variable; the two constraints force t≥∣e(x)∣
Why it is trueFeasible t are exactly the numbers ≥max{e,−e}=∣e∣. At an optimum t is as small as possible, so t=∣e(x)∣. This is the same as minimizing over the epigraph of ∣⋅∣ (unit 6.2).
When you use itFor a sum∑i∣ei(x)∣, use one variable ti per term: min∑iti, ti≥±ei(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
xminimaxei(x)⇝mints.t.t≥ei(x)∀i.
In wordsA single variable t must be above every expression. Minimizing t makes it equal the largest one.
Symbol by symbol
t
free variable representing the worst (largest) value
maxi∣ei(x)∣
combine both tricks: t≥ei(x) and t≥−ei(x) for every i
When you use itMinimax ("make the worst case as good as possible") objectives: worst-case error, makespan, bottleneck capacity.
Mirror image: maximizing a minimum
xmaxjminej(x)⇝maxvs.t.v≤ej(x)∀j.
In wordsA variable v 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:
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).
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.
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 ≤ into =, write = as two ≤, negate to flip ≥ 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.
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
a blend (convex combination): λ parts of x and 1−λ parts of y
λ=1
gives x; λ=0 gives y; λ=21 gives the midpoint
λ∈[0,1]
as λ sweeps from 0 to 1 the blend traces the whole segment from y to x
Why it is trueIt is a definition, so nothing to prove. To show a set is not convex, one pair of points and one λ whose blend falls outside is enough.
When you use itLP regions (below), domains of convex functions, the separation theorem, and the local ⇒ global proof.
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.
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)
≤
uses Ax≤b, Ay≤b, and that the weights λ and 1−λ are both ≥0, so multiplying keeps the direction of ≤
last =
λ+(1−λ)=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 ≤.
Operations on convex sets
Operation
Convex?
Reason
intersection K∩L (even of infinitely many sets)
always
a segment between two points of K∩L lies in K (convex) and in L (convex), hence in both
union K∪L
not in general
a segment may start in K, end in L, and cross a gap in between
image or preimage under an affine map x↦Mx+v
always
affine maps send segments to segments
halfspace {a⊤x≤d}, hyperplane, ball, box, simplex
always
check the definition directly (for a ball: triangle inequality)
sublevel set {x:f(x)≤c} of a convex function
always
f(λx+(1−λ)y)≤λf(x)+(1−λ)f(y)≤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:
max2x1+3x2s.t.x1+x2≤5,x1≥1,x2≥0.
The feasible region is the triangle with corners (1,0), (5,0), (1,4).
Level lines of the objective
{x:c⊤x=q}={x:2x1+3x2=q}
In wordsEvery point on this line has the same score q. Changing q slides the line parallel to itself. Increasing q moves it in the direction of c=(2,3).
Symbol by symbol
q
the objective value (a number you choose); one line per value
c=(2,3)
the normal to the line (perpendicular to it), pointing toward larger q. It is not the slope.
Why it is trueMoving from a point x by a step h changes the objective by c⊤h. Steps along the line have c⊤h=0, so they are perpendicular to c. A step h=tc with t>0 changes it by t∥c∥2>0, so moving along c increases the score fastest.
When you use itGraphical LP solving: slide the line in direction c until it is about to lose contact with P. The last contact point(s) are optimal.
Vertex
2x1+3x2
Tight constraints (pin it down)
(1,0)
2
x1=1, x2=0
(5,0)
10
x1+x2=5, x2=0
(1,4)
14
x1=1, x1+x2=5
The unique optimum is (1,4) with value 14.
Non-unique optima
With objective x1+x2, every point of the edge from (1,4) to (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 maxx1 s.t. x1≤2,x2≤1,x≥0, where every point (2,x2) with 0≤x2≤1 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?
Outcome
Meaning
Example
Infeasible
No vector satisfies all constraints (P=∅).
x≥2,x≤1
Unbounded (objective)
Feasible points with arbitrarily large objective exist.
maxx s.t. x≥0
Finite optimum
The best value is finite, and an LP then attains it.
max−x s.t. x≥0: x∗=0
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.
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<d).
Symbol by symbol
a
the normal vector of the constraint, pointing out of the feasible side (the direction in which a⊤x grows)
d−a⊤x
the 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.
In wordsEach tight equation is a wall through the point. In Rn, n 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
B
the n×n matrix whose rows are a1⊤,…,an⊤
independent rows
B is invertible (detB=0), so x=B−1d 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)?
Tight at (3,3,0): oranges x1+x3=3, strawberries 2x2+x3=6, and x3=0 (that is, −x3≤0 is tight). Normals (1,0,1), (0,2,1), (0,0,−1) are independent: the determinant of the matrix with these rows is 1⋅(2⋅(−1)−1⋅0)−0+1⋅0=−2=0. Their only common solution is (3,3,0), so it is a vertex. Bananas are slack (9<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 n of the m+n constraints to be tight, so there can be up to (nm+n) vertices. That is exponential. A cube in Rn (0≤xi≤1) already has 2n corners. Even choosing among just 40 constraints gives 240≈1012 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 n independent tight constraints. They form a nonsingular square system Bx=d, so x=B−1d. Cramer's rule gives each coordinate:
Cramer's rule
xi=det(B)det(Bi),Bi=B with column i 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
because the n tight rows are independent
det of an integer matrix
a sum of n! signed products of n entries
Why it is trueClear denominators so all entries are integers of absolute value at most 2L. Then each product is at most 2nL and a sum of n!≤nn of them is at most 2nL+nlogn. That is O(nL+nlogn) 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 n variables with box constraints 0≤xi≤1 and only k other linear inequalities: every vertex has at most k 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) 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=27
In wordsWeighted sums of valid "≤" inequalities with nonnegative weights are still valid.
Symbol by symbol
5
weight (multiplier) on the orange constraint x1+x3≤3
0
weight on bananas (not used)
2
weight on the strawberry constraint 2x2+x3≤6
Why it is trueMultiplying x1+x3≤3 by 5≥0 keeps the direction, and so does multiplying by 2. Adding two valid ≤ inequalities gives a valid ≤.
Expand the left side: 5x1+4x2+7x3. Compare it to the objective coefficient by coefficient:
objective5x1+4x2+6x3≤5x1+4x2+7x3≤27for every feasible x.
In wordsThe combined left side beats the objective on every coefficient (5 ≥ 5, 4 ≥ 4, 7 ≥ 6). Since all xi≥0, it is at least the objective. So no feasible plan earns more than 27.
Why it is trueFirst ≤: 6x3≤7x3 because x3≥0 ("6 ≤ 7, and x3 is nonnegative"). Second ≤: the weighted sum above. Equivalently, add one copy of −x3≤0 to make the left side exactly the objective.
When you use it27 (feasible) ≤ OPT ≤ 27 (certificate), so OPT=27 and (3,3,0) is optimal.
When a lower bound and an upper bound meet, both are optimal (L9/L10 figure).
Mirror image: certificates for a minimization LP
For minc⊤x s.t. Ax≥b,x≥0, a feasible point gives an upper bound on 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.
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⊤y is a lower bound on every feasible cost.
Symbol by symbol
y≥0
multiplying a ≥ row by a nonnegative number keeps ≥
A⊤y≤c
the combination never "overcharges" any variable; with x≥0 this gives c⊤x≥(A⊤y)⊤x
b⊤y
the lower bound; the best one is maxb⊤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)maxc⊤x s.t. Ax≤b,x≥0. Put a weight yj on row j and add up.
Step 1: weighted sum of the rows
j=1∑myj(i=1∑nAjixi)≤j=1∑myjbj(valid if every yj≥0)
In wordsMultiply constraint j by yj and add all m of them.
Symbol by symbol
yj
the multiplier (weight, "price") on constraint j
∑iAjixi
left side of row j
∑jyjbj=b⊤y
the resulting upper bound
Why it is trueEach row satisfies (Ax)j≤bj. Multiplying by yj≥0 keeps ≤, and sums of ≤'s are ≤.
In wordsSwap the order of summation. The coefficient that multiplies xi is the column-i sum (A⊤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.
In wordsIf every combined coefficient is at least the objective coefficient, the combination is an upper bound on the objective for every feasible x.
Symbol by symbol
1st ≤
uses x≥0 and A⊤y≥c: cixi≤(A⊤y)ixi term by term
=
transpose identity: (A⊤y)⊤x=y⊤Ax
2nd ≤
uses y≥0 and Ax≤b
The primal–dual pair (canonical form)
(P)maxc⊤xs.t.Ax≤b,x≥0(D)minb⊤ys.t.A⊤y≥c,y≥0.
In wordsThe dual looks for the cheapest valid set of multipliers, i.e. the tightest upper bound.
Symbol by symbol
min
the smallest upper bound is the most informative one
A⊤y≥c
n constraints, one per primal variable (domination)
y≥0
m variables, one per primal constraint (direction kept)
When you use itRemember the duality "dictionary" below. It makes writing duals mechanical.
Primal (max)
Dual (min)
n variables xi
n constraints (A⊤y)i≥ci
m constraints (Ax)j≤bj
m variables yj≥0
objective coefficients c
right-hand sides c
right-hand sides b
objective coefficients b
matrix A (m×n)
matrix A⊤ (n×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.
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 y gives an upper bound on OPT. (2) If c⊤x=b⊤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.
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.
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,yS
prices of an orange, a banana, a strawberry
3yO+10yB+6yS
value of the whole inventory at those prices
row "smoothie 1"
1 orange + 2 bananas must be worth ≥ $5
Check y=(5,0,2):5+0=5≥5, 0+4=4≥4, 5+0+2=7≥6. Feasible, with value 15+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 y. Each dual constraint says that turning fruit into smoothie i earns no more than selling that fruit directly. So no production plan earns more than the inventory's value b⊤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>6 and it is not produced. These observations become complementary slackness.
Exercise (L10): check that (yO,yB,yS)=(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≥5, 1+4=5≥4, 3+1+2=6≥6: feasible. Bound 9+10+12=31, so OPT≤31. It is valid but loose (31 > 27). The dual minimizes over all valid certificates, and (5,0,2) is better. Together with x=(3,3,0) the pair (x,y) only proves x is within 31−27=4 of optimal.
Unit 3.4 · LP duality
Strong duality and what can go wrong
Sources: L10 §4; Lec10_SecB pp.2,4
Primal (max) values approach from below and dual (min) values from above. Weak duality: they never cross. Strong duality: their optima meet.
Result
Statement
What it lets you conclude
Weak duality
c⊤x≤b⊤y for every feasible pair.
Any dual point is an upper bound. A matching pair is optimal.
Strong duality
Finite 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
Primal
Dual can be…
Reason
finite optimum
finite optimum, same value
strong duality
unbounded (above)
infeasible
a feasible y would give a finite upper bound b⊤y
infeasible
unbounded (below) or infeasible
both are possible (see example)
Symmetrically, if the dual is unbounded below then the primal is infeasible. The possible status pairs are:
Primal \ Dual
finite optimum
unbounded
infeasible
finite optimum
possible (equal values)
impossible
impossible
unbounded
impossible
impossible
possible
infeasible
impossible
possible
possible
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) feature
Dual (min) feature
Why
constraint aj⊤x≤bj
yj≥0
a nonnegative multiple of a ≤ stays ≤
constraint aj⊤x≥bj
yj≤0
a nonpositive multiple turns ≥ into ≤
constraint aj⊤x=bj
yj free
an equality can be multiplied by any number
variable xi≥0
(A⊤y)i≥ci
cixi≤(A⊤y)ixi when xi≥0
variable xi≤0
(A⊤y)i≤ci
for xi≤0 the inequality flips
variable xi free
(A⊤y)i=ci
must hold for both signs of xi, which forces equality
The dual objective is always minb⊤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 problem
in a MIN problem
constraint, sensible
≤
≥
constraint, odd
=
=
constraint, bizarre
≥
≤
variable, sensible
≥0
≥0
variable, odd
free
free
variable, bizarre
≤0
≤0
Example: in a max primal, a ≥ constraint is bizarre, so its dual variable is bizarre for the min dual, i.e. yj≤0. 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
Name a dual variable per primal constraint (y1,…,ym). Write its sign using the table (or S-O-B).
Dual objective:min∑jbjyj if the primal is max (max∑jbjyj if the primal is min). Coefficients are the primal right-hand sides.
One dual constraint per primal variable xi: read down column i of the primal: ∑jAjiyj□ci, where □ is ≥, ≤ or = from the sign of xi.
Sanity checks: the counts (m dual variables, n 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≥0. All variables are ≥ 0, so every dual constraint is ≥. Columns of A: (1,2,0), (0,1,2), (1,1,1). The result is the dual in unit 3.3.
Worked example 2 (mixed): equality row and a free variable
max2u+vs.t.u+v≤4(α),u−v=1(β),u≥0,vfree.
Row 1 is ≤ in a max problem: α≥0. Row 2 is =: β free.
Objective: min4α+β.
Column u is (1,1) and u≥0: α+β≥2. Column v is (1,−1) and v is free: α−β=1.
min4α+βs.t.α+β≥2,α−β=1,α≥0,βfree.
Check with a matching pair: primal u+v=4,u−v=1 gives u=2.5,v=1.5, value 6.5. Dual α−β=1,α+β=2 gives α=1.5,β=0.5, value 6+0.5=6.5. Both feasible with equal values, so both are optimal.
Row 1 is ≥ in a min problem (sensible): y1≥0. Row 2 is ≤ in a min problem (bizarre): y2≤0.
Column x1=(1,1) with x1≥0 (sensible). In a max dual the sensible constraint is ≤: y1+y2≤3. Column x2=(1,−1), free: y1−y2=2.
max4y1+2y2s.t.y1+y2≤3,y1−y2=2,y1≥0,y2≤0.
Solve both to check. Primal: x2≥max(4−x1,x1−2) and x2 has positive cost, so take it as small as possible. For x1≤3 the objective is 3x1+2(4−x1)=x1+8, minimized at x1=0,x2=4: value 8. Dual: y1=2+y2, so the objective is 8+6y2 with y2≤0, maximized at y2=0,y1=2. Check y1+y2=2≤3. Value 8. They match.
Write (D) as a max problem: max(−b)⊤y s.t. (−A⊤)y≤−c,y≥0. This is canonical, with data (−A⊤,−c,−b). Its dual is min(−c)⊤x s.t. (−A⊤)⊤x≥−b,x≥0, i.e. min−c⊤x s.t. −Ax≥−b. That is maxc⊤x s.t. Ax≤b,x≥0: the primal again.
Unit 3.6 · LP duality
Complementary slackness: where the duality gap lives
For a feasible pair, the duality gap b⊤y−c⊤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.
Symbol by symbol
sj
unused amount of resource j (primal slack of row j)
ri
how much the priced cost of product i exceeds its revenue (dual slack of column i): the "loss per unit" of making product i
The gap identity
b⊤y−c⊤x=y⊤(b−Ax)+x⊤(A⊤y−c)=j∑yjsj+i∑xiri.
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⊤c. The middle two terms cancel because x⊤A⊤y=y⊤Ax. What remains is b⊤y−c⊤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>0
primal row j is tight
a resource with positive price is fully used
primal row j is slack
yj=0
leftover resources are worth nothing at the margin
xi>0
dual row i is tight
anything produced has priced cost exactly equal to revenue
dual row i is slack
xi=0
a product whose ingredients are worth more than it sells for is not made
Using slackness to find a solution
From x to y. Suppose x=(3,3,0) is optimal. Bananas are slack, so yB=0. Since x1,x2>0, dual rows 1 and 2 are tight: yO+2yB=5 and yB+2yS=4. Hence y=(5,0,2). Check the remaining dual row: 5+0+2=7≥6. ✓
From y to x. Start from y=(5,0,2). Dual row 3 is slack (7>6), so x3=0. yO,yS>0 force the orange and strawberry rows to be tight: x1+x3=3, 2x2+x3=6. Hence x=(3,3,0). Check bananas separately: 9≤10. ✓
Resource
slack sj
price yj
yjsj
Smoothie
ri
xi
xiri
Oranges
0
5
0
1
5−5=0
3
0
Bananas
1
0
0
2
4−4=0
3
0
Strawberries
0
2
0
3
7−6=1
0
0
Tight does not mean positive: an example (L11 exercise)
maxx1 s.t. x1≤1,x2≤0,x≥0. The unique optimum is (1,0), where the second row x2≤0 is tight. The dual is miny1+0⋅y2 s.t. y1≥1,y2≥0. The optimum y=(1,0) puts multiplier 0 on that tight row. This does not contradict complementary slackness: y2⋅slack2=0⋅0=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=:δ
In wordsEven without knowing OPT, a feasible y tells you how far a feasible x can be from optimal: at most the gap.
Symbol by symbol
δ
the duality gap of the pair (x,y), always ≥ 0 for a feasible pair
Why it is trueLeft: x is feasible, so c⊤x≤OPTP. Right: weak duality gives OPTP≤b⊤y. Subtract c⊤x everywhere.
When you use itL11 exercise: "Using only weak duality, show that a feasible pair with b⊤y−c⊤x≤ε certifies OPT−c⊤x≤ε." 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=1∑mj=1∑npiAijqj
In wordsAverage Alice's payoff over the random row (probabilities p) and the independent random column (probabilities q).
Symbol by symbol
pi
probability Alice plays row i
qj
probability Bob plays column j
(p⊤A)j=∑ipiAij
Alice's expected payoff if Bob plays the pure column j
(Aq)i
Alice's expected payoff from pure row i against Bob's mix q
Guaranteed values
Alice commits firstp∈Δmmaxq∈Δnminp⊤AqandBob commits firstq∈Δnminp∈Δmmaxp⊤Aq
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
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=∑jcjqj is a weighted average of the cj with weights qj≥0 summing to 1, and an average is never below its smallest entry. Putting q=ej on the smallest cj attains it. (Geometrically: the vertices of Δn are the unit vectors ej, and a linear objective is optimized at a vertex, unit 2.5.)
Tool 2: the easy inequality (weak duality for games)
pmaxqminp⊤Aq≤qminpmaxp⊤Aq.
Why it is trueFor any p′ and q′: minqp′⊤Aq≤p′⊤Aq′≤maxpp⊤Aq′. The left side does not depend on q′ and the right side does not depend on p′, so maximize the left over p′ and minimize the right over 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 p is minj(p⊤A)j, a minimum of linear functions of p. Maximizing a minimum is an LP via the "maximize a minimum" trick of unit 1.6 (a free variable v below every column payoff, plus the simplex constraints on p). 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 gives a free dual variable; the free v 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
maxp∈P∑xps.t.p∋e∑xp≤ce(∀e∈E),xp≥0(∀p∈P).
In wordsSend xp units along each s–t path p. 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
the finite set of all simple directed s–t paths (can be exponentially many)
xp
how much flow is sent along path p
p∋e
"paths p that contain edge e"
∑p∋exp
total flow on edge e contributed by all paths through it
ce
capacity of edge e
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.
Two paths with 2 units each give total flow 4. Edge s→a only carries the blue path, so its row reads xsat≤3.
Why path LP and edge LP have the same optimum
Path → edge. Set fe=∑p∋exp. Each path conserves flow at every interior vertex (one unit in, one unit out), so the sum does too. The capacity rows give fe≤ce. The value is ∑pxp.
Edge → path (flow decomposition). Any feasible flow of nonnegative value splits into s–t path flows plus cycle flows. Cycles add no value and can be discarded. One way to see it: add an edge t→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→s are s–t 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 e the multiplier ye≥0 (≤ rows in a max problem). Column xp has a 1 in row e exactly when e∈p, and objective coefficient 1. Applying the recipe:
(D_length)
mine∈E∑ceyes.t.e∈p∑ye≥1(∀p∈P),ye≥0(∀e∈E).
In wordsAssign each edge a nonnegative lengthye so that every s–t path has total length at least 1. Minimize the capacity-weighted total length.
Symbol by symbol
ye
length of edge e (dual variable of its capacity row)
∑e∈pye≥1
dual constraint for variable xp: path p is at least 1 long
∑eceye
"cost" of the length assignment, not the length of any single path
Why it is trueRecipe: dual constraint for xp = column of xp (1's on edges of p) ⋅y≥ objective coefficient 1. Dual objective = capacities · y.
When you use itThink of ye as how much of edge e you cut: every s–t 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.
Pipe thickness = capacity. Every route from s to t passes through exactly one pink pipe, so giving the pink pipes length 1 puts t at distance 1. That costs 4 units of material, the same as the maximum flow.
In wordsPut length 1 on edges leaving S and 0 elsewhere. The dual cost is exactly the cut capacity.
Symbol by symbol
S
a vertex set with s∈S, t∈/S (an s–t cut)
δ+(S)
directed edges leaving S; edges entering S do not count
c(δ+(S))
capacity of the cut
Why it is trueAny s–t path starts inside S and ends outside, so it must use at least one edge of δ+(S). Its length is ≥ 1, so the solution is feasible.
Example: S={s,a,b} gives the edges a→t (cap 2) and b→t (cap 3), so dual value 5.
So far: max flow=OPT(Dlength)≤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 s, and cut the graph at a "radius" r.
In wordsCompute shortest-path distances d(v) from s using lengths y. Cap them at 1. For a threshold r, Sr is the "ball" of all vertices within distance r of s.
Symbol by symbol
d(v)
shortest-path distance from s to v with edge lengths ye (+∞ if unreachable)
ℓ(v)
clipped distance, always in [0,1]
Sr
also written Br={v:d(s,v)≤r}, a ball around s (same set for r<1)
ℓ(t)=1
feasibility says every path has length ≥1, so d(t)≥1 (Observation 1)
Why it is trues∈Sr since ℓ(s)=0≤r. t∈/Sr since ℓ(t)=1>r. So every Sr is an s–t cut.
The running example. Dashed rings are the clipped distances ℓ(a)=0.4, ℓ(b)=0.7, ℓ(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 lengthmax{0,ℓ(v)−ℓ(u)}≤yuv.
In wordsAs r sweeps from 0 to 1, edge u→v leaves the cut set only while the "gate" r is past u but not yet past v. That window is at most as long as the edge itself.
Symbol by symbol
ℓ(u)≤r
tail u is inside the ball
r<ℓ(v)
head v is outside
max{0,⋅}
if ℓ(v)≤ℓ(u) the edge never crosses outward
Why it is trueIf d(u)<1: shortest paths satisfy the triangle inequality d(v)≤d(u)+yuv, and clipping at 1 can only shrink a positive difference. If d(u)≥1 or u is unreachable, ℓ(u)=1≥ℓ(v) and the window is empty.
When you use itObservation 2: edge e=(u,v) is cut with probability ≤ye. If r is drawn uniformly from (0,1), the probability that e is cut is the window length, at most ye.
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
average over r∈(0,1) (area under a step function; no calculus is really needed)
equality
swap "sum over edges" and "average over r": an edge contributes cuv for a window of length max{0,ℓ(v)−ℓ(u)}
≤
the key lemma, edge by edge
Why it is trueThe cut only changes when r passes one of the finitely many distances ℓ(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))≤e∑ceye.
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 cuts), and keep the cheapest.
The example, computed by hand
Capacities csa=3,cat=2,csb=2,cbt=3. Lengths ysa=.4,yat=.6,ysb=.7,ybt=.3. Both paths have length exactly 1, so the solution is feasible. Distances: ℓ(s)=0,ℓ(a)=.4,ℓ(b)=.7,ℓ(t)=1.
The cut {s,a} costs 4≤4.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.
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} 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 ye, how does one Dijkstra run verify every constraint of Dlength or exhibit a violated one? Why don't we need to list all paths? What if t is unreachable?
Show answer
Run Dijkstra from s with lengths ye (valid because y≥0). The shortest s–t distance d(t) is the minimum length over all paths. If d(t)≥1 then every path has length ≥ 1, so all (exponentially many) constraints hold at once. If d(t)<1, the shortest path found is an explicit violated constraint. We only ever need the minimum path length, not the list. If t is unreachable, d(t)=∞≥1: there are no s–t 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.
At an optimum x∗, the objective direction c is a nonnegative combination of the outward normals of the constraints that are tight at 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.
Symbol by symbol
r≤m
original rows: ar = row r of A, dr=br
r>m
sign rows: ar=−ei (minus the i-th unit vector), dr=0
S
the set of rows that are tight at x∗: ar⊤x∗=dr
The claim to prove
c=r∈S∑λrarfor some λr≥0.
In wordsThe objective direction lies in the cone generated by the tight outward normals.
Symbol by symbol
λr
nonnegative weights; these will become the dual solution
S
only tight constraints are used
At the optimum (red ball) the objective direction c splits into nonnegative amounts of the touching walls' outward normals. Those amounts are the dual solution.
The three steps
Farkas' lemma: either c is in the cone of tight normals, or there is a direction v that moves "into" every tight wall's allowed side while improving the objective.
Contradiction: a tiny step along such a v is feasible and strictly better, which is impossible at an optimum. So c is in the cone.
Read off the dual: the weights λr on original rows form a dual-feasible y with b⊤y=c⊤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=1∑kλjaj:λj≥0}={Mλ:λ≥0},M=[a1⋯ak].
In wordsEverything you can build by adding nonnegative amounts of the generators a1,…,ak. In 2-D it is a wedge from the origin.
Symbol by symbol
aj∈Rd
generator vectors, the columns of M
λj≥0
amounts; negative amounts are not allowed (otherwise you would get a whole subspace)
Mλ
the column view: Mλ=∑jλjaj
When you use it"Is p in the cone?" is the feasibility question "Mλ=p,λ≥0".
Reading system (II)
M⊤w≥0⟺aj⊤w≥0∀j,p⊤w<0.
In wordsFind a test direction w such that every generator has a nonnegative dot product with w (all lie on one side of the line w⊤z=0) while p has a negative one (p is strictly on the other side).
Why it is trueEvery point of the cone, ∑λjaj, then also has w⊤(⋅)=∑λjaj⊤w≥0. So p cannot be in the cone. w is a short, checkable proof that (I) is infeasible.
Why both cannot hold (the easy half)
p⊤w=(Mλ)⊤w=λ⊤(M⊤w)≥0
In wordsIf p were built from the generators, its test value would be a nonnegative mixture of nonnegative numbers, so not negative.
Why it is trueλ≥0 and M⊤w≥0, so their dot product is ≥ 0. That contradicts p⊤w<0.
The substantive half is that when p∈/C, a witness walways 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∈argz∈Cmin∥p−z∥,v=p−q.
In wordsLet q be the point of C closest to p. The arrow v from q to p is the normal of a wall through q that keeps all of C on one side and p on the other.
Symbol by symbol
q
nearest point of C to p; it exists because C is closed and nonempty (restrict to a closed ball around p, which is compact)
v=p−q
points from the set toward the outside point
v⊤z≤v⊤q
every point of C lies on or behind the wall {z:v⊤z=v⊤q}
Proof: why the nearest point works
Take any z∈C. By convexity the whole segment q+θ(z−q)=θz+(1−θ)q, 0≤θ≤1, lies in C. Measure its squared distance to p:
Expanding the squared distance
∥p−(q+θ(z−q))∥2=∥p−q∥2−2θv⊤(z−q)+θ2∥z−q∥2.
In wordsThe distance from p to a point that has moved a fraction θ toward z is the old distance, minus a term that is linear in θ, plus a term that is quadratic in θ.
Symbol by symbol
a=p−q=v, b=θ(z−q)
then p−(q+θ(z−q))=a−b; apply ∥a−b∥2=∥a∥2−2a⊤b+∥b∥2
−2θv⊤(z−q)
the linear term; it dominates for small θ
θ2∥z−q∥2
the quadratic term; negligible for small θ
Why it is trueIf v⊤(z−q)>0, then for small enough θ>0 the negative linear term beats the positive quadratic term (θ2 is much smaller than θ). The point q+θ(z−q)∈C would then be closer to p than q, contradicting the choice of q.
When you use itConclusion: v⊤(z−q)≤0, i.e. v⊤z≤v⊤q for all z∈C. Finally v⊤p−v⊤q=v⊤v=∥p−q∥2>0 because p=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λ and Mμ with λ,μ≥0. For θ∈[0,1]: θMλ+(1−θ)Mμ=M(θλ+(1−θ)μ), and θλ+(1−θ)μ≥0. 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∈/C, so there are v,q with v⊤p>v⊤q≥v⊤z for all z∈C.
Step 2: the upper bound v⊤q is at least 0
0∈C (take all λj=0), so v⊤q≥v⊤0=0.
Step 3: every generator has v⊤aj≤0
The scaling argument
taj∈C∀t≥0⟹t(v⊤aj)≤v⊤q∀t≥0⟹v⊤aj≤0.
In wordsA cone contains every stretched copy of each generator. If some generator had a positive dot product with v, stretching it would push v⊤(taj) to infinity, past the fixed number v⊤q. So no generator can have a positive dot product.
Why it is trueIf v⊤aj>0, choose t>v⊤q/(v⊤aj). Then tv⊤aj>v⊤q, which contradicts separation.
Step 4: p is strictly on the positive side
By Step 3 every cone point z=∑λjaj has v⊤z=∑λjv⊤aj≤0. In particular v⊤q≤0, and with Step 2, v⊤q=0. Separation then gives v⊤p>v⊤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.
In wordsSeparation's normal points towardp. Farkas orients it the other way, so that generators score ≥ 0 and p scores < 0. Negating v 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 exists
Certificate's sign
(F1) Ax=b,x≥0
A⊤y≥0,b⊤y<0
y free
(F2) Ax≤b,x≥0
A⊤y≥0,b⊤y<0
y≥0
(F3) Ax≤b (x free)
A⊤y=0,b⊤y<0
y≥0
(F1) is the lecture's version with M=A, p=b, w=y: "b is in the cone of the columns of A, 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.
In wordsA contradiction, so if the certificate exists the system is infeasible.
Symbol by symbol
first =
A⊤y=0
≤
Ax≤b and y≥0 (nonnegative weights keep ≤)
<
b⊤y<0
Worked conversion: (F1) ⇒ (F2)
Rewrite the system in (F1)'s form. Add slacks: Ax≤b,x≥0 has a solution iff Ax+s=b,x≥0,s≥0 has one, i.e. iff [AI](sx)=b with (sx)≥0.
Apply (F1) with the matrix A′=[AI]: infeasible iff some y has A′⊤y≥0 and b⊤y<0.
UnpackA′⊤y=(yA⊤y)≥0: that is A⊤y≥0andy≥0. The slack columns are what force y 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,λ≥0fails. Apply Farkas with M=[ar]r∈S (tight normals as columns) and p=c. We get w with ar⊤w≥0 for all tight r, and c⊤w<0. Set v=−w:
An improving, feasible direction
ar⊤v≤0(r∈S),c⊤v>0.
In wordsv does not push outward through any tight wall, yet it strictly increases the objective.
Symbol by symbol
ar⊤v≤0
moving along v does not increase constraint r's left side, so tight row r stays satisfied
c⊤v>0
the objective goes up along v
Now step from x∗ to x∗+εv and check every constraint:
Tight constraints stay feasible
ar⊤(x∗+εv)==drar⊤x∗+ε≤0ar⊤v≤dr(r∈S).
In wordsar⊤x∗+εar⊤v=dr+(something≤0)≤dr: a tight wall is never crossed.
In wordsEach slack constraint has a positive cushion δr. Moving along v uses it up at rate ar⊤v (if positive), so a step of size up to δr/(ar⊤v) is safe.
Symbol by symbol
δr
slack (cushion) of inactive row r
ar⊤v≤0
then row r never gets closer to its wall, so no restriction
finitely many rows
so the minimum of the ratios is a positive number: one ε>0 works for all rows at once, including the sign rows
Contradiction
c⊤(x∗+εv)=c⊤x∗+εc⊤v>c⊤x∗.
In wordsA feasible point with a strictly higher objective, which is impossible because x∗ is optimal. So the claim holds: cis 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λrar with λr≥0. Give every inactive row coefficient 0 (this is the equation y(a⊤x−b)=0: an inactive row gets weight 0). Split the coefficients:
Split into original rows and sign rows
c=j=1∑myj(row j of A)+i=1∑nzi(−ei)=A⊤y−z,y≥0,z≥0.
In wordsThe weights on the m original constraints are y. The weights on the n sign constraints −xi≤0 are z.
Symbol by symbol
yj=λj
coefficient of original row j (zero if that row is slack at x∗)
zi
coefficient of the sign row −xi≤0 (zero if xi∗>0)
−z
the normals of sign rows are −ei, which is why z enters with a minus
y is dual feasible
A⊤y=c+z≥c,y≥0.
In wordsSince z≥0, the combined coefficients dominate c. This is exactly the dual constraint. And z=A⊤y−c is the dual slack vector.
…with the same value as x*
c⊤x∗=r∈S∑λrar⊤x∗=r∈S∑λrdr=b⊤y.
In wordsEvery row with a positive weight is tight (ar⊤x∗=dr). Sign rows have dr=0, so they contribute nothing to the right side. What is left is ∑jyjbj.
Finish:x∗ is primal feasible, y is dual feasible, and c⊤x∗=b⊤y. By weak duality y is dual-optimal and the two optimal values coincide. This is strong duality. ∎
L11 exercise: max(−x) s.t. x≤1,x≥0
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=−1. Dual: miny s.t. y≥−1,y≥0, so y∗=0. Primal optimum x∗=0. Both values are 0, so the pair is optimal. At x∗=0 the tight row is −x≤0 (normal −1), and x≤1 is slack (so y=0). Decomposition: c=A⊤y−z=0−1 with z=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)
Modeling: real variables and linear constraints express resource allocation and graph problems.
Algorithms: polynomial-size rational LPs are solvable in polynomial time in their encoding length.
Certificates: a feasible solution and a matching dual solution prove optimality.
Geometry: at an optimum, tight constraints block every improving direction. Farkas turns this into multipliers.
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
x∈Kminf(x),f:Rd→R,K⊆Rd nonempty and convex.
In wordsFind the lowest point of a landscape f over an allowed region K.
Symbol by symbol
d
dimension (number of variables); L12 uses d where the LP lectures used n
K
feasible set; in the main L12 theorem K=Rd (unconstrained)
x∗
a minimizer. Writing x∗assumes one exists (e.g. ex on R has none)
ε-optimal (additive)
x∈Kandf(x)−f(x∗)≤ε.
In wordsA feasible answer whose value is at most ε above the best possible value.
Symbol by symbol
f(x)−f(x∗)
the optimality gap (objective error), always ≥ 0
ε
the tolerance you are willing to accept
When you use itGradient descent guarantees this with ε=DG/T. Note it is additive, not a ratio f(x)/f(x∗), which would be meaningless if f(x∗)≤0.
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].
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)) and (y,f(y)).
Symbol by symbol
θx+(1−θ)y
a point on the segment between x and y (in K because K is convex)
f(θx+(1−θ)y)
height of the graph above that point
θf(x)+(1−θ)f(y)
height of the chord above that point
K
domain; it must be convex or the left side might not even be defined
Why it is trueA definition. L12 writes it with λ, the board with θ, sometimes as (1−θ)x+θy. These are all the same statement with the roles of x,y swapped.
When you use itProving local ⇒ global; the many-point (Jensen) inequality for the average iterate; and, in the limit θ→0, the tangent inequality.
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
true value at yf(y)≥tangent plane at x, evaluated at yf(x)+⟨∇f(x),y−x⟩
In wordsBuild the tangent line (plane) at any point x. For a convex function it lies below the graph everywhere, not only near x. So local slope information gives a global lower bound.
Symbol by symbol
f(x)+⟨∇f(x),y−x⟩
first-order Taylor polynomial ("Taylor of degree 1") of f around x
⟨∇f(x),y−x⟩
predicted change: slope vector · displacement
y−x
the difference between the two points
When you use itPlugging in y=x∗ gives the inequality that drives the whole gradient-descent proof.
Proof (⇒): from chords to tangents
Write the blend toward y as x+θ(y−x)=θy+(1−θ)x. Convexity gives f(x+θ(y−x))≤θf(y)+(1−θ)f(x).
Subtract f(x) from both sides: f(x+θ(y−x))−f(x)≤θ(f(y)−f(x)).
Divide by θ>0 (keeps the direction): θf(x+θ(y−x))−f(x)≤f(y)−f(x).
Let θ↓0. The left side is a difference quotient along direction y−x, which converges to the directional derivative⟨∇f(x),y−x⟩. So ⟨∇f(x),y−x⟩≤f(y)−f(x). ∎
Proof (⇐): from tangents to chords
Let z=λx+(1−λ)y. Apply the tangent inequality at z, once toward x and once toward y:
f(x)≥f(z)+⟨∇f(z),x−z⟩,f(y)≥f(z)+⟨∇f(z),y−z⟩.
Multiply by λ and 1−λ and add. The gradient terms combine into ⟨∇f(z),λx+(1−λ)y−z⟩=⟨∇f(z),0⟩=0. What remains is λf(x)+(1−λ)f(y)≥f(z), which is convexity. ∎
The inequality to remember
Objective error ≤ gradient inner product
f(x)−f(x∗)≤⟨∇f(x),x−x∗⟩.
In wordsHow far you are above the optimum in value is at most (your slope) · (your displacement from the optimum).
Symbol by symbol
x∗
a minimizer (unknown to the algorithm, but usable in the analysis)
left side
the objective error, ≥ 0
right side
an inner product that appears when you expand a gradient step
Why it is truePut y=x∗ in the tangent inequality: f(x∗)≥f(x)+⟨∇f(x),x∗−x⟩. Move terms: f(x)−f(x∗)≤−⟨∇f(x),x∗−x⟩=⟨∇f(x),x−x∗⟩.
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,j∑Hijvivj≥0∀v.
In wordsIn every direction v, the curvature (second derivative along that direction) is nonnegative: the function bends upward or is flat, never downward.
Symbol by symbol
∇2f(x)
Hessian: the matrix of second partial derivatives ∂2f/∂xi∂xj
v⊤Hv
second derivative of f along the line through x in direction v
⪰0
"is PSD" (not entrywise ≥ 0!)
Why it is trueRestrict f to a line: g(t)=f(x+tv). The chain rule gives g′′(t)=v⊤∇2f(x+tv)v. A 1-D function is convex iff g′′≥0, and f is convex iff its restriction to every line is convex.
When you use itQuick convexity checks: in 1-D just check f′′≥0. For a 2×2 symmetric H=(abbc): PSD ⇔ a≥0,c≥0,ac−b2≥0. In general: PSD ⇔ all eigenvalues ≥ 0.
Worked examples
f
Hessian / f′′
Convex?
x2/2
1
yes (strictly)
ex
ex>0
yes (but no minimizer on R)
x3
6x, negative for x<0
no
(x2−1)2
12x2−4, negative near 0
no (two local minima at ±1)
x12+x1x2+x22
(2112): 2≥0,4−1≥0
yes
x12−x22
(200−2)
no (saddle)
21∥Ax−b∥2
A⊤A: v⊤A⊤Av=∥Av∥2≥0
yes
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.
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 ≤
convexity of each fi
2nd ≤
θfi(x)≤θmaxkfk(x) and similarly for y, for every i (uses θ,1−θ≥0)
Why it is trueEpigraph view: the epigraph of maxifi 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); piecewise-linear maxj(aj⊤x+bj); ∥x∥=max∥u∥≤1u⊤x; and the "worst case over scenarios" objectives used in LP modeling.
The upper envelope (solid) of three lines (dashed) is convex, even though it has corners.
In wordsTake near-optimal partners y1,y2 for x1,x2. Blending them gives a valid (but not necessarily best) partner for the blended x, so the best value at the blend is no worse than the blend of the values.
Symbol by symbol
y1,y2∈Y
chosen with f(xk,yk)≤g(xk)+ε (they exist by definition of inf)
1st ≤
θy1+(1−θ)y2∈Y because Y is convex, and g is an infimum over all y∈Y
2nd ≤
joint convexity of f in the pair (x,y)
3rd ≤
the choice of y1,y2
Why it is trueThe inequality holds for every ε>0, so it holds with ε=0.
When you use itThe distance to a convex set, dist(x,C)=infy∈C∥x−y∥, is convex because ∥x−y∥ is jointly convex. That is the function the separation theorem minimizes.
Partial minimization: minimizing the jointly convex ∣x−y∣ over y in a convex set leaves a convex function of x.
The rest of the toolbox
Operation
Result
Reason
αf+βg, α,β≥0
convex
add the two chord inequalities with nonnegative weights
f(Ax+b) (affine input)
convex
affine maps send segments to segments
any norm ∥x∥
convex
triangle inequality + scaling
maxifi
convex
Rule 1
infy∈Yf(x,y)
convex
Rule 2
min(f,g), f⋅g, f−g
not in general
min(x2,(x−2)2) has two dips. A product can fail, even when both factors are nonnegative. A difference can fail because −g is concave.
Show f(x)=∥Ax−b∥2+max(0,1−x1) is convex.
Show answer
∥⋅∥ is convex and x↦Ax−b is affine, so the first term is convex. max(0,1−x1) 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)=21∥Ax−b∥22,∇f(x)=A⊤(Ax−b),∇2f(x)=A⊤A.
In wordsFit x so that the predictions Ax match the measurements b as closely as possible in squared error.
Symbol by symbol
A∈Rm×d
m measurements (rows), d unknowns (columns)
r=Ax−b∈Rm
residuals: errors in measurement space
A⊤r∈Rd
residuals sent back to the variables responsible for them: the gradient lives in variable space
21
cosmetic; it cancels the 2 from differentiating a square
Why it is trueWrite rj=∑iAjixi−bj and f=21∑jrj2. The chain rule gives ∂f/∂xi=∑jrj∂rj/∂xi=∑jrjAji=(A⊤r)i. Differentiating again, ∂2f/∂xi∂xk=∑jAjiAjk=(A⊤A)ik.
When you use itConvexity: v⊤A⊤Av=∥Av∥2≥0, so the Hessian is PSD everywhere.
Each residual is a spring stretched between a data point and the line. Total spring energy is 21∥Ax−b∥2. The line comes to rest where the net force is zero: A⊤(Ax−b)=0, the normal equations.
Normal equations
∇f(x)=0⟺A⊤Ax=A⊤b.
In wordsSetting the gradient to zero (enough for convex f, see the next unit) gives a linear system for the best fit.
Why it is trueIf the columns of A are independent, A⊤A is positive definite (∥Av∥2>0 for v=0): f is strictly convex with the unique minimizer x∗=(A⊤A)−1A⊤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
Walk from x^ toward a better point y. For small θ the point zθ is inside the neighbourhood, yet it is better than x^. Contradiction.
Stationary points and constraints
Unconstrained, differentiable, convex
∇f(x)=0⟺x is a global minimizer (on Rd).
In wordsFor convex functions on all of Rd, "flat" means "best".
Why it is true(⇒) Tangent inequality with ∇f(x)=0 gives f(y)≥f(x) for all y. (⇐) 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∗∈argx∈Kminf(x)⟺⟨∇f(x∗),y−x∗⟩≥0∀y∈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∗).
When you use itFor an LP (f=−c⊤x) this is exactly the active-normal picture of Chapter 5: −∇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 x 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∥).
In wordsFor a short step h, the change in f is essentially ⟨∇f(x),h⟩. To decrease f as fast as possible, make this inner product as negative as possible.
Symbol by symbol
⟨∇f(x),h⟩
first-order (linear) prediction of the change
o(∥h∥)
error, negligible compared with ∥h∥ for small steps
Step 2: the angle picture (board)
−1≤cosα=∥v∥∥w∥⟨v,w⟩≤1⟹⟨v,w⟩≥−∥v∥∥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∘).
Symbol by symbol
α
the angle between v and w
cosα=−1
opposite 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∥≤ρ,
In wordsWith step length at most ρ, the predicted decrease can never exceed ρ∥∇f(x)∥. It reaches that bound exactly at h=−ρ∇f(x)/∥∇f(x)∥, pointing straight against the gradient.
Symbol by symbol
ρ
allowed step length (a radius)
∇f(x)/∥∇f(x)∥
unit vector in the gradient direction
Why it is trueCauchy–Schwarz with v=∇f(x),w=h, then ∥h∥≤ρ. Equality needs cosα=−1 and ∥h∥=ρ.
When you use itThere are many directions to move: pick the best one by minimizing this. −∇f is the steepest first-order descent direction in Euclidean distance.
In wordsStart at x0. Repeatedly compute the slope where you stand and take a step of size η times the slope, downhill.
Symbol by symbol
xt
the iterate (current point) after t steps
η>0
the step size (learning rate), constant in the L12 theorem
∇f(xt)
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/2
f′(x)=x⟹xt+1=xt−ηxt=(1−η)xt⟹xt=(1−η)tx0.
In wordsEach step multiplies the position by the same factor 1−η. Everything depends on the size and sign of that factor.
Step size
factor 1−η
Behaviour from x0=0
0<η<1
in (0,1)
converges, same side (η=21: xt=2−tx0)
η=1
0
reaches the optimum in one step
1<η<2
in (−1,0)
alternates sides but converges
η=2
−1
xt=(−1)tx0: bounces forever, never improves
η>2
∣1−η∣>1
∣xt∣ grows: diverges
Two dimensions: why the zig-zag happens
On a stretched bowl f(x)=21(x12+κx22) each coordinate has its own factor: x1←(1−η)x1 and x2←(1−ηκ)x2. Stability needs η<2/κ for the steep direction, but then the shallow direction shrinks by only 1−η per step. A badly stretched bowl (large κ) 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
error of the outputf(xˉT)−f(x∗)≤“start far away” term2ηTD2+“discrete step” penalty2ηG2
Symbol by symbol
D
a known bound on the starting distance to an optimizer ("you don't start from a far-away point"). Not the diameter of a domain.
G
a known bound on the gradient length at the iterates: how steep the function can be
T
number of gradient steps (= oracle calls), fixed in advance
η
the constant step size
xˉT
average of x0,x1,…,xT−1: the points where gradients were evaluated (not x1..xT)
first term
shrinks as T grows (more steps); large when η is tiny (slow progress)
second term
does not shrink with T; large when η is big (overshooting)
DG/T
the 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,T, find η and the error. Given ε, find T.
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∗, 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).
Symbol by symbol
Rt
squared distance from the current iterate to the optimizer; R0≤D2, and always Rt≥0
In wordsThe average value at the queried points is within the bound.
Step 3: average value → value at the average point (Jensen)
f(T1t=0∑T−1xt)≤T1t=0∑T−1f(xt).
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 T. For T=1 it is trivial. For T points: xˉT=TT−1xˉT−1+T1xT−1, a two-point blend with weights TT−1,T1. Apply the chord inequality, then the induction hypothesis to f(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∗)≤2ηTD2+2ηG2. ∎
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: dηd(2ηTD2+2ηG2)=−2η2TD2+2G2=0 at the same η. The sum a/η+bη is minimized where its two terms are equal.
Iterations for accuracy ε
TDG≤ε⟺T≥(εDG)2.
In wordsError decreases like 1/T: 10× more accuracy costs 100× more iterations.
L12 exercise: D=2,G=3,T=900. Find the prescribed step size and the guaranteed additive error. How large must T be for ε=0.1?
Show answer
T=30. η=GTD=3⋅302=451≈0.0222. Error ≤TDG=306=0.2. Check: 2ηTD2=2⋅451⋅9004=404=0.1 and 2ηG2=909=0.1. For ε=0.1: T≥(6/0.1)2=3600, with η=3⋅602=901.
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)=25(x−1)2 (from A=b=(1,2)⊤), f′(x)=5(x−1), x∗=1. Start at x0=0 with η=0.1:
xt+1=xt−0.1⋅5(xt−1)=0.5xt+0.5.
t
xt
gradient 5(xt−1)
f(xt)
Rt=(xt−1)2
0
0
−5
2.5
1
1
0.5
−2.5
0.625
0.25
2
0.75
−1.25
0.15625
0.0625
3
0.875
−0.625
0.0390625
0.015625
For T=4: xˉ4=(0+.5+.75+.875)/4=0.53125, and f(xˉ4)=2.5⋅0.468752≈0.5493. The average of the four values is 3.3203/4≈0.8301. Jensen says 0.5493≤0.8301. ✓
The theorem with D=1, G=5 (valid along this trajectory, since ∣f′∣≤5 there), η=0.1, T=4: 2⋅0.1⋅41+20.1⋅25=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/2, η=21. Check the potential directly
Generic proof: the convexity step replaces the true error f(xt)−0=Rt/2 by the inner product ⟨gt,xt−x∗⟩=Rt, twice as large. Using only that inequality would give Rt+1≤Rt−2⋅21⋅2Rt+41Rt=43Rt instead of the exact 41Rt.
Which inequalities in the general proof lose information specific to this quadratic?
Show answer
(1) The convexity inequalityf(xt)−f(x∗)≤⟨gt,xt−x∗⟩ is off by a factor 2 here (Rt/2 vs Rt). (2) Replacing ∥gt∥2=xt2, which shrinks geometrically, by a uniformG2. (3) Dropping −RT≤0. (4) Averaging: Jensen's f(xˉ)≤T1∑f(xt) and averaging in the early, bad iterates. Together they turn a geometric rate (Rt=4−tR0) into 1/T. With x0=2: xt=2⋅2−t, Rt=4⋅4−t, error =2⋅4−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∗)≤ε. A ratio f(x)/f(x∗) can be undefined (f(x∗)=0) or misleading (f(x∗)<0). The approximation algorithms of Chapter 9 do the opposite: for discrete problems with positive costs they guarantee a ratio, ALG≤α⋅OPT.
Count the work per iteration
The theorem counts gradient-oracle calls (T). Total time also includes the cost of each gradient and the vector arithmetic. Dense least squares costs O(md) per gradient plus O(d) for the update and running average, so O(Tmd) in total.
The bounds are real assumptions
Convexity alone gives neither D nor G. 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).
In wordsAny slope whose tangent line stays below the graph. At a kink there are many. Where f is differentiable, the only one is ∇f(x).
Symbol by symbol
∣x∣ at x>0
g=1
∣x∣ at x<0
g=−1
∣x∣ at x=0
any g∈[−1,1]
When you use itReplace ∇f(xt) by any subgradient gt with ∥gt∥≤G. The proof only used the tangent inequality, so it goes through unchanged. A subgradient step may not decrease f at every step, but the averaged guarantee still holds.
What comes next (L13 covers the first two: see Chapter 8)
Idea
Why it is introduced
Typical gain
Projection
A gradient step may leave a constrained K. Project back to the nearest point of K. Projection does not increase the distance to x∗∈K, so the analysis survives.
constrained problems
Smoothness (gradient changes slowly)
An upper bound on curvature allows larger, safer steps.
O(1/T) instead of O(1/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/2).
O(logT/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 D and a gradient bound G, the average iterate is within DG/T of optimal. Lecture 13 makes two upgrades to it.
A gradient step can "knock you out of the domain" K. Project back to the nearest point of K. This never moves you farther from x∗, so the whole L12 proof still works.
If the gradient changes slowly (β-smooth), a step of size 1/β always decreases f. Then the last iterate satisfies f(xT)−f∗≤βD2/(2T), which is O(1/ε) steps instead of O(1/ε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∥⋅∥2 and combine it with the descent lemma.
Where we end up (the board's closing table)
Assumptions
Output
Step size
Error after T steps
# steps for error ε
convex, D, G (bounded gradients)
average xˉT=T1∑t<Txt
η=GTD
TDG
(εDG)2=O(ε−2)
convex, D, β-smooth
last iterate xT
η=β1
2TβD2
2εβD2=O(ε−1)
Unit 8.2 · Projections and smoothness (L13)
Projection onto a convex set
Sources: Lec13_SecA pp.1–2
Constrained problem: minx∈Kf(x). A plain step xt−η∇f(xt) may land outside K. How do we recover? Move to the closest point of K.
Definition: projection
ΠK(u)=argz∈Kmin∥u−z∥2
In wordsThe projection of u onto K is the point of K nearest to u. If u is already in K, it is u itself.
Symbol by symbol
K
the feasible set: convex and compact (closed and bounded) in the lecture. Closed + nonempty is enough for existence.
u∈Rd
any point, typically the unconstrained gradient step
ΠK(u)
the nearest point. It exists because K is closed and is unique because K is convex.
∥u−z∥2
squared distance; same minimizer as the distance itself, but easier to differentiate
When you use itProjected gradient descent: xt+1=ΠK(xt−η∇f(xt)). The method is practical only when ΠK is easy to compute, as in the examples below.
Projections you can compute in one line
Box (the lecture example)
K=i=1∏d[ai,bi]⟹ΠK(u)i=min{bi,max{ai,ui}}.
In wordsClip every coordinate into its interval independently: too small goes up to ai, too large comes down to bi, and in-range values stay put.
Symbol by symbol
∏i[ai,bi]
the box {z:ai≤zi≤bi∀i} (a product of intervals)
max{ai,ui}
push ui up to at least ai
min{bi,⋅}
then pull it down to at most bi
Why it is true∥u−z∥2=∑i(ui−zi)2 is a sum of separate 1-D terms, and each zi has its own interval. So you minimize each term on its own, and the closest point of [ai,bi] to ui is the clipped value.
Set K
ΠK(u)
box ∏[ai,bi]
clip each coordinate
ball {z:∥z∥≤r}
u if ∥u∥≤r, else ru/∥u∥ (shrink radially)
halfspace {z:a⊤z≤d}
u−∥a∥2max{0,a⊤u−d}a (move straight back along the normal)
nonnegative orthant {z≥0}
max{0,ui} coordinatewise (a box with bi=∞)
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
projected point to z∥p−z∥2+how far we moved∥u−p∥2≤original point to z∥u−z∥2
In wordsThe distance from p to z is smaller than the distance from u to z, for every point z of K. In fact it is smaller by at least the length of the projection move. It reads like Pythagoras with "≤" because the angle at p is at least 90°.
Symbol by symbol
u
the point outside (or anywhere)
p=ΠK(u)
its nearest point in K
z
any point of K; in GD we take z=x∗
second ≤
just drops −∥u−p∥2≤0
Proof (board version, with every step justified)
Move from p toward z. For θ∈[0,1] the point p+θ(z−p) is in K, 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.
It is minimized at θ=0, because p is the closest point of K to u. So moving right from 0 cannot decrease it: f′(0+)≥0 (it is increasing).
Differentiate: by the chain rule f′(θ)=2⟨u−p−θ(z−p),p−z⟩. At θ=0:
⟨u−p,p−z⟩≥0⟺⟨u−p,z−p⟩≤0.
This says the angle at p between "back to u" and "toward z" is at least 90°.
Expand (the trick: add and subtract p):
∥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.
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).
In wordsTake the ordinary gradient step, which may leave K, then snap back to the nearest feasible point.
Symbol by symbol
yt+1
the unconstrained step (the board calls it xt+1 before projecting)
In wordsProjecting can only bring you closer to x∗. So the potential after projecting is at most what the L12 calculation already bounded.
Symbol by symbol
≤
projection inequality with u=yt+1, p=ΠK(yt+1), z=x∗ (the board labels these p, u, z)
x∗∈K
required. Here x∗ is a minimizer over K, so it is a legal z.
equality
the unconstrained expansion from L12, since yt+1−x∗=(xt−x∗)−η∇f(xt)
Why everything else carries over: the convexity step ⟨∇f(xt),xt−x∗⟩≥f(xt)−f(x∗) holds for any xt. Telescoping is unchanged. And the average of points of K is in K (convexity of K, 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.
In wordsThe gradient is β-Lipschitz: moving a distance r changes the gradient by at most βr. The slope can't jump, and the curvature is at most β.
Symbol by symbol
β>0
the smoothness constant, an upper bound on curvature
∥∇f(x)−∇f(y)∥
how much the slope vector changes between two points
Why it is trueFor twice-differentiable f this is equivalent to −βI⪯∇2f(x)⪯βI: every directional second derivative is between −β and β. In 1-D, ∣f′′(x)∣≤β.
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.
f
β-smooth?
bounded gradient (G)?
21x2
yes, β=1
no on R (f′=x)
21x⊤Qx, Q⪰0
yes, β=λmax(Q)
no on Rd
21∥Ax−b∥2
yes, β=λmax(A⊤A)
no on Rd
∣x∣
no: slope jumps from −1 to 1
yes, G=1
log(1+ex) (softplus)
yes, β=41
yes, G=1
x4
no (f′′=12x2 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 (★)
true valuef(y)≤tangent at xf(x)+⟨∇f(x),y−x⟩+curvature allowance2β∥y−x∥2
In wordsThe function never rises above the tangent plus a bowl of curvature β. It is a quadratic ceiling touching f at x.
Symbol by symbol
tangent part
the first-order Taylor prediction, as in L12
2β∥y−x∥2
the most the function can bend upward away from its tangent, given curvature ≤ β
no convexity needed
the 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∥2.
Proof, step by step
Subtract the tangent term.⟨∇f(x),y−x⟩ is a constant, so it equals its own integral over [0,1]:
f(y)−f(x)−⟨∇f(x),y−x⟩=∫01⟨∇f(x+s(y−x))−∇f(x),y−x⟩ds.
The integrand compares the slope at the moving point with the slope at the start.
Bound the integrand (the two factors explained):
⟨∇f(x+s(y−x))−∇f(x),y−x⟩≤C–S≤β∥s(y−x)∥=βs∥y−x∥∥∇f(x+s(y−x))−∇f(x)∥⋅second factor∥y−x∥.
First factor, βs∥y−x∥: the two points x+s(y−x) and x are a distance ∥s(y−x)∥=s∥y−x∥ apart (s≥0). β-smoothness says their gradients differ by at most β times that distance.
Second factor, ∥y−x∥: this is the other vector in the inner product. Cauchy–Schwarz says ⟨a,b⟩≤∥a∥∥b∥, with a= gradient difference and b=y−x.
In wordsWith η=1/β, every step lowers f by at least ∥∇f∥2/(2β). 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) is exactly the bottom of the quadratic ceiling(⋆). The function lies below the ceiling, and the ceiling's minimum is 2β1∥g∥2 below f(xt).
When you use itMakes f(x0)≥f(x1)≥f(x2)≥… (monotone). That is why the smooth theorem can return the last iterate.
In wordsThe error of the next point is paid for by the decrease in squared distance. Unlike L12, there is no leftover ηG2/2 penalty: smoothness cancelled it exactly.
Symbol by symbol
1st ≤
safe-step inequality with f(x∗) subtracted from both sides
2nd ≤
the L12 key inequality f(xt)−f(x∗)≤⟨gt,xt−x∗⟩ (red "using convexity!")
In words"The LHS is bigger than T⋅(f(xT)−f(x∗))" (board, red). The sum has T terms and the last one is the smallest, because the safe step makes f(x1)≥f(x2)≥⋯≥f(xT).
Why it is trueA sum of T numbers is at least T times its smallest number. This is the only place the monotone decrease is used, and it is what lets us return xT 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)
Assumptions
convex, ∥x0−x∗∥≤D, ∥∇f(xt)∥≤G
convex, ∥x0−x∗∥≤D, β-smooth
Step size
η=D/(GT) (needs T in advance)
η=1/β (no T needed)
Output
average xˉT (or best iterate)
last iterate xT
Error after T
DG/T
βD2/(2T)
Steps for error ε
(DG/ε)2=O(ε−2)
βD2/(2ε)=O(ε−1)
Monotone decrease?
no (e.g. ∣x∣ bounces)
yes, by ≥∥∇f∥2/(2β) each step
Works with projection?
yes (this chapter)
yes, with a modified proof (not covered)
Typical example
∣x∣, hinge losses, max of affine
least squares, softplus/logistic losses
How big is the difference?
ε=0.01,D=2,G=3,β=3:(εDG)2=360,000vs.2εβD2=600.
In wordsSquaring 1/ε 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.
In wordsThe function lies above its tangent plus a parabola of curvature α: it curves upward at least as fast as 2α∥⋅∥2 in every direction.
Symbol by symbol
α>0
the strong convexity constant, a lower bound on curvature
tangent part
as in the first-order condition (unit 6.3); with α=0 this is plain convexity
2α∥y−x∥2
the 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, so α≤β.
Equivalent tests
Hessian: for twice-differentiable f, α-strongly convex ⇔ ∇2f(x)⪰αI for all x, i.e. v⊤∇2f(x)v≥α∥v∥2 (in 1-D: f′′≥α).
Subtract the bowl:f is α-strongly convex ⇔ f(x)−2α∥x∥2 is convex.
Chord form:f(λx+(1−λ)y)≤λf(x)+(1−λ)f(y)−2αλ(1−λ)∥x−y∥2 (no differentiability needed).
f
strongly convex?
21x2
yes, α=1
21x⊤Qx, Q≻0
yes, α=λmin(Q)
21∥Ax−b∥2
yes with α=λmin(A⊤A) if the columns of A are independent; otherwise no
∣x∣, any linear function
no (zero curvature)
ex on R
no: f′′=ex→0 as x→−∞
x4
no: f′′(0)=0
convex g + 2α∥x∥2
yes, α ("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.
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∗: f(x∗)≥f(x)+⟨∇f(x),x∗−x⟩+2α∥x∗−x∥2. Rearrange.
In wordsThe L12 expansion does not care whether η is constant: it holds step by step with ηt. Rearranged, ⟨gt,xt−x∗⟩=2ηtRt−Rt+1+2ηt∥gt∥2.
When you use itWith a varying ηt the terms 2ηtRt−Rt+1 no longer telescope directly. Use the strengthened inequality above together with "telescoping with changing weights" (unit 0.3), and bound sums such as ∑t1≤1+lnT.
Unit 9.1 · Approximation algorithms (L14–L15)
Lectures 14–15 in one page: good answers with a proof of how good
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 α of the optimum, even though we never compute the optimum.
Minimization. We cannot see OPT, but we can see a lower bound LB. If ALG ≤ α·LB, then ALG ≤ α·OPT automatically.
Definitions (α-approximation, PTAS, FPTAS). Vertex cover: greedy by degree is an O(logn)-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).
Write the problem as an integer program, drop integrality, solve the LP, then round. Vertex cover: keep every vertex with xv∗≥21, a 2-approximation. The dual LP is fractional matching. Facility location: round using balls of radius 2Lj around clients (a 6-approximation).
Every result in this chapter
Problem
Algorithm
Lower bound on OPT used in the proof
Factor
Unit
Vertex cover
greedy: highest remaining degree
OPT vertices share the remaining edges (averaging)
In wordsOn every input I, the algorithm returns a feasible solution whose cost is at most α times the best possible cost (for a minimization problem), or whose value is at least a 1/α fraction of the best value (for a maximization problem).
Symbol by symbol
I
an instance (one concrete input, e.g. one graph)
OPT(I)
the optimal value for that instance. We never compute it. It only appears in the analysis.
A(I)
the value of the solution the algorithm returns on I
α
the approximation factor (ratio). α=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 forces α≥1. The answer lands in the interval [OPT,αOPT].
When you use itEvery theorem of this chapter has this form. To prove it you need a lower bound on OPT that you can reason about, because OPT itself is unknown.
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/ε).
In wordsA scheme is a family of algorithms, one for each accuracy ε. A PTAS (polynomial-time approximation scheme) may pay any price in ε, for example n1/ε. An FPTAS (fully polynomial) must keep the dependence on 1/ε polynomial too.
Symbol by symbol
ε
target accuracy. The answer is within a factor 1+ε of OPT (for maximization, at least (1−ε)OPT)
Aε
the algorithm of the family that is tuned for accuracy ε
poly(n)
polynomial in the input size nwhen ε is treated as a constant
poly(n,1/ε)
polynomial in both, e.g. n3/ε
When you use itKnapsack has an FPTAS (the scaling-and-rounding algorithm from earlier in the course). Halving ε only doubles a 1/ε factor in the running time.
Running time of Aε
PTAS?
FPTAS?
Why
n2/ε
yes
yes
polynomial in n and 1/ε
n3/ε5
yes
yes
still polynomial in 1/ε
n1/ε
yes
no
for fixed ε it is a polynomial, but the degree grows with 1/ε
21/εn
yes
no
exponential in 1/ε
2n
no
no
not polynomial in n
A hierarchy of how well problems can be approximated
Q. An algorithm for a minimization problem returns cost at most OPT+5 on every input. Is it an α-approximation for some constant α?
Show answer
Not necessarily. If OPT can be tiny (say OPT=1), the ratio (OPT+5)/OPT=6 is fine, but if OPT can be arbitrarily close to 0 (with real costs) the ratio is unbounded. When costs are positive integers, OPT≥1 and OPT+5≤6OPT, so it is a 6-approximation. Additive and multiplicative guarantees are different statements.
Q. Is "returns all of V" an approximation algorithm for vertex cover?
Show answer
It is feasible and fast, but its ratio n/OPT can be as large as n (a star has OPT=1). So it is only an n-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∣.
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
S
the chosen vertices (the cover)
"e is covered"
at least one endpoint of e is in S (both is allowed)
n=∣V∣,m=∣E∣
number of vertices, number of edges
OPT
size of a smallest cover (often written ∣S∗∣)
Why it is trueS=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).
Graph
OPT
Why (an optimal cover, and why nothing smaller works)
a single edge
1
either endpoint
star with k leaves
1
the center touches every edge
triangle
2
one vertex leaves the opposite edge uncovered
path with n vertices
⌊n/2⌋
every second vertex; the ⌊n/2⌋ disjoint edges each need their own vertex
cycle with n vertices
⌈n/2⌉
each vertex covers 2 of the n edges, so at least n/2
complete graph Kn
n−1
if two vertices are both missing, the edge between them is uncovered
complete bipartite Ka,b
min(a,b)
one whole side; a matching of size min(a,b) shows nothing smaller works
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 lnm times optimal.
S←∅, E0←E (the uncovered edges).
While Et−1=∅: pick vt with the largest degree in the remaining graph(V,Et−1). Add it to S. Remove every edge touching vt: Et=Et−1∖{edges at vt}.
Return S. 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∗ with ∣S∗∣=OPT. We never compute it. We only use the fact that it exists. Write ∣Et∣ for the number of uncovered edges after t greedy steps.
Claim (the only real idea): the greedy vertex covers at least an OPT-th of what is left
degEt−1(vt)≥OPT∣Et−1∣.
In wordsWhatever is left, the OPT vertices of S∗ share the work of covering it. Someone in S∗ must do at least an average share. The greedy vertex does at least as much as anyone.
Symbol by symbol
degEt−1(v)
number of remaining edges at v (degree in the remaining graph)
∣Et−1∣
number of edges not yet covered before step t
OPT=∣S∗∣
size of an optimal cover of the original graph
Why it is trueS∗ covers every edge of E, so in particular every edge of Et−1⊆E. Each remaining edge has at least one endpoint in S∗, so counting edges at the vertices of S∗ counts every remaining edge at least once:
∑c∈S∗degEt−1(c)≥∣Et−1∣. (Equality if no edge has both endpoints in S∗; otherwise some edges are counted twice.)
The largest term of a sum is at least the average: maxc∈S∗degEt−1(c)≥∣Et−1∣/OPT.
Greedy picks a vertex of maximum degree over all of V, so degEt−1(vt)≥maxc∈S∗degEt−1(c).
Step 2: the number of uncovered edges shrinks by a constant factor
In wordsEach step removes at least a OPT1 fraction of the remaining edges, so at most a (1−OPT1) fraction survives.
Why it is trueThe edges removed at step t are exactly those at vt, and there are degEt−1(vt) 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∣. The minus sign flips the inequality.
In wordsA multiplicative shrink, repeated t times, gives a power. The last step uses 1−x≤e−x.
Symbol by symbol
m=∣E0∣
the original number of edges
1−x≤e−x
true for every real x. The line 1−x is the tangent of the convex function e−x at x=0, and a tangent is a floor (unit 6.3). Use x=1/OPT and raise both (nonnegative) sides to the power t.
Why it is trueThe lecture used the limit (1−k1)k→e1. The inequality 1−x≤e−x gives the same conclusion exactly, without a limit.
Step 4: when must the algorithm stop?
t>OPT⋅lnm⟹∣Et∣≤me−t/OPT<me−lnm=1⟹∣Et∣=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∣ counts edges, so it is an integer ≥0. An integer that is strictly less than 1 is 0. (The bound never says ∣Et∣=0 directly, since me−t/OPT is never 0. Integrality closes the gap.)
When you use itEach loop iteration adds exactly one vertex, so ∣S∣ = number of iterations. The loop runs at most ⌊OPTlnm⌋+1 times.
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.
In wordsA set of edges that are pairwise disjoint: every vertex touches at most one of them.
Symbol by symbol
maximal matching
you cannot add any edge to M and keep it a matching (every edge of G touches some edge of M)
maximum matching
a matching of the largest possible size
Why it is trueEvery maximum matching is maximal, but not conversely. On the path a−b−c−d, {bc} is maximal (both other edges touch it) but {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.
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 trueC covers every edge, in particular every edge of M. Give each edge e∈M one endpoint of e that lies in C. Different matching edges have no common endpoint, so they get different vertices. This is a one-to-one map from M into C, so ∣M∣≤∣C∣.
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.
C←∅, E′←E.
While E′=∅: pick any{u,v}∈E′. Add both u and v to C. Remove from E′ every edge touching u or v.
Return C. Equivalently: build a maximal matching M (the picked edges) and return all endpoints of M.
Theorem: the matching algorithm is a 2-approximation
∣C∣=2∣M∣≤2OPT.
Symbol by symbol
M
the edges the algorithm picked
∣C∣=2∣M∣
each picked edge contributes two new vertices, and they are new because edges touching earlier picks were deleted
∣M∣≤OPT
the claim above
Why it is trueM is a matching: after picking {u,v} we delete every edge touching u or v, so no later pick shares an endpoint with it.
C is a cover (feasibility): an edge is deleted from E′ only when one of its endpoints is put in C, and the loop ends only when E′ is empty. (Equivalently, M is maximal.)
Ratio:∣C∣=2∣M∣≤2OPT.
When you use itMaximality gives feasibility. Disjointness gives the lower bound. The algorithm never needs a maximum matching.
Q. Why is ∣C∣ exactly 2∣M∣, and not just at most?
Show answer
When an edge {u,v} is picked, it is still in E′, so neither u nor v is in C 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∣ need M maximal or C minimal?
Show answer
Neither. It holds for every matching and every cover. Maximality of M 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.
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.
Let L=max{1,⌊m⌋}.
Repeatedly find an unrouted pair that still has a directed path with at most L edges in the remaining graph (BFS finds shortest paths). Route it, delete its edges, and mark the pair as done.
Stop when no such pair remains. Call the routed set A. Also, if A is empty, route any one pair that has some path (if any): this guarantees at least one path whenever OPT>0.
Short optimal paths are charged to greedy paths. Long optimal paths are few, because they are edge-disjoint and each uses more than L edges.
Theorem: an O(√m)-approximation
OPT≤(L+1)∣A∣+L+1m≤(2m+1)⋅a,a=number of paths returned (≥1 if OPT>0).
In wordsFix an optimal solution O and split its paths into short (≤ L edges) and long (> L edges). Short ones are charged to greedy paths, and each greedy path receives at most L+1 charges. Long ones are few.
Why it is trueLong paths: they are edge-disjoint and each uses at least L+1 edges, so there are at most m/(L+1) of them.
Short paths: take a short optimal path Q for pair i. If greedy routed pair i, charge Q to that greedy path. Otherwise Q must share an edge with some greedy path, since if all its edges were still present at the end, greedy would have routed pair i along Q. Charge Q to that path.
Charges per greedy path P:P has at most L edges, and each edge lies on at most one optimal path (they are edge-disjoint), so at most L charges come through shared edges, plus at most one for the same pair. So ∣Oshort∣≤(L+1)∣A∣.
Arithmetic: with L=⌊m⌋ we have L+1≤m+1 and m/(L+1)<m/m=m. Since a≥max(∣A∣,1), OPT≤(m+1)a+ma.
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.
In wordsThe relaxation drops "x must be integer". It has more feasible points, so its minimum can only be lower (or equal).
Symbol by symbol
x∈Zn
every coordinate is an integer (the dots of the picture below)
relaxation
the same LP without the integrality constraint (the whole shaded region)
OPTLP≤OPTIP
minimizing over a bigger set gives a smaller or equal value. For a maximization problem the inequality flips: OPTLP≥OPTIP.
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 is the lower bound we were looking for: we can compute it, and it is ≤OPT.
The LP-rounding template
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.
Relax: drop integrality and keep 0≤x (and x≤1 if needed).
Solve the LP in polynomial time: optimum x∗, value OPTLP≤OPT.
Roundx∗ to an integral x^. Prove two things: x^ is feasible, and c⊤x^≤αc⊤x∗.
Why the template proves an approximation factor
c⊤x^≤αc⊤x∗=αOPTLP≤αOPT.
In wordsThe rounding loses at most a factor α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
minv∈V∑xvs.t.xu+xv≥1∀{u,v}∈E,xv≥0,xv∈Z.
In wordsOne variable per vertex: xv=1 means "v is chosen". The objective counts chosen vertices. Each edge demands that at least one of its endpoints is chosen.
Symbol by symbol
xv
1 if v∈S, 0 otherwise (the 0/1 modeling trick for "choose a subset")
∑vxv=1⊤x
the size of the chosen set, a linear objective
xu+xv≥1
with 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.
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>1. Replace it by 1. Every constraint containing xv still holds, since 1+xu≥1 because xu≥0. Constraints without xv are unchanged. The objective strictly decreases. So a point with some xv>1 is never optimal. With integrality this means x∗∈{0,1}V, so we do not need to write x≤1.
Claim 2: the IP is exactly vertex cover
S a vertex cover⟹xvS={10v∈Sv∈/S is feasible with v∑xvS=∣S∣;x∈{0,1}V feasible⟹{v:xv=1} is a cover.
Why it is trueFor an edge {u,v}, "u∈S or v∈S" is the same as "xu+xv≥1" for 0/1 values. Both directions keep the cost equal, so the minimum of the IP equals the minimum cover size: OPTIP=OPT.
When you use itThis two-way correspondence is the same check as when modeling any problem as an LP (unit 1.2).
In wordsNow a vertex may be chosen "halfway". By Claim 1, optimal LP solutions still lie in [0,1]V.
Graph
An optimal LP solution
OPTLP
OPT
Proof that the LP cannot do better
single edge uv
(1,0) or (21,21)
1
1
the one constraint says xu+xv≥1
triangle
all 21
23
2
add the 3 edge constraints: 2∑x≥3
Kn
all 21
2n
n−1
add all edge constraints: (n−1)∑x≥(2n)
star, k leaves
center 1, leaves 0
1
1
one edge constraint
Kn,n
one side 1, or everything 21
n
n
add 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={10if xv∗≥21otherwiseC^={v:xv∗≥21}.
In wordsSolve the LP. Keep every vertex that the LP chose at least halfway. Throw away the rest.
Symbol by symbol
x∗
an optimal solution of the LP relaxation (computed in polynomial time)
x^
the rounded 0/1 vector; C^ is the corresponding set of vertices
21
the 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∗}≥21⟹x^u=1 or x^v=1.
In wordsTwo numbers that add up to at least 1 cannot both be below 21. The larger one is at least the average, so it survives the threshold.
Why it is true2max{xu∗,xv∗}≥xu∗+xv∗≥1. Equivalently, by contradiction: if edge uv were uncovered, then xu∗<21 and xv∗<21, so xu∗+xv∗<1, contradicting LP feasibility.
Theorem: threshold rounding is a 2-approximation
∣C^∣=v∑x^v≤v∑2xv∗=2OPTLP≤2OPT.
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∗
if x^v=1 then xv∗≥21, so 2xv∗≥1. If x^v=0 then 2xv∗≥0. True for every v.
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, and ∑v2xv∗≤2∣S∗∣ because xS∗ 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⟹imaxai≥k1.
In wordsIf k nonnegative numbers add up to at least 1, at least one of them is at least k1.
Why it is trueIf every ai<k1, the sum would be <k⋅k1=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).
In wordsEach vertex has a cost wv≥0, and we minimize the total cost of the cover. Same LP constraints, same threshold, same per-vertex inequality x^v≤2xv∗, now multiplied by wv≥0.
Extension 2: constraints with up to f variables
f-approximation by rounding at 1/f
minc⊤x s.t. v∈Te∑xv≥1∀e,x≥0,∣Te∣≤f⟹x^v=1[xv∗≥f1] is feasible and c⊤x^≤f⋅OPT.
In wordsA covering problem where every requirement e can be satisfied by at most f different objects (the set Te). Keep every object the LP chose to an extent of at least f1.
Symbol by symbol
Te
the objects able to satisfy requirement e. Vertex cover: Te is the 2 endpoints of edge e, so f=2.
f
the largest ∣Te∣ (in set cover: the maximum number of sets containing one element, its "frequency")
c≥0
object costs
Why it is trueFeasible: the ≤f values xv∗, v∈Te, add up to at least 1, so by the averaging principle one of them is ≥f1 and is kept. Cost:x^v≤fxv∗ for every v (if kept, fxv∗≥1), so c⊤x^≤fc⊤x∗=fOPTLP≤fOPT.
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.
In wordsOne dual variable ye per edge (each primal constraint is an edge). One dual constraint per vertex (each primal variable is a vertex): the edges at v may carry total weight at most 1.
Symbol by symbol
ye
weight on edge e, the multiplier of the constraint xu+xv≥1
e∋v
the edges that have v as an endpoint
∑e∋vye≤1
comes from column v of the constraint matrix: xv appears (with coefficient 1) exactly in the rows of the edges at v
Why it is trueRules for a min primal (unit 3.5): ≥ rows give multipliers ye≥0; variables xv≥0 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≥0 and add: ∑eye(xu+xv)=∑vxv∑e∋vye≥∑eye. If every ∑e∋vye≤1, then ∑vxv≥∑vxv∑e∋vye (because x≥0), so ∑vxv≥∑eye.
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 e∑ye=∣M∣.
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 v, the constraint at v would read 1+1≤1.
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
a matching is a feasible dual solution (integral)
OPTD=OPTLP
strong duality (both LPs are feasible: x=1, y=0)
OPTLP≤OPT
relaxation
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
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" must have α≥ the gap, since on the worst instance even OPT itself is that far above OPTLP. 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)=2n,n/2n−1=2−n2n→∞2.
Why it is trueAll xv=21 is feasible, so OPTLP≤2n. Adding all (2n) edge constraints, each vertex appears in n−1 of them: (n−1)∑vxv≥2n(n−1), so ∑vxv≥2n for every feasible x. The integral optimum is n−1 (unit 9.3).
Q. The triangle has OPT=2 and OPTLP=23. What does this say about rounding?
Show answer
Every integral solution costs at least 2=34OPTLP, so any rounding of the LP loses at least a factor 34 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
S⊆F,S=∅mini∈S∑fi+j∈C∑i∈Smindij.
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,C
candidate facilities, clients
fi≥0
cost of opening facility i
dij≥0
cost of serving client j from facility i (a distance)
metric
distances come from a metric on F∪C, so the triangle inequality holds: d(a,c)≤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.
In wordsxi=1: facility i is open. yij=1: client j is assigned to facility i. Pay for open facilities and for each assignment.
Symbol by symbol
∑iyij=1
every client is assigned to exactly one facility
yij≤xi
"you cannot be assigned to a closed facility": if xi=0 then yij is forced to 0. If xi=1 the constraint allows yij∈{0,1}.
{0,1}
dropped in the relaxation, replaced by x,y≥0. Upper bounds of 1 are not needed: yij≤1 follows from ∑iyij=1, and any xi can be lowered to maxjyij≤1 without breaking a constraint or increasing the cost.
Why it is trueThe constraint yij≤xi 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∗=i∑fixi∗,D∗=i,j∑dijyij∗,OPTLP=F∗+D∗≤OPT.
In wordsIn the "fractional universe" facility i is open to an extent xi∗, and client j spends a fraction yij∗ of its time at facility i, never more than the facility is open. F∗ is the fractional opening cost, and D∗ the fractional travel cost.
A client's fractional average distance
Lj=i∈F∑dijyij∗,j∈C∑Lj=D∗.
In wordsThe yij∗ for a fixed client add up to 1, so Lj is a weighted average distance: how far client j travels on average in the LP solution.
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}.
In wordsAll candidate facilities within twice client j's average LP distance.
Lemma (in Lec15_SecB): every ball contains at least half a facility
i∈Bj∑yij∗≥21and thereforei∈Bj∑xi∗≥21.
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∈/Bj we have dij>2Lj, i.e. 1<2Ljdij. Multiply by yij∗≥0 and add over those i:
∑i∈/Bjyij∗≤∑i∈/Bj2Ljdijyij∗≤2Lj1∑i∈Fdijyij∗=2LjLj=21.
Since ∑iyij∗=1, the rest, ∑i∈Bjyij∗, is at least 21. Finally xi∗≥yij∗ for each i (the LP constraint), so ∑i∈Bjxi∗≥21.
(If Lj=0, all of client j's LP mass sits at distance 0, inside Bj, and the sum is 1.)
When you use itTwo consequences: Bj is never empty, and opening the cheapest facility of Bj costs at most twice the fractional opening cost inside the ball (next unit).
The algorithm
Sort the clients so that Lj1≤Lj2≤… (small balls first). Set R=∅ (the "representatives", clients that open a facility) and S=∅ (open facilities).
For each client j in this order:
If Bj∩Br=∅ for every r∈R: open the cheapest facility ij∈argmini∈Bjfi, add j to R, and assign j to ij.
Otherwise pick some r∈R with Bj∩Br=∅, and assign j to ir, the facility opened for r.
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
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 21, 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 ≤
a minimum is at most any weighted average (the averaging principle, with weights xi∗)
second ≤
the denominator is ≥21 by the lemma
last ≤
the balls Br, r∈R, are disjoint, so the double sum counts each facility at most once, and ∑ifixi∗=F∗
In wordsA representative is served inside its own ball. Any other client walks to a shared facility i∈Bj∩Br, then to the representative r, then to r's open facility: three legs, each at most twice an average distance, and Lr≤Lj.
Symbol by symbol
i∈Bj∩Br
exists because the balls intersect. So d(j,i)≤2Lj and d(r,i)≤2Lr
d(r,ir)≤2Lr
ir∈Br
Lr≤Lj
r was processed earlier (sorting)
triangle inequality
applied twice along the path j→i→r→ir
Why a non-representative client is never far from its facility.
Theorem: a 6-approximation
cost≤2F∗+j∑6Lj=2F∗+6D∗≤6(F∗+D∗)=6OPTLP≤6OPT.
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)
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.)
A lower bound LB≤OPT. Name it and prove it.
Compare. Show ALG≤α⋅LB, usually term by term.
Chain.ALG≤αLB≤αOPT. For maximization, flip: an upper bound UB≥OPT and ALG≥UB/α.
Where lower bounds come from
Lower bound
Why it is ≤ OPT
Used for
counting / averaging over an optimal solution
the optimal solution must do the work, so one of its parts does an average share
greedy degree (9.4), edge-disjoint paths (9.6)
a disjoint structure (matching)
each disjoint piece needs its own element of any solution
move from p toward z∈K: f(θ) minimized at 0 ⇒ f′(0+)≥0 ⇒ ⟨u−p,z−p⟩≤0 ⇒ expand the square
uses convexity of K (segment stays in K)
Prove a lower bound for a min LP
nonnegative combination of ≥ rows whose coefficients are ≤ the costs
x≥0 is what lets you compare coefficients
Linearize an objective with ∣⋅∣ or max/min
new variable per awkward term, bounded by linear inequalities
only in the convex direction (min of convex, max of concave)
Show one LP form expresses another
transform → map feasible solutions both ways with equal value → recover
polynomial size; signs of new variables
Derive a Farkas variant
rewrite the system with slacks / split variables → apply the known version → read off each column block
slack columns ⇒ y≥0; ± columns ⇒ equality
Analyze a zero-sum game
best responses are pure (linear over simplex) → max-min as an LP → dual is the other player's LP
which variables are free; the simplex equality row
GD with strong convexity / varying ηt
expand Rt+1 with ηt → strengthened key inequality → weighted telescoping → bound the sum
coefficients must line up; harmonic sum; Jensen
Prove an α-approximation (min)
feasibility → name a lower bound LB≤OPT → show ALG≤αLB
every instance; polynomial time; direction of the ratio (max: ALG≥OPT/α)
Analyze a greedy that removes a share of what is left
"OPT's pieces share the remaining work" → greedy step removes ≥OPT1 of it → at≤a0(1−OPT1)t≤a0e−t/OPT → integer below 1 is 0
degrees in the remaining instance; use the original optimum
Lower-bound OPT combinatorially
find 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 rounding
IP with 0/1 variables (check both directions) → relax → OPTLP≤OPT → rounding rule → feasibility (largest ≥ average) → per-variable loss x^v≤αxv∗ → chain
threshold =f1 for f variables per constraint; costs ≥0
Dual of a covering LP
one 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 improved
tight example for the algorithm (single edge, Kn,n); integrality gap for the LP (Kn)
tight algorithm ≠ hard problem
How to write a contradiction proof (used three times in Part 2)
State what you assume fails (e.g. "x^ is not a global min", "c is not in the cone").
Produce a witness of the failure: a better point y, or a Farkas vector w.
Use the witness to build an object the hypotheses forbid: a better point arbitrarily close to x^, or a better feasible point x∗+ε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≥0, coordinatewise feasibility, the tangent (first-order convexity) inequality, the chord inequality, Cauchy–Schwarz, ∥g∥≤G, R0≤D2, RT≥0, 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
Feasible ≠ optimal. A feasible point gives only a lower bound (for max).
Vector inequalities are coordinatewise.
Negative coefficients are allowed in an LP. Products of variables are not. Strict inequalities are not allowed.
"Unbounded" refers to the objective, not the region.
Vertex = n independent tight constraints, counting sign constraints. Not "n tight constraints".
Some optimal solution is a vertex. Not every one, and not necessarily a unique one.
Short answer ≠ fast algorithm (Cramer). Polynomial in bit length, not in magnitudes (knapsack is pseudo-polynomial).
Dual constraints come from columns (transpose).
Don't use the max-primal sign table on a min primal. Use S-O-B.
Equality ↔ free.
Weak duality alone proves a matching feasible pair optimal.
Primal infeasible does not imply dual unbounded (both can be infeasible).
Complementary slackness: "tight ⇒ positive multiplier" is false. The product is zero.
Verify feasibility after using slackness to generate a candidate.
Gap bounds are additive.
Path LP is exponential. Don't propose enumerating paths as an algorithm.
Only edges leaving S count in a directed cut.
Two integrality facts: 0/1 optimal dual (any real capacities) vs integral flow (integer capacities).
Dijkstra needs nonnegative lengths.
Farkas sign orientation:w=−v. Generators score ≥ 0, p scores < 0, and w is free in sign.
Cone weights are ≥ 0, not > 0. Conclusions are v⊤aj≤0, not < 0.
Include −xi≤0 normals in the active-constraint argument.
Convex set ≠ convex function. Local ⇒ global needs both.
Tangent is a floor:f(x)−f(x∗)≤⟨∇f(x),x−x∗⟩ (≤, not ≥).
PSD ≠ nonnegative entries.
Min of convex functions is not convex. Max is. Partial minimization needs joint convexity.
Boundary optimum ⇒ gradient need not be 0.
Convex ≠ unique minimizer, and convex ≠ a minimizer exists.
Multiplying an inequality by −2η flips it.
GD theorem bounds the average of x0..xT−1 (or the best iterate), not the last iterate.
D and G are assumptions, not consequences of convexity.
η=D/(GT) is constant for a fixed horizon, not ηt∝1/t.
T iterations ≠ O(T) time. Multiply by the cost of a gradient.
Telescoping requires Rt−Rt+1, not Rt−Rt−1.
Projection needs a convex K and x∗∈K (a minimizer over K, not over Rd).
β-smooth is not convex (sinx is 1-smooth). Smoothness bounds curvature from above, convexity from below.
Bounded gradient and smooth are different: x2/2 is smooth but has unbounded gradient; ∣x∣ has G=1 but is not smooth.
Last iterate is only guaranteed in the smooth theorem, because the safe step makes f(xt) monotone.
Rates: bounded gradients need O(ε−2) steps; smooth needs O(ε−1). Not O(ε−1).
Safe step is η=1/β; any η<2/β still decreases f, and η>2/β can diverge.
Min-LP certificates flip everything: y≥0 on ≥ rows and combined coefficients ≤c give a lower bound.
Linearization tricks only work in the convex direction. You cannot maximize ∣x∣ with an LP.
Intersections of convex sets are convex; unions need not be.
Products and differences of convex functions need not be convex; sums with nonnegative weights and maxima are.
Farkas variants differ in the certificate's sign: free for equality systems, ≥0 for inequality systems; A⊤y=0 when x is free.
p⊤Aq is not jointly linear in (p,q). Fix one player, then the best response is a pure strategy.
Strong convexity + a global gradient bound can only hold on a bounded region or at the visited iterates.
Approximation ratios are multiplicative and hold for every instance; the output must always be feasible.
Min: ALG ≤ α·OPT with α ≥ 1. Max: ALG ≥ OPT/α. The relaxation is a lower bound for min (OPTLP≤OPT) and an upper bound for max.
Greedy degree: degrees are in the remaining graph, and the proof uses the original optimal cover.
Maximal ≠ maximum. The 2-approximation needs only a maximal matching; ∣M∣≤∣C∣ holds for every matching and every cover.
Rounding threshold: above 21 the vertex cover rounding can be infeasible; with f variables per constraint use f1. Nearest-integer rounding is not feasible in general.
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≥7; uv≤5; objective u2+v2; v free; u∈{0,1}; u<2?
Show answer
3u−2v≥7: yes (flip to ≤). uv≤5: no (product). u2+v2: no (quadratic, though convex). v free: yes, via v=v+−v−. u∈{0,1}: no (integer program). u<2: no (strict; the optimum might not be attained).
A2. Convert min(2u−v) s.t. u−v=3,u≥0,v free to canonical form and solve.
Show answer
See unit 1.5: max−2u+v+−v− s.t. u−v++v−≤3,−u+v+−v−≤−3, all variables ≥ 0. Optimum u=0,v=−3, original min value 3.
A3. For max2x1+3x2 with x1+x2≤5,x1≥1,x2≥0: list the vertices, two independent tight constraints at each, and the optimum. What changes for objective x1+x2?
Show answer
(1,0): x1=1,x2=0, value 2. (5,0): x1+x2=5,x2=0, value 10. (1,4): x1=1,x1+x2=5, value 14 (optimum). For x1+x2 the whole edge (1,4)–(5,0) is optimal with value 5. Two optimal vertices, infinitely many optimal points.
A4. Prove: with box bounds 0≤xi≤1 and k other inequalities, any vertex has at most k fractional coordinates.
A5. Write A,b,c and the dual of the smoothie LP. Verify 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=0. Smoothie 3's dual row is slack (7>6), so x3=0.
A6. Verify y=(3,1,2) for the smoothie dual. What additive error guarantee does it give for x=(3,3,0)?
Show answer
Feasible (5≥5, 5≥4, 6≥6), value 31. Gap 31−27=4, so x is within 4 of optimal, using this pair alone.
A7. Dual of max2u+v s.t. u+v≤4,u−v=1,u≥0,v free, and a matching pair.
Show answer
min4α+β s.t. α+β≥2,α−β=1,α≥0,β free. Pair: (u,v)=(2.5,1.5), (α,β)=(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
maxx1 s.t. x1≤1,x2≤0,x≥0. Optimum (1,0). Row 2 is tight, and the dual optimum y=(1,0) gives it multiplier 0. The product 0⋅0=0 is fine. Slackness only forbids both factors being positive.
A9 ★. Write the dual of min2x1+3x2+x3 s.t. x1+x2+x3≥6,x1−x3=1,x1,x2≥0,x3≤0. Solve both and check complementary slackness.
Show answer
Dual (max, by S-O-B): max6y1+y2 s.t. y1+y2≤2 (col x1, sensible), y1≤3 (col x2), y1−y2≥1 (col x3≤0, bizarre → ≥ in a max), y1≥0 (≥ row in a min, sensible), y2 free.
Primal: x1=1+x3 with x3∈[−1,0]. Row 1: x2≥5−2x3. Cost ≥17−3x3, minimized at x3=0: x=(1,5,0), value 17. Dual: y=(3,−1): 3−1=2≤2, 3≤3, 3+1=4≥1. Value 18−1=17. ✓ Slackness: x1,x2>0 and their dual rows are tight. ✓
A10 ★. max3x1+2x2 s.t. x1+x2≤4,x1+3x2≤6,x1≤3,x≥0. Someone claims x=(3,1) is optimal. Use complementary slackness to find a certificate.
Show answer
All three rows are tight at (3,1) (4, 6, 3), value 11. x1,x2>0 force the dual rows tight: y1+y2+y3=3, y1+3y2=2. This is degenerate (more tight rows than needed), so try y2=0: y1=2,y3=1, all ≥ 0. Dual value 4⋅2+6⋅0+3⋅1=11. Matches, so (3,1) is optimal. (y3=0 would force y2=−21<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∗ has yj∗>0, then row j is tight at every optimal x. (e) A vertex in Rn has exactly n 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 x and any optimal y form a zero-gap pair, so complementary slackness applies to every such pair. (e) False: at least n independent ones. Degenerate vertices have more.
A12 ★. Diet LP: foods i cost ci per unit and contain Aji units of nutrient j. You need at least bj of each nutrient. Write the LP and its dual, and interpret the dual.
Show answer
Primal: minc⊤x s.t. Ax≥b,x≥0. Dual: maxb⊤y s.t. A⊤y≤c,y≥0. Interpretation: a pill seller sets a price yj per unit of nutrient j. To stay competitive, the nutrients in each food must not cost more than the food (A⊤y≤c). The seller maximizes revenue b⊤y from selling exactly your requirements. Strong duality: the best pill revenue equals the cheapest diet.
A13 ★. Show that maxx1+x2 s.t. x1−x2≤1,−x1+x2≤1,x≥0 is unbounded, and conclude something about its dual without writing it.
Show answer
x0=(0,0) and ray v=(1,1): Av=(0,0)≤0, v≥0, c⊤v=2>0. So x0+tv is feasible for all t≥0 with objective 2t→∞. By weak duality the dual must be infeasible. Check: the dual requires y1−y2≥1 and −y1+y2≥1, whose sum is 0≥2, 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
min2x1+5x2 s.t. 3x1+2x2≥12, x1+4x2≥8, x≥0. Corners: (0,6) costs 30, (8,0) costs 16, and the intersection 3x1+2x2=12,x1+4x2=8 gives x=(3.2,1.2), cost 6.4+6=12.4. Certificate: at (3.2,1.2) both rows are tight and both xi>0, so by complementary slackness try making both "coefficient" conditions tight: 3y1+y2=2, 2y1+4y2=5, giving y=(0.3,1.1)≥0. Then 0.3(3x1+2x2)+1.1(x1+4x2)=2x1+5x2≥0.3⋅12+1.1⋅8=12.4 for every feasible x. Optimal.
A15 ★. Write an LP for minx∈R2∣x1−x2∣+∣x1+x2−4∣+∣x2−1∣. How many variables and constraints?
Show answer
mint1+t2+t3 s.t. t1≥x1−x2, t1≥x2−x1, t2≥x1+x2−4, t2≥4−x1−x2, t3≥x2−1, t3≥1−x2, with x1,x2,t free. 5 variables and 6 constraints. (Optimum 0 is impossible here, since it would need x1=x2=1 and x1+x2=4. For example x=(2,2) gives 0+0+1=1, and x=(3,1) gives 2+0+0=2.)
A16 ★. Write an LP that finds x∈Rn with Ax≤b minimizing the largest coordinate maxixi.
Show answer
mint s.t. xi≤t for all i, Ax≤b, with t and x free. At the optimum t=maxixi.
A17 ★. Show that an algorithm for canonical LPs (maxc⊤x,Ax≤b,x≥0) can solve LPs of the form maxc⊤x s.t. Ax=b,x≥0.
Show answer
Replace Ax=b by Ax≤b and −Ax≤−b, i.e. the matrix (−AA) and right side (−bb). 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: max2x1−x2 s.t. x1−x2≤1,−x1+x2≤−2,x≥0, whose dual needs y1−y2≥2 and y1−y2≤1.
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∣ variables). The path LP can have exponentially many variables.
B3. Why does every s–t cut give a feasible y∈{0,1}E? Why doesn't that alone finish max-flow/min-cut?
Show answer
Every path crosses out of S at least once, so it has length ≥ 1. This shows OPT(D)≤ 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→t, s→b→t with csa=3,cat=2,csb=2,cbt=3 and lengths .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) for (s,a,b,t). Cuts 5, 4, 5 on intervals of length .4, .3, .3. Average 4.7 = ∑ceye. Best cut {s,a} = 4. Flow 2+2 = 4 matches.
B5. How does one shortest-path computation verify all path constraints of Dlength? What if t is unreachable?
Show answer
Dijkstra with lengths y≥0. If d(t)≥1, all constraints hold. Otherwise the shortest path is a violated constraint. Unreachable t means d(t)=∞: there are no paths and nothing is violated.
B6. For a1=(1,0),a2=(1,1),p=(0,1) show p∈/ cone and give a witness.
Show answer
Cone points have first coordinate ≥ second. w=(1,−1): a1⊤w=1, a2⊤w=0, p⊤w=−1.
B7 ★. Same generators, p=(−1,2). In the cone? If not, give a witness and the nearest cone point.
Show answer
(λ1+λ2,λ2)=(−1,2) forces λ2=2,λ1=−3<0, so not in the cone. Witness w=(1,−1): 1≥0,0≥0, p⊤w=−3<0. Nearest point: project p onto the ray of a2: ∥a2∥2p⊤a2a2=21(1,1). Then v=p−q=(−1.5,1.5) and −v=(1.5,−1.5) is a positive multiple of w.
B8 ★. Separation: C = unit disk, p=(3,4). Find q, v, and check v⊤z≤v⊤q for all z∈C.
Show answer
q=p/∥p∥=(0.6,0.8), v=(2.4,3.2). v⊤q=1.44+2.56=4. Over the disk maxv⊤z=∥v∥=4 (Cauchy–Schwarz), so v⊤z≤4. v⊤p=7.2+12.8=20>4.
B9. Rebuild the strong-duality proof: at an optimal x∗, suppose c is not a nonnegative combination of active normals. What does Farkas give, how do you choose ε, and how does the cone identity produce a dual of the same value?
Show answer
Farkas: w with ar⊤w≥0 (tight r), c⊤w<0. Set v=−w. Then ε=min{δr/ar⊤v:r slack,ar⊤v>0} (or any positive number if no such row), and x∗+εv is feasible and better, a contradiction. So c=A⊤y−z with y,z≥0 supported on tight rows. Then y is dual feasible and c⊤x∗=b⊤y. See 5.6–5.7.
B10 ★. Why must the strong-duality argument include the normals of −xi≤0? Give an example.
Show answer
max(−x) s.t. x≤1,x≥0: at x∗=0 the only tight constraint is −x≤0 with normal −1, and c=−1 is in its cone. Without it, the tight set is empty, the cone is {0}, and c∈/{0} would wrongly "prove" 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/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≤−1 (with x free) is infeasible by giving a Farkas certificate of the form (F3).
Show answer
Take y=(1,1,1)≥0. A⊤y: first column (1,−1,0)⋅y=0, second (1,0,−1)⋅y=0. So A⊤y=0. b⊤y=2−2−1=−1<0 ✓. Adding the three rows gives 0≤−1.
B13 ★. Find the value and optimal mixed strategies of the game A=(2−1−11) (Alice picks the row).
Show answer
Alice plays row 1 with probability p. Her payoff against column 1 is 2p−(1−p)=3p−1, against column 2 it is −p+(1−p)=1−2p. Her guarantee is min(3p−1,1−2p), maximized where they are equal: p=52, value 51. Bob plays column 1 with probability q: row payoffs 3q−1 and 1−2q, and the max is minimized at q=52, also 51. Both guarantees are 51: the value is 51, with p∗=q∗=(52,53).
B14 ★. Why is minq∈Δnc⊤q=minjcj? Why does this matter for writing a game as an LP?
Show answer
c⊤q is a weighted average of the cj (weights qj≥0, sum 1), so it is at least minjcj, with equality at q=ej∗. 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∗.
Show answer
See 6.3. Divide by θ and let θ↓0. Result: f(x)−f(x∗)≤⟨∇f(x),x−x∗⟩.
C2. Prove local ⇒ global for convex f,K. Must a constrained differentiable optimum satisfy ∇f=0?
C6. D=2,G=3,T=900: find η and the error. T for ε=0.1?
Show answer
η=1/45, error ≤ 0.2. T≥3600, η=1/90.
C7. Prove that the average of T points in a convex set is in the set, and prove the many-point convexity inequality.
Show answer
Induction. xˉT=TT−1xˉT−1+T1xT−1 is a two-point blend, so it stays in the set and f(xˉT)≤TT−1f(xˉT−1)+T1f(xT−1)≤T1∑f(xt).
C8. A student claims: "convexity alone gives a bounded G; the theorem guarantees the last iterate; T iterations means O(T) total time; the approximation is multiplicative." Fix all four.
Show answer
(1) No: x2/2 has unbounded gradient. G is an assumption on the iterates. (2) No: average (or best) of the queried points. (3) No: T× (cost per gradient + O(d)), e.g. O(Tmd) for least squares. (4) No: additive, f(xˉ)−f(x∗)≤ε.
C9 ★. Which are convex on their domain? (a) max(x2,1−x) (b) ex+∣x∣ (c) x1x2 on R2 (d) −logx on x>0 (e) min(x,0) (f) dist(x,[0,1]) (g) x2−∣x∣
Show answer
(a) yes (max of convex). (b) yes (sum). (c) no: Hessian (0110) has eigenvalue −1. (d) yes (f′′=1/x2>0). (e) no: it is concave (min of linear functions), with a corner pointing up. (f) yes (partial minimization). (g) no: two dips at ±21.
C10 ★. Is f(x,y)=x2+3xy+y2 convex?
Show answer
H=(2332). det=4−9<0, so one eigenvalue is negative and f is not convex. Direction v=(1,−1): v⊤Hv=2−6+2=−2<0.
C11 ★. D=10, G=1, target ε=0.01. How many iterations and which η?
Show answer
T≥(10⋅1/0.01)2=106. η=10/(1⋅1000)=0.01.
C12 ★. Subgradient descent on f(x)=∣x∣ from x0=0.25 with η=0.1, using g=sign(x) (and g=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… 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=1: 0.2T0.0625+0.05. The floor ηG2/2=0.05 is exactly the bounce size, the "discrete step penalty" made visible. To shrink it, take smaller η (and more steps).
C13 ★. Why can the analysis use x∗ though the algorithm cannot?
Show answer
The algorithm's steps only use gradients at its own iterates. x∗ appears only in the potential Rt 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) minimizes h(η)=2ηTD2+2ηG2. What happens to the bound if you use 2η⋆ instead?
Show answer
h′(η)=−2η2TD2+2G2=0 gives η⋆, and h′′>0. With 2η⋆: first term 4TDG, second TDG, total 1.25TDG, only 25% worse. The bound is not very sensitive to a constant-factor error in η.
Unit 10.7 · Exam toolkit
Practice D: projections and smoothness (L13)
Sources: Lec13 + added questions
D1. Project u=(5,−1) onto the box [0,2]×[0,3], and u=(3,4) onto the unit ball.
Show answer
Box: clip each coordinate: min{2,max{0,5}}=2, min{3,max{0,−1}}=0, so (2,0). Ball: ∥u∥=5>1, so u/∥u∥=(0.6,0.8).
D2. Prove: if p=ΠK(u) for convex K, then ∥p−z∥2≤∥u−z∥2−∥u−p∥2 for all z∈K.
Show answer
See unit 8.3: f(θ)=∥u−p−θ(z−p)∥2 is minimized at θ=0 over [0,1] (convexity keeps p+θ(z−p)∈K), so f′(0+)=2⟨u−p,p−z⟩≥0. Expand ∥u−z∥2=∥u−p∥2+∥p−z∥2+2⟨u−p,p−z⟩.
D3. Why does projected GD keep the L12 bound? Where exactly is x∗∈K used? Why is the output feasible?
Show answer
Only the first line changes: Rt+1=∥ΠK(yt+1)−x∗∥2≤∥yt+1−x∗∥2, the projection inequality with z=x∗. That needs x∗∈K. The rest of the proof (convexity, G, telescoping, Jensen) is identical. The average of points of the convex set K lies in K.
D4. Projected GD: minx∈[0,1](x−3)2, x0=0, η=0.25. Compute two steps. Is the gradient zero at the optimum?
Show answer
f′(x)=2(x−3). t=0: y=0−0.25⋅(−6)=1.5, projected to 1. t=1: y=1−0.25⋅(−4)=2, projected to 1. The method sits at x∗=1, where f′(1)=−4=0: a boundary optimum with nonzero gradient.
D5. Which are β-smooth on R, and with which β? x2/2, ∣x∣, 25(x−1)2, log(1+ex), x4, sinx.
Show answer
x2/2: β=1. ∣x∣: no. 25(x−1)2: β=5. Softplus: β=1/4. x4: no (f′′ unbounded). sinx: β=1, but it is not convex.
D6. Prove the descent lemma. What is s and why is it there?
Show answer
See unit 8.6. s∈[0,1] parametrizes the segment from x to y, turning f into the 1-D function 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, and ∫01sds=21.
D7. For which step sizes does the descent lemma guarantee f(xt+1)<f(xt) (when ∇f(xt)=0)? Which step maximizes the guaranteed decrease?
Show answer
f(xt+1)≤f(xt)−η(1−βη/2)∥g∥2. The decrease is positive for 0<η<2/β. The factor η(1−βη/2) is maximized at η=1/β, with value 1/(2β).
D8. Reproduce the proof of f(xT)−f∗≤βD2/(2T). Where are convexity, smoothness and monotonicity each used?
Show answer
Smoothness: safe step f(xt+1)≤f(xt)−2β1∥gt∥2. Convexity: f(xt)−f∗≤⟨gt,xt−x∗⟩. Algebra: ⟨gt,xt−x∗⟩−2β1∥gt∥2=2β(Rt−Rt+1). Telescope to 2βR0≤2βD2. Monotonicity (from the safe step): the sum of T errors is ≥T(f(xT)−f∗).
D9. β=4, D=3, ε=0.01. How many steps does smooth GD need? How many would the bounded-gradient method need if G=2?
D10. A summary table claims the bounded-gradient method needs O(ε−1) steps. Is that right? Explain.
Show answer
DG/T≤ε⟺T≥(DG/ε)2, so O(ε−2). It must be slower than the smooth O(ε−1), because it uses weaker assumptions.
D11. GD with η=1/β on f=21(x12+4x22) from x0=(2,1): compute x1,x2, their errors, and the bound.
Show answer
β=4, η=1/4: x1=(1.5,0), f=1.125; x2=(1.125,0), f≈0.633. D2=5, bound βD2/(2T)=10/T: 10 and 5. Valid but loose.
D12. True or false? (a) β-smooth ⇒ convex. (b) For convex β-smooth f with η=1/β, f(xt) is nonincreasing. (c) The smooth theorem needs a gradient bound G. (d) The projection argument works for any closed set. (e) The safe step needs T in advance.
Show answer
(a) False (sinx). (b) True (safe-step inequality; convexity not even needed). (c) False. (d) False: it needs convexity (the segment from p to z must stay in K). (e) False: η=1/β does not depend on T, unlike D/(GT).
D13 ★. Give the strong convexity constant α (or say "not strongly convex"): 3x2; x2+∣x∣; 21(x12+9x22); log(1+ex); 21∥Ax−b∥2 with A=(1002).
Show answer
3x2: f′′=6, α=6. x2+∣x∣: x2 is 2-strongly convex and ∣x∣ is convex, so α=2. 21(x12+9x22): Hessian diag(1,9), α=1 (and β=9). Softplus: f′′→0 at ±∞, not strongly convex. A⊤A=diag(1,4), α=1.
D14 ★. f is 2-strongly convex with unconstrained minimizer x∗, and f(x)−f(x∗)≤0.01. How close is x to x∗?
Show answer
Quadratic growth: 2α∥x−x∗∥2≤f(x)−f(x∗)≤0.01, so ∥x−x∗∥2≤0.01 and ∥x−x∗∥≤0.1.
D15 ★. Prove that an α-strongly convex differentiable f on Rd has at most one minimizer.
Show answer
If x∗ and y∗ both minimize, then ∇f(x∗)=0 and the definition gives f(y∗)≥f(x∗)+2α∥y∗−x∗∥2. Since f(y∗)=f(x∗), this forces ∥y∗−x∗∥=0.
D16 ★. Verify the regrouping identity ∑t=0T−1(atRt−btRt+1)=a0R0+∑t=1T−1(at−bt−1)Rt−bT−1RT 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. Collect the coefficient of each Rt. The middle terms are ≤0 (droppable in an upper bound) when at≤bt−1 and Rt≥0. The last term −bT−1RT≤0 can be dropped when bT−1≥0.
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). Max: value A(I)≥OPT(I)/α. For min, every feasible solution costs at least OPT, so OPT≤A(I)≤αOPT forces α≥1 (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/ε (b) n4/ε2 (c) 31/εn2 (d) (n/ε)3
Show answer
(a) PTAS, not FPTAS (degree grows with 1/ε). (b) FPTAS. (c) PTAS, not FPTAS (exponential in 1/ε). (d) FPTAS. Every FPTAS is also a PTAS.
E3 ★. Run greedy-by-degree on the spider with four legs c−ai−bi, i=1,…,4. Compare with OPT and check the claim deg(vt)≥∣Et−1∣/OPT at every step.
Show answer
m=8, OPT=4 ({a1,…,a4}; the four edges aibi are a matching, so no cover is smaller). Step 1: c has degree 4 (unique max) ≥ 8/4 = 2 ✓. Then 4 disjoint edges remain; each step picks degree 1, and 1≥∣E∣/4 for ∣E∣=4,3,2,1 ✓. Greedy uses 5 vertices. The bound 8(3/4)t drops below 1 at t=8, consistent with ⌊4ln8⌋+1=9.
E4. Prove: if S∗ is an optimal cover and E′ is any set of remaining edges, some vertex has at least ∣E′∣/OPT edges of E′.
Show answer
Every edge of E′ has an endpoint in S∗, so ∑c∈S∗degE′(c)≥∣E′∣. The largest of these OPT numbers is at least their average, ∣E′∣/OPT.
E5. From ∣Et∣≤me−t/OPT, show the greedy loop runs at most ⌊OPTlnm⌋+1 times. Why is integrality needed?
Show answer
For t=⌊OPTlnm⌋+1>OPTlnm we get me−t/OPT<me−lnm=1, so ∣Et∣<1. The bound itself is never 0. Only because ∣Et∣ is a nonnegative integer can we conclude ∣Et∣=0, i.e. the loop has stopped. Each iteration adds one vertex, so ∣S∣≤t.
E6. On the path a−b−c−d, what can the matching algorithm return? Compare with OPT and with the maximum matching.
Show answer
If it picks bc first, both other edges are removed: C={b,c}, size 2 = OPT, but ∣M∣=1<2= maximum matching. If it picks ab first, cd remains and is picked: C={a,b,c,d}, size 4 = 2·OPT. Both outcomes respect ∣M∣≤OPT≤∣C∣=2∣M∣.
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 M into C. 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
k disjoint edges: the algorithm must pick every edge (each is its own component), returns 2k, while OPT=k. Another family: Kn,n, where every maximal matching is perfect, so the output is all 2n vertices and OPT=n.
E9 ★. Show that any maximal matching M has at least half as many edges as a maximum matching M∗.
Show answer
Every edge of M∗ shares an endpoint with some edge of M (maximality). An edge {u,v}∈M has two endpoints, and each endpoint lies on at most one edge of M∗, so at most 2 edges of M∗ are charged to it. Hence ∣M∗∣≤2∣M∣: 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 s.t. xu+xv≥1 for each edge, x≥0, plus x∈ZV for the IP. If xv>1, lowering it to 1 keeps every constraint (1+xu≥1) and strictly lowers the objective, so such a point is not optimal. (With weights wv≥0: lowering never increases the cost, so some optimal solution lies in [0,1]V.)
E11. Find OPTLP and OPT for the 5-cycle and for K4. What does threshold rounding return from the all-½ solution? Check the 2-approximation bound.
Show answer
C5: all ½ gives 5/2. Summing the 5 edge constraints gives 2∑x≥5, so OPTLP=25. OPT = 3. Rounding keeps all 5 vertices: 5≤2⋅25=5≤2⋅3. K4: OPTLP=2 (all ½; summing the 6 constraints gives 3∑x≥6), 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∗=21 (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, so the guarantee weakens to 2.5.
E13. Write the dual of the weighted vertex cover LP min∑vwvxv s.t. xu+xv≥1,x≥0. Interpret it.
Show answer
max∑eye s.t. ∑e∋vye≤wv for every vertex, y≥0. Edges receive "payments" ye, and the total payment at a vertex cannot exceed its weight. Any such y lower-bounds the cheapest cover by weak duality. With unit weights and integral y it is a matching.
E14. Derive the vertex cover dual by the multiplier method (no rulebook) and explain where ∑e∋v comes from.
Show answer
Multiply each edge constraint xu+xv≥1 by ye≥0 and add: ∑eye(xu+xv)≥∑eye. Regroup the left side by vertex: xv appears once for every edge at v, giving ∑vxv∑e∋vye. If ∑e∋vye≤1 for all v, then ∑vxv≥∑vxv∑e∋vye (as x≥0), so ∑vxv≥∑eye. The best such bound is the dual.
E15 ★. Is the odd cycle C2k+1 a good example of a large integrality gap for vertex cover?
Show answer
No. OPTLP=22k+1 (all ½, and summing the constraints gives 2∑x≥2k+1) and OPT=k+1, so the ratio 2k+12k+2→1. The complete graph Kn gives n/2n−1→2.
E16 ★. In a set cover instance every element lies in at most f sets. Give an LP-rounding f-approximation in steps.
Show answer
(1) IP: min∑ScSxS s.t. ∑S∋exS≥1 for each element e, x∈{0,1}. (2) Relax to x≥0 and solve: OPTLP≤OPT. (3) Round x^S=1 iff xS∗≥f1. (4) Feasible: the at most f values in each row add up to ≥ 1, so the largest is ≥ f1. (5) Cost: x^S≤fxS∗, so ∑cSx^S≤fOPTLP≤fOPT.
E17. In the facility location IP, explain yij≤xi and ∑iyij=1. Why are upper bounds x,y≤1 unnecessary in the relaxation?
Show answer
yij≤xi: a client cannot be assigned to a closed facility (xi=0⇒yij=0). ∑iyij=1: every client is assigned to exactly one facility. yij≤1 follows from the sum constraint and y≥0, and any xi>maxjyij can be lowered to maxjyij≤1 without increasing the cost.
E18. Prove that at least half of client j's LP assignment lies in Bj={i:dij≤2Lj}.
Show answer
For i∈/Bj, dij>2Lj, so yij∗≤2Ljdijyij∗. Summing over i∈/Bj: ∑i∈/Bjyij∗≤2Lj1∑idijyij∗=21. Since the yij∗ sum to 1, ∑i∈Bjyij∗≥21, and xi∗≥yij∗ gives the same for x∗. (If Lj=0, all mass is at distance 0, inside Bj.)
E19 ★. In the facility location rounding, which step breaks if clients are processed in an arbitrary order instead of by increasing Lj?
Show answer
The connection bound for a non-representative: d(j,ir)≤2Lj+2Lr+2Lr. Sorting gives Lr≤Lj, hence ≤6Lj. In another order Lr could be much larger than Lj, and client j 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≈m?
Show answer
Each greedy path can block about L short optimal paths (charging), and there are at most m/(L+1) long optimal paths (edge-disjointness). The bound OPT≤(L+1)a+L+1m is smallest in order of magnitude when L≈m/L, i.e. L≈m, giving O(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
Source
Content
Units
Lecture 9
Part 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 certificate
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; scope
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, Lj, balls, Markov lemma, rounding algorithm (6-approximation stated); exam-scope announcement
mixed strategies, linear functions over the simplex, max-min trick, writing the dual of a mixed-form LP, strong duality, reading optimal solutions as strategies
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−x in place of the limit; weighted vertex cover and the f-approximation; the Fano-plane example; the multiplier derivation of the matching dual; tightness/gap/hardness comparison; the 6-approximation proof and the c=34 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.