Convex functions
Convexity requires the function at every mixture to lie at or below the corresponding weighted endpoint values.
On this page 8 sections
01Understand the idea#
A convex function lies below straight chords connecting points on its graph, over a convex domain. The condition makes averaging two inputs no worse than averaging their endpoint objective values. Convexity is useful because a local minimum of a convex objective on a convex domain is also global.
For a convex function, evaluating at a mixture gives no larger a value than mixing the endpoint values. The domain must also be convex.
This must hold for all domain points and 0≤θ≤1.
For f(x)=x², midpoint 2 between 0 and 4 has value 4. The endpoint-value average is 8, so this comparison satisfies 4≤8.
For between inputs 0 and 4, the midpoint input is 2 and its function value is 4. The midpoint of endpoint heights is . Thus the graph lies below that chord at the midpoint. This is one verified comparison, not a proof for all pairs of inputs.
f(z)=z² on all real z. x=1, y=5, θ=0.5. Give (f(θx+(1−θ)y), θf(x)+(1−θ)f(y)).
Show answer and explanation
Mixed input 3: left 9, chord 13.
02If function values are supplied, form the weighted chord directly#
If function values are supplied, form the weighted chord directly. Subtract the actual mixed-input value to see how much room the inequality has.
A nonnegative gap passes this comparison; a negative gap is a violation. Equality is allowed in ordinary convexity.
x,y are in a convex domain; θ=0.25. Given (f(x),f(y),f(θx+(1−θ)y))=(4, 12, 9). Find chord value minus mixed-input value.
Show answer and explanation
Chord 10 minus 9 gives 1.
03Convexity is an all-pairs, all-weights condition#
Convexity is an all-pairs, all-weights condition. One passing example cannot establish it over the whole domain.
One valid violation is enough to disprove it. A single low point in a plot is also insufficient evidence of the universal inequality.
On a convex domain, a valid mixture gives left side 6, chord 4. Assess convexity: f(mixture)≤chord.
Show answer and explanation
6>4 violates the rule.
04To disprove convexity, one valid chord violation is enough#
To disprove convexity, one valid chord violation is enough. To establish it, every allowed pair and mixture must satisfy the condition. Real training objectives need not be convex, so the useful local-to-global guarantee cannot be assumed just because an optimizer found a low point.
Compute both sides; one violation disproves convexity, while one passing comparison does not prove it.
- Check the convexity inequality for a supplied scalar example.
Sources & further reading
- [1]Boyd & Vandenberghe §3.1.1 ↗Boyd & Vandenberghe §3.1.1 · Article