A function f:Rn→R is convex if its domain D is a convex set, and:
(Zeroth-Order Condition) For all points x1,x2∈D and α∈[0,1], the graph of f lies below (or on) the line segment connecting f(x1) and f(x2), such that f(αx1+(1−α)x2)≤αf(x1)+(1−α)f(x2).
(First-Order Condition) If f is differentiable, it holds that for all x,y∈D, the tangent line (or tangent plane in higher dimensions) at any point x lies below the function everywhere else: f(y)≥f(x)+∇f(x)T(y−x).
(Second-Order Condition) If f is twice-differentiable, it holds that the Hessian of f for all x∈D is positive semi-definite (i.e., ∇2f(x)⪰0).
If −f is convex, then f is said to be concave. The following is a visual interpretation of the Zeroth-Order Condition for convexity:
\usepackage{pgfplots}\begin{document}\begin{tikzpicture} \begin{axis}[ xlabel={$x$}, xlabel style={align=left}, ylabel={$f(x)$}, ytick=0, xtick=0, domain=0:6, % choose a domain that avoids the asymptote at x=1 if desired samples=200, restrict y to domain=0:20, % only show y-values that are positive (and up to 20) unbounded coords=jump, % jump over undefined/infinite parts axis lines=center, clip mode=individual] % Plot the function's positive part using max(0, f(x)): \addplot[thick, clip=true] {max(0, x^2/3 + 1/(x-1))}; \draw[dashed, thick] (axis cs:5.41,0) -- (axis cs:5.41,10) node[at start, below]{$x_{2}$} node[right]{$f(x_{2})$}; \filldraw (axis cs:5.41,10) circle (2pt); \draw[dashed, thick] (axis cs:1.17,0) -- (axis cs:1.17,6.3) node[at start, below]{$x_{1}$} node[left]{$f(x_{1})$}; \filldraw (axis cs:1.17,6.3) circle (2pt); \draw (axis cs:1.17,6.3) -- (axis cs:5.41,10) node[midway, above, sloped]{$\alpha f(x_{1})+(1-\alpha)f(x_{2})$}; \draw[dotted, thick] (axis cs:3.5,0) -- (axis cs:3.5,8.335) node[at start, below]{$z=\alpha x_1+(1-\alpha)x_2$}; \filldraw (axis cs:3.5,4.48) circle (2pt) node[below right]{$f(z)$}; \filldraw (axis cs:3.5,8.335) circle (1pt); \end{axis}\end{tikzpicture}\end{document}
Furthermore, a function f:Rn→R is strongly convex if there exists some m, such that f~(x)=f(x)−2m∥x∥22
is convex. Note that strong convexity implies strict convexity,
Properties
(Envelope Representation) If f is convex and l.s.c., f(x)=a≤fsupa(x), where a is a collection of affine functions such that a(x)≤f(x) for all x∈X.
You can imagine all of f‘s tangents “enveloping” f: they only intersect one point of x, which, in terms of all tangent lines on f, constructs f. The largest value of any affine a on x will be the point where the affine tangent intersects f. We use the supremum instead of the maximum to keep the behavior well-defined for discontinuities.
Examples
Zeroth-Order Condition on Parametrized Functions
Consider a convex function f:Rn→R. Given two arbitrary points y,z∈Rn, we define the scalar function g:R→R as follows: g(t)=f(y+tz),∀t∈R.
The function g is the restriction of the function f to a line parametrized by a scalar t.
By analyzing the domain of g and using the zeroth-order convexity condition, show that the function g is convex.
To begin, we define dom(g)={t∣y+tz∈dom(f)}. For some α∈[0,1], we must show that the domain of g is convex, such that for any two ti, it follows that αt1+(1−α)t2∈dom(g). In terms of dom(f), this is equivalent to showing that
y+(αt1+(1−α)t2)z∈dom(f).
However, since y+(αt1+(1−α)t2)z=α(y+t1z)+(1−α)(y+t2z)∈dom(f), it follows that dom(g) is convex.
Now, we must show that g(αt1+(1−α)t2)≤αg(t1)+(1−α)g(t2),
equivalent to saying f(y+[αt1+(1−α)t2]z)≤αf(y+t1z)+(1−α)f(y+t2z),
where the LHS factorizes into f(y+[αt1+(1−α)t2]z)=f(α[y+t1z]+(1−α)[y+t2z]). To simplify further, take x1=y+t1z and x2=y+t2z, such that f(αx1+(1−α)x2)≤αf(x1)+(1−α)f(x2).
This fact is given by definition since f is convex, and therefore g is convex.
Zeroth-Order Condition on Composite Functions
Consider two functions f:Rn→R and h:R→R. Define the composite function g:Rn→R such that g(x)=h(f(x)). Assume that for every x in the domain of f, the point f(x) is in the domain of h, which implies that g(x) is defined for every x in the domain of f. Assume that all of the following conditions hold:
f and h are both convex, and may be non-differentiable
h is a non-decreasing function, meaning that h(y1)≤h(y2) for all y1,y2∈R such that y1≤y2
By using the zeroth-order convexity condition, show that g is convex.
Since f is convex, dom(f)is convex, and because g is defined wherever f is defined (as assumed), dom(g)=dom(f), hence convex. We must only show that for some x1,x2∈dom(g) and α∈[0,1], it follows that
g(\alpha x_{1}+(1-\alpha)x_{2})&=h(f(\alpha x_{1}+(1-\alpha)x_{2})) &(1) \\
& \leq h(\alpha f(x_{1})+(1-\alpha)f(x_{2})) &(2)\\
& \leq \alpha h(f(x_{1})) + (1-\alpha)h(f(x_{2})) &(3) \\
&= \alpha g(x_{1}) + (1-\alpha)g(x_{2}),
\end{align}$$
where the RHS transition from $(1)$ to $(2)$ is both due to $h$ being non-decreasing and $f$ being convex, whereas the transition from $(2)$ to $(3)$ is due to $h$ being convex.
Second-Order Condition
Consider the function f:R2→R, defined as f(x)=sin(x1+x2)+cos(x1−x2)+λ(x12+x22),
where λ is some constant