4.10.17Advanced Topics (Elite Level)

Convex optimization — convex sets, convex functions

1,937 words9 min readdifficulty · medium6 backlinks

1. Convex Sets

WHAT is θx+(1θ)y\theta x + (1-\theta)y? As θ\theta sweeps from 00 to 11, this point sweeps along the straight segment from yy (at θ=0\theta=0) to xx (at θ=1\theta=1). It is a convex combination of two points.

WHY this definition? "No dents, no holes." A disk is convex; a crescent moon is not (a chord can poke outside). A donut is not (a chord crosses the hole).

Figure — Convex optimization — convex sets, convex functions

2. Convex Functions

WHY this inequality? LHS = the function's actual height at the midpoint-ish point. RHS = the chord's height there. Convex means the bowl never bulges above its own chords.

Curvature tests (HOW to check in practice)


Recall Feynman: explain it to a 12-year-old

Imagine a skate ramp shaped like a bowl. Drop a marble anywhere inside — it always rolls to the same lowest point. That's a convex function: there's just one bottom, so you can never get tricked into stopping at a fake "low spot." A convex set is a region with no dents and no holes: pick any two spots in it, stretch a string straight between them, and the string never leaves the region. Optimization is "find the bottom"; convexity guarantees the bottom is easy to find and there's only one.


Connections

  • Linear Programming — feasible region = intersection of half-spaces = convex polyhedron.
  • Gradient Descent — for a convex objective it converges to the global min (rather than a local one), provided the usual algorithmic conditions hold: a sensible step-size rule and smoothness/Lipschitz-gradient assumptions. Convexity removes local-min traps; it does not by itself guarantee convergence.
  • Lagrange Multipliers and KKT Conditions — KKT becomes sufficient (not just necessary) under convexity.
  • Positive Definite Matrices — the Hessian test 2f0\nabla^2 f\succeq 0.
  • Jensen's Inequality — the convexity inequality generalized to expectations.
  • Norms and Inner Products — every norm is a convex function.

Flashcards

Define a convex set.
For all x,yC, θ[0,1]x,y\in C,\ \theta\in[0,1], θx+(1θ)yC\theta x+(1-\theta)y\in C — the whole segment lies inside.
Define a convex function.
f(θx+(1θ)y)θf(x)+(1θ)f(y)f(\theta x+(1-\theta)y)\le \theta f(x)+(1-\theta)f(y); the chord lies on/above the graph.
Geometric link between convex set and convex function?
ff convex     \iff its epigraph {(x,t):tf(x)}\{(x,t):t\ge f(x)\} is a convex set.
First-order convexity condition?
f(y)f(x)+f(x)(yx)f(y)\ge f(x)+\nabla f(x)^\top(y-x) — graph lies above every tangent.
Second-order convexity condition?
Hessian 2f(x)0\nabla^2 f(x)\succeq 0 for all xx (in 1-D: f0f''\ge0).
Why does convexity guarantee global minima?
A nearby better point + segment-staying-inside + chord inequality contradicts local-minimality, so local = global.
Is the circle x=1\|x\|=1 convex?
No — a chord passes through the empty interior. The closed disk x1\|x\|\le1 is convex.
What preserves convexity of sets?
Intersection and affine images (and thus polyhedra {x:Axb}\{x:Ax\le b\}).
What preserves convexity of functions?
Nonnegative weighted sums, max of convex functions, composition with affine map.
Does strict convexity require f>0f''>0 everywhere?
No — f>0f''>0 everywhere is sufficient but not necessary; e.g. x4x^4 is strictly convex with f(0)=0f''(0)=0. Non-strict convex only needs f0f''\ge0.

Concept Map

splits into

splits into

defined by

defined by

example of

preserves

preserves

of half-spaces gives

feasible region of

combined with

combined with

enables

Convexity

Convex set

Convex function

Segment stays inside set

Chord lies above graph

Half-spaces and balls

Polyhedron Ax<=b

Intersection preserved

Affine image preserved

Every local min is global

Reliable large-scale solving

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, convex optimization ka pura funda ek hi line mein hai: agar problem "bowl-shaped" hai, toh local minimum aur global minimum same ho jaate hain. Iska matlab gradient descent jaisa algorithm sahi global answer tak pahunch sakta hai — par yaad rakhna, convexity local-min trap hata deti hai, magar actual convergence ke liye sahi step-size rule aur gradient ki smoothness (Lipschitz) bhi chahiye. Isiliye convex problems woh family hai jise hum reliably solve kar paate hain.

Do cheezein samajhni hain. Pehli — convex set: koi bhi region jismein dent ya hole na ho. Test simple hai: region ke andar koi bhi do points lo, unke beech seedhi line (segment) kheencho — agar line poori region ke andar rahti hai toh set convex hai. Disk convex hai, crescent (chand) ya donut nahi, kyunki chord bahar nikal jaati hai. Half-space aur unka intersection (yani polyhedron AxbAx\le b) hamesha convex — yahi LP ka feasible region hai.

Doosri — convex function: graph par do points lo, unke beech chord (seedhi line) kheencho. Agar chord hamesha graph ke upar ya barabar rahe, toh function convex hai. Equivalent test: f(x)0f''(x)\ge 0 (multi-dimension mein Hessian PSD, yani 2f0\nabla^2 f \succeq 0). Aur ek khoobsurat property — graph apni har tangent ke upar hota hai: f(y)f(x)+f(x)(yx)f(y)\ge f(x)+\nabla f(x)^\top(y-x). Isi se proof aata hai ki f=0\nabla f=0 matlab global minimum.

Common galti: "circle convex hai kyunki round hai" — galat! Bhari hui disk convex hai, sirf rim (circle) nahi, kyunki chord khaali andar se guzarti hai. Aur convex ke liye sirf f0f''\ge0 chahiye; strict convexity ke liye f>0f''>0 "everywhere" zaroori nahi hai — jaise x4x^4 strictly convex hai par f(0)=0f''(0)=0. Yaad rakhna: chord upar, set beech mein, tangent neeche.

Go deeper — visual, from zero

Test yourself — Advanced Topics (Elite Level)

Connections