Exercises — Convex optimization — convex sets, convex functions
Level 1 — Recognition
L1.1 — Spot the convex sets
Which of these are convex? (a) closed disk ; (b) the ring ; (c) the half-plane ; (d) the two points .
The picture below is the whole exercise in one glance: a chord inside the filled disk (stays in — convex) versus a chord across the ring (cuts through the empty hole — not convex).

Recall Solution
(a) Convex. A filled ball is the model example — no dents, no holes. Any chord between two interior/boundary points stays inside (left panel of the figure). (b) NOT convex. The ring has a hole (the inner disk of radius is removed). A chord across the middle passes through the hole, leaving the set (right panel of the figure). (c) Convex. A half-plane is convex: if and , then mixing gives . The inequality passes straight through the mix because is linear. (d) NOT convex. Two isolated points: the midpoint is not in the set. To be convex, the whole segment must be present.
L1.2 — Spot the convex functions
By eye (or a one-line ), classify each on its natural domain: (a) ; (b) ; (c) ; (d) on .
The chord test made visual: for a convex function the straight chord sits on or above the graph; for a concave one it sits below.

Recall Solution
(a) Convex (and concave). . A straight line is the boundary case: chord equals the graph, so holds with equality. (b) Concave. ; it is a downward bowl (right panel of the figure). Its negative is convex (left panel). (c) Convex. has a corner, not a Hessian at , so use the definition + triangle inequality: . (d) Neither. changes sign (positive on , negative on ). Convexity requires everywhere.
Level 2 — Application
L2.1 — Second-order test in 1-D
Show is convex on , and decide whether it is strictly convex.
Recall Solution
What is the Hessian? For a function of several variables, the Hessian is the matrix of all second partial derivatives — it records the curvature in every direction. In 1-D it collapses to the single number . Second-order tool — WHY: the Hessian test says convex everywhere, because measures how the tangent-slope changes; if the slope only increases, the graph curls upward and stays above its tangents. Compute: , for all . So is convex. ✔ Strictly convex? , so the sufficient condition " everywhere" fails at . But strict convexity is defined by the chord inequality with strict "", which satisfies (its graph never contains a straight segment). So is strictly convex despite : " everywhere" is sufficient, not necessary.
L2.2 — Hessian test in 2-D
Is convex?
Recall Solution
WHY the Hessian: in higher dimensions "curves upward" becomes "the matrix of second derivatives (the Hessian, defined in L2.1) is positive semidefinite" (see Positive Definite Matrices). We test . A symmetric matrix is positive semidefinite iff its trace and determinant . Trace ; determinant . Both eigenvalues positive, so . Hence is strictly convex. ✔
Level 3 — Analysis
L3.1 — Which operations preserve convexity?
Let be convex on . Which are guaranteed convex? (a) ; (b) ; (c) ; (d) .
Recall Solution
Reminder — epigraph. The epigraph of is the set of all points on or above its graph: . A key fact (from the parent note) is that is convex iff is a convex set. We use this in part (c). (a) Convex. Nonnegative-weighted sums of convex functions are convex: add the chord inequalities, weights keep the direction. qualifies. (b) NOT guaranteed. is concave; convex + concave can be anything. Example: , gives (concave). So no. (c) Convex. The pointwise maximum of convex functions is convex. Reason via epigraphs: a point lies on or above both graphs exactly when , so . The intersection of two convex sets is convex, hence is convex. (d) NOT guaranteed. The product of two convex functions need not be convex. Take (convex) and (convex, since ). Their product has , which is negative for between the roots and . So is concave on that interval — the product is not convex on . No general guarantee.
L3.2 — Half-spaces and polyhedra
Explain, from the intersection rule, why the feasible region of any linear program is convex. Illustrate with the triangle .
Recall Solution
Each row of is one inequality — a half-space, which is convex (L1.1c). The full feasible set is the intersection of all these half-spaces. Since intersection preserves convexity (chord in each chord in all chord in the intersection), the polyhedron is convex. This is exactly why Linear Programming optimizes over convex regions. The triangle below is the intersection of three half-planes , , — any two points inside, the segment stays inside.

Level 4 — Synthesis
L4.1 — Build a new convex function
Prove that (the "log-sum-exp" in 2 variables) is convex by computing its Hessian and checking positive semidefiniteness.
Recall Solution
Let . First derivatives: The are like probabilities (positive, summing to 1). Second derivatives give the Hessian Since we have and , so PSD check: trace , determinant . Both eigenvalues ( and ) are , so . Hence log-sum-exp is convex (not strictly — the eigenvalue along direction reflects that adding a constant to all inputs shifts linearly). ✔
L4.2 — Jensen from the definition
Using only the two-point convexity inequality, derive the three-point version for weights . This is the finite Jensen's Inequality.
Recall Solution
Idea: group two points, then merge the third. Assume (else trivial). Write The inner weights , so is a genuine two-point convex combination. Step 1 (outer split): apply two-point convexity to and with dial : Step 2 (inner split): apply two-point convexity again to : Step 3 (substitute): plug in; the cancels the denominators: The same "peel off one point, renormalize the rest" induction gives all .
Level 5 — Mastery
L5.1 — Local = global, made rigorous
Let be convex and convex on . Prove that any local minimizer is a global minimizer. Then show that if is strictly convex, the global minimizer is unique.
Recall Solution
Global part. Suppose is a local min but some has . Form the segment point . Because is convex, for all . Convexity gives for every , since . But as , , so points arbitrarily close to have strictly smaller value — contradicting that is a local minimum. Hence no such exists: is global. ∎ Uniqueness under strict convexity. Suppose two distinct global minimizers with . Take the midpoint ; strict convexity gives a point with value below the supposed minimum — impossible. So the minimizer is unique. ∎
L5.2 — Optimize a convex program by hand
Minimize subject to the line . Solve two ways — (i) substitution, (ii) Lagrange Multipliers and KKT Conditions — and explain why convexity makes the stationary point automatically the global minimum.
Recall Solution
Setup. is convex (Hessian ); the constraint is a line, hence a convex set. Convex objective over convex feasible set ⇒ any stationary point is the global minimum (L5.1), and KKT/Lagrange conditions are sufficient, not merely necessary.
(i) Substitution. Put : minimize . Then , so . Value .
(ii) Lagrange. . Stationarity: Constraint , so , matching (i). Geometrically the gradient must be perpendicular to the line, forcing — the closest point of the line to the origin.
Answer: minimizer , minimum value .

Connections
- Linear Programming — L3.2's polyhedron is exactly an LP feasible region.
- Positive Definite Matrices — the PSD Hessian tests in L2.2, L4.1.
- Jensen's Inequality — L4.2 is its finite form.
- Lagrange Multipliers and KKT Conditions — L5.2 uses KKT-as-sufficient under convexity.
- Gradient Descent — L5.1 is why descent on a convex objective finds the global min.
- Norms and Inner Products — L1.2c convexity of via the triangle inequality.
Recall Self-test checklist
Convex set = segment stays inside ::: filled region, no dents/holes. Convex function test (twice-diff) ::: everywhere. Local min of convex over convex ::: is automatically global. Pointwise max of convex functions ::: convex; pointwise min ::: generally not.