What is it?
is convex if the chord between any two points of its graph lies above the graph — equivalently, for smooth , if . For convex functions every local minimum is global, which is why convex problems are the ones optimization can reliably solve.
Why does it exist?
General optimization is hopeless: a function can hide its minimum anywhere. Convexity is the structural property that makes local information (the slope here) globally trustworthy: if the slope says "downhill is that way", the global minimum really is that way.
Intuition
A convex function is a bowl: no bumps, no secondary valleys. The tangent line at any point lies entirely below the graph, so — the linear prediction is always an underestimate, and a point with zero slope beats every other point.
Formal definition
is convex on an interval if for all and :
For differentiable : convex ; for twice differentiable : convex . is concave if is convex. An inflection point is where concavity changes.
Idea of the proof
Local ⇒ global: if were a local but not global minimum, the chord to a lower point would lie below arbitrarily close to , contradicting local minimality.
Formulas
- Jensen's inequality (convex )
- several variables: positive semidefinite Hessian
Why does it matter?
Linear and logistic regression, support vector machines, LASSO and most of operations research are convex: they come with guarantees and reliable solvers. Deep networks are not, which is why their training is an empirical art — and why it is remarkable that gradient descent works so well on them anyway.
Where it shows up in computing
Convex optimization (linear, quadratic, conic programs) is the workhorse of planning and logistics.
Where it shows up in AI
Squared error and cross-entropy are convex in the predictions; for linear models, in the parameters too.
Training an SVM is a convex quadratic program: a unique global optimum.
Deep-network losses are non-convex: many minima and saddles, yet good minima are easy to find in practice.
Where is it used?
Computing topics reachable from here, through the chain of ideas that leads to them:
What depends on it
Exercises
Show that (softplus) is convex.
Solution
and .
Is the loss of a 1-hidden-layer network convex in its weights? Hint: swap two hidden neurons.
Solution
No. Swapping two hidden neurons (and their outgoing weights) gives a different weight vector with the same loss. If are both minima, convexity would make their midpoint at least as good — but the midpoint averages the two neurons into identical ones, generally worse. Symmetric minima rule out convexity.