Let C⊆Rn be a set. C is a convex set if and only if the line segment between any two of its points lies in C.
tx+(1−t)y∈C∀x,y∈C,t∈[0,1]
Let x1,…,xk∈Rn and λ1,…,λk≥0 with ∑i=1kλi=1. The vector ∑i=1kλixi is a convex combination of x1,…,xk. A set is convex if and only if it contains every convex combination of its points. The convex hull conv(X) of a set X⊆Rn is the set of all convex combinations of points of X, which is the smallest convex set containing X.
The following sets are convex: Rn; the hyperplane {x:a⊺x=b} and half-space {x:a⊺x≤b} for a∈Rn∖{0} and b∈R; the ball {x:∥x−x0∥≤r}; and any intersection of convex sets. A polyhedron is an intersection of finitely many half-spaces and hyperplanes and is therefore convex.
Let C⊆Rn be a convex set and f:C→R be a function. f is a convex function if and only if the line segment between any two points on its graph lies on or above the graph.
f(tx+(1−t)y)≤tf(x)+(1−t)f(y)∀x,y∈C,t∈[0,1]
f is strictly convex if and only if the inequality is strict for all x=y and t∈(0,1). f is concave if and only if −f is convex, and strictly concave if and only if −f is strictly convex. Let μ>0. f is strongly convex with parameter μ if and only if f(x)−2μ∥x∥2 is convex, which is equivalent to
f(tx+(1−t)y)≤tf(x)+(1−t)f(y)−2μt(1−t)∥x−y∥2∀x,y∈C,t∈[0,1].
Strong convexity implies strict convexity, which implies convexity, and neither implication reverses: f(x)=x4 is strictly but not strongly convex on R. An affine function f(x)=a⊺x+b is both convex and concave, and these are the only functions that are both. Every norm is convex, as are x2, ∣x∣, ex on R and −logex on (0,∞).
The epigraph of f is the set of points on or above its graph.
epif:={(x,s)∈C×R:s≥f(x)}
f is convex if and only if epif is a convex subset of Rn+1. Let α∈R. The sublevel set of f at level α is
{x∈C:f(x)≤α}.
Every sublevel set of a convex function is convex. The converse is false, and a function all of whose sublevel sets are convex is quasi-convex.
Jensen’s inequality states that if f is convex, x1,…,xk∈C and λ1,…,λk≥0 with ∑i=1kλi=1 then the value of f at a convex combination is at most the convex combination of the values of f.
f(i=1∑kλixi)≤i=1∑kλif(xi)
The inequality reverses for concave functions, and extends from finite weighted averages to expectations of random variables.
Let C⊆Rn be an open convex set and f:C→R be differentiable. The first-order condition states that f is convex if and only if its graph lies on or above every one of its tangent planes.
f(y)≥f(x)+∇f(x)⊺(y−x)∀x,y∈C
f is strictly convex if and only if the inequality is strict for all y=x, and strongly convex with parameter μ if and only if
f(y)≥f(x)+∇f(x)⊺(y−x)+2μ∥y−x∥2∀x,y∈C.
Let f∈C2(C). The second-order condition states that f is convex if and only if its Hessian matrix is positive semi-definite at every point of C, and strongly convex with parameter μ if and only if every eigenvalue of its Hessian matrix is at least μ at every point of C.
v⊺Hf(x)v≥0∀x∈C,v∈Rn
If the Hessian matrix is positive definite at every point of C then f is strictly convex, but the converse is false since f(x)=x4 has f′′(0)=0. For n=1 the condition is f′′(x)≥0∀x∈C. The quadratic function f(x)=21x⊺Ax+b⊺x+c with A symmetric has Hf=A and is convex if and only if A is positive semi-definite and strongly convex if and only if A is positive definite, with μ equal to the smallest eigenvalue of A.
Convexity is preserved by the following operations, which allow the convexity of a function to be established from simpler functions:
- the non-negative weighted sum ∑i=1kwifi with wi≥0 of convex functions fi is convex;
- the composition f(Ax+b) of a convex function f with an affine function is convex;
- the pointwise maximum max{f1(x),…,fk(x)} of convex functions is convex, as is the pointwise supremum of any family of convex functions;
- the composition g(h(x)) is convex if h is convex and g is convex and monotonically increasing, or h is concave and g is convex and monotonically decreasing;
- f is convex if and only if its restriction to every line t↦f(x+tv) is convex on the interval where it is defined, which reduces convexity to the univariate case.
Let C⊆Rn be a convex set and f:C→R be convex. A point x∗∈C is a local minimiser of f on C if and only if there exists δ>0 with f(x∗)≤f(x) for all x∈C with ∥x−x∗∥<δ, and a global minimiser if and only if f(x∗)≤f(x)∀x∈C. Convexity has the following implications for minimisation:
- every local minimiser of f on C is a global minimiser;
- the set of global minimisers is a convex set, since it is a sublevel set;
- if f is strictly convex then it has at most one global minimiser;
- if f is strongly convex and continuous and C is non-empty and closed then f has exactly one global minimiser;
- if f is differentiable on an open convex set C then x∗ is a global minimiser if and only if ∇f(x∗)=0, so every stationary point is a global minimiser;
- if f is differentiable on a convex set C that need not be open then x∗ is a global minimiser if and only if no direction into C is a direction of descent.
∇f(x∗)⊺(x−x∗)≥0∀x∈C
A convex function on an open convex set is continuous. Maximisation of a convex function has none of these properties, but maximising a concave function is equivalent to minimising the convex function −f. Minimising a convex function over a convex set is a convex optimisation problem, and the implications above are why such problems can be solved reliably.