Convex Functions
Definition
A function \(f: \mathbb{R}^n \rightarrow \mathbb{R}\) is convex if:
Geometrically, this inequality means that the line segment between \(\mathbf{x}, f(\mathbf{x})\) and \(\mathbf{y}, f(\mathbf{y})\), which is the chord from \(\mathbf{x}\) to \(\mathbf{y}\), lies above the graph of \(f\).
A function \(f\) is concave if \(-f\) is convex, i.e., the inequality is reversed. A linear function is both convex and concave.
Examples
Example Convex Functions
- Affine: \(ax + b\), \(x \in \mathbb{R}\), \(\forall a, b \in R\).
- Affine: \(\mathbf{a}^T \mathbf{x} + \mathbf{b}\), \(\mathbf{x} \in \mathbb{R}^n\)
- Exponential: \(e^{ax}\), \(\forall a \in \mathbb{R}\).
- Powers: \(x^\alpha\), \(x \in \mathbb{R}_{++}\), for \(\alpha \geq 1\) or \(\alpha \leq 0\)
- Powers of absolute value: \(|x|^p\), \(x \in \mathbb{R}\), for \(p \geq 1\)
- Negative entropy: \(x\log x\), \(x \in \mathbb{R}_{++}\)
- Norms: \(||\mathbf{x}||_p = \left( \sum^n_{i = 1} |\mathbf{x}_i|^p \right)^{1/p}\), \(\mathbf{x} \in \mathbb{R}^n\), for \(p \geq 1\); \(||\mathbf{x}||_\infty = \max_k |\mathbf{x}_k|\)
Examples of Concave Functions
- Affine: \(ax + b\), \(x \in \mathbb{R}\), \(\forall a, b \in R\).
- Powers: \(x^\alpha\), \(x \in \mathbb{R}_{++}\), for \(0 \leq \alpha \leq 1\)
- Logarithm: \(\log x\), \(x \in \mathbb{R}_{++}\)
Restriction of a Convex Function to a Line
A function \(f: \mathbb{R}^n \rightarrow \mathbb{R}\) is convex if and only if the function \(g: \mathbb{R} \rightarrow \mathbb{R}\):
is convex for any \(\mathbf{x} \in \textbf{dom}f\), \(\mathbf{v} \in \mathbb{R}^n\).
Conditions for Convexity
First-Order Condition
A differentiable function \(f: \mathbb{R}^n \rightarrow \mathbb{R}\) is convex if and only if:
that is, the first-order Taylor approximation is a global under-estimator.
Second-Order Condition
A twice differentiable univariate function \(\mathbb{R} \rightarrow \mathbb{R}\) is convex if \(f''(x) \geq 0\) for \(\forall x \in \mathbb{R}\), i.e., the slopes (or gradients) of \(f\) are non-decreasing.
Twice differentiable function \(f: \mathbb{R}^n \rightarrow \mathbb{R}\) is convex if and only if its Hessian matrix \(\nabla^2 f(\mathbf{x})\) is positive semidefinite for \(\forall \mathbf{x} \in \mathbb{R}^n\).
A \(n \times n\) matrix \(A\) is positive semidefinite if \(\mathbf{x}^T A \mathbf{x} \geq 0\) for \(\forall \mathbf{x} \in \mathbb{R}^n\). Equivalently, \(A\) is positive semidefinite if all its eigenvalues are nonnegative.
Example
Consider a quadratic function:
where \(\mathbf{P} \in \mathbb{S}^N_{+}\). The first and second-order derivatives will be:
Hence, convex. Note that these conditions are sufficient and not necessary.
Establishing Convexity and Operations Preserving Convexity
A practical methods for establishing convexity of function is as follows:
- Verify convexity definition (often simplified by restricting to a line)
- For a twice differentiable functions, show \(\nabla^2 f(\mathbf{x}) \geq 0\)
-
Show that \(f\) is obtained from simple convex functions by operations that preserve convexity:
- Nonnegative weighted sum of convex functions is convex, i.e., if \(f_i\) is convex and \(\alpha_x \geq 0\) for \(\forall i = 1, \dots, m\), then \(g(\mathbf{x}) = \sum^m_{i = 1} \alpha_i f_i(\mathbf{x})\) is convex.
- Composition with affine function
- Maximum of convex functions is convex, i.e., if \(f_i\) is convex for \(\forall i = 1, \dots, m\), then \(g(\mathbf{x}) = \text{max}_i \left\{ f_i(\mathbf{x}) \right\}\) is convex.
- Composition: Let \(f: \mathbb{R}^m \rightarrow \mathbb{R}\) be a convex function, and \(g_i: \mathbb{R}^n \rightarrow \mathbb{R}\) be convex for \(\forall i = 1, \dots, m\). Then the composition function \(h(\mathbf{x}) = f(g_1(\mathbf{x}), g_2(\mathbf{x}), \dots, g_m(\mathbf{x}))\) is convex if either \(f\) is nondecreasing or if each \(g_i\) is a linear function.
- Minimization
- Perspective
For example, consider the function \(f(\mathbf{x}) = \exp \left( \sum^m_{i = 1} |a^T_i \mathbf{x} - b_i| \right)\).
- Let \(g_i(\mathbf{x}) = |a^T_i \mathbf{x} - b_i|\). It is obtained by the composition of the convex function \(|\cdot|\) and the linear function \(a^T_i \mathbf{x} - b_i\). Hence, \(g_i\) is convex.
- The function \(h(\mathbf{x}) = \sum^m_{i = 1} g_i (\mathbf{x})\) is a sum of convex functions. Hence, \(h\) is convex.
- \(f\) is obtained by taking composition of the function \(m(a) = \exp(a)\) with \(h\), i.e., \(f(\mathbf{x}) = m(h(\mathbf{x}))\). Since \(m\) is nondecreasing and h is convex, \(f\) is convex.
Convex Set and Convex Functions Relationship
Epigraph
The epigraph of a function \(f: \mathbb{R}^n \rightarrow \mathbb{R}\) is a set defined as:
"Epi" means "above", so epigraph means "above the graph".
The link between convex sets and convex functions is via the epigraph: A function is convex if and only if its epigraph is convex set.
Sublevel Sets
Given scalar \(\alpha\), the \(\alpha\)-level set of a function \(f: \mathbb{R}^n \rightarrow \mathbb{R}\) is a set defined as:
The epigraph and the \(\alpha\)-level set (\(\forall \alpha \in R\)) of a convex function are convex sets.