Unit 1 of 8 · about 5 hours · derive

Convexity, optimality conditions and conditioning

An optimizer's behavior starts with the objective's geometry. These conditions tell you which local evidence certifies a global solution and which does not.

You'll be able to

  • Prove the first- and second-order characterizations of a differentiable convex function on an open convex domain.
  • Distinguish stationary points, local minima and global minima, including degenerate Hessians.
  • Read smoothness, strong convexity and conditioning from a quadratic's eigenvalues.

Covers

Convex sets, convex functions and geometric intuitionFirst- and second-order optimality conditionsSmoothness, strong convexity and conditioning
1

Read

In this order, only the parts listed

0 of 3 done

  1. EE364a: convex sets and convex functionsStanford EE364a - Convex Optimization

    Lecture 2 notes: Convex set (slide 2-3), Convex combination and convex hull (2-4), Hyperplanes and halfspaces (2-6), and Intersection (2-12)

    Read these headings only. Use the book below for the proofs; leave separation and generalized inequalities aside.

  2. EE364a: derivative tests for convexityStanford EE364a - Convex Optimization

    Lectures 3 and 4 notes: First-order condition (slide 3-7), Second-order conditions (3-8), and Examples (3-9): quadratic and least-squares functions

  3. Convexity proofs and curvature boundsConvex Optimization

    Sections 2.1.4 (pp. 23 to 25), 3.1.1 to 3.1.4 (pp. 67 to 71), 4.2.3 through Unconstrained problems (pp. 139 to 141), and 9.1.2 (pp. 459 to 463)

    Prove the derivative tests using restrictions to lines. In 9.1.2 focus on the lower and upper quadratic models and the ratio , not the width calculation.

2

Focus on

  • A convex set contains every segment between its points. A convex function has a convex domain and lies below each chord; its tangent planes lie below its graph.
  • For functions on an open convex domain, a PSD Hessian everywhere characterizes convexity. At one stationary point, a PSD Hessian is only a necessary local-minimum condition; a PD Hessian is sufficient.
  • For with symmetric positive definite , , , and . The gradient is -Lipschitz and the lower quadratic model uses .
Common mistakes · 3
  • Dropping the convex-domain assumption: has positive second derivative on its disconnected domain, but that domain is not convex.
  • Calling every stationary point a minimum: has a saddle at the origin.
  • Equating strict and strong convexity: is strictly convex on but has no positive global lower curvature bound.
3

Try it yourself

Closed-book, before checking anything

Closed-book, prove the first-order inequality in both directions, then prove the Hessian test by restricting to a segment. By hand use : find , , , and . Check with NumPy float64 arrays, np.linalg.eigvalsh(Q) and np.linalg.cond(Q); scalar absolute differences from [1,9], 9 and 5 must be below 1e-12. No random draws are needed.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Where are the assumptions used in the first-order proof?Answer

    Convexity of the domain keeps inside it. Convexity of supplies the chord inequality; divide by positive and use differentiability as tends to zero. Conversely, apply the tangent inequality at to and . Nonnegative weights preserve inequalities and cancel the derivative terms; domain convexity ensures exists. At or the chord statement is equality.

  2. 2.Why does a zero gradient certify a global minimum only in the convex case?Answer

    The convex tangent lower bound becomes for every feasible . Without convexity that lower bound need not hold; has zero derivative at its maximum.

  3. 3.Does a zero Hessian at a stationary point settle local optimality?Answer

    No. At zero, has a minimum and has a maximum; both have zero derivative and zero second derivative.

  4. 4.Why is needed for uniqueness?Answer

    The strong-convexity midpoint inequality subtracts . Two distinct minimizers would therefore give a midpoint below the optimal value. Convexity keeps the midpoint feasible; makes the subtraction strictly positive.

5

Practice

You're done when

You can prove both derivative tests with their domain assumptions, classify the three stationary-point counterexamples, and recover the quadratic's curvature bounds without notes.

Only when you can do this without notes.

Leads to

Notes

Resources · 2 for this unit, 9 more in the section
  • Stanford EE364a - Convex OptimizationStanford Engineering Everywhere · primary

    Follow lectures 1-9 and 15-16; use lecture 17 only for KKT systems. Leave full interior-point treatment for later.

  • Convex OptimizationBoyd & Vandenberghe · required

    Read Chapters 1-5 and 9 with the course; use Chapter 10 only for equality-constrained Newton steps.

Also in this section

  • D2L - Optimization AlgorithmsD2L authors · required

    Use the convexity, GD, SGD, minibatch, momentum, AdaGrad, RMSProp, Adam and scheduler sections for ML derivations and code.

  • Fundamentals of Numerical ComputationDriscoll & Braun · required

    Study §§1.1-1.4, 2.7-2.8, 3.2-3.4 and 4.2-4.3 for floating point, conditioning, stability, least squares and iteration error, in the Python edition.

  • CVXPY basic and DCP tutorialsCVXPY documentation · support

    Use as the solver oracle after deriving a constrained problem and its KKT conditions by hand.

  • Proximal AlgorithmsNeal Parikh and Stephen Boyd · reference

    Read Sections 1.1, 4.2 and the elementwise soft-thresholding formula in 6.5.2, then the lasso formulation on p. 196. Skip 7.1.1's penalty-scaling and Gram-rewrite errors on p. 197; derive the update from 4.2 and 6.5.2.

  • PyTorch optimizer and gradient-clipping contractsPyTorch · reference

    Use AdamW's algorithm and clip_grad_norm_'s parameters to locate weight decay and clipping precisely. Inspect state_dict for optimizer restart; no network training is assigned.

  • SciPy minimize: BFGSSciPy · reference

    Read the BFGS method description and gtol, maxiter, c1 and c2 options. Supply an analytic gradient and compare residuals and evaluation counts, not just iterations.

  • PyTorch numerical type informationPyTorch · reference

    Read torch.finfo's eps, max and smallest_normal fields and its subnormal note; inspect float64, float32, float16 and bfloat16 on CPU.

  • The Accuracy of Floating Point SummationNicholas J. Higham · reference

    Read Section 2's recursive-sum error bound and Section 3's pairwise and compensated summation algorithms. Leave the statistical error models and historical machine details aside.

  • Accurately computing running varianceJohn D. Cook · support

    Read the Welford mean and centered-sum recurrences. Prove the centered-sum invariant and translate the recurrence to NumPy; skip the C++ class.