
For a convex function on a convex domain, every local minimum is also a global minimum. Before using this property, we must check convexity in the variables and domain of the problem. This series begins with that check, then examines how constraints affect the conditions for an optimum.
We begin with the defining inequality. We then give two ways to verify it: use derivatives to check curvature, or combine functions through operations that preserve convexity. These operations are often called closure properties.
The series covers:
- How to determine if a function is convex.
- Properties and operations that preserve convexity.
- Standard forms of convex optimization problems.
- The Karush-Kuhn-Tucker (KKT) conditions: what they are and when they apply.
- Mathematical derivations, with an SVM-like example and various convex loss functions.
- A broad survey of commonly used convex functions in optimization.
Series Division:
- Part 1: Fundamentals, Convexity Criteria, and Examples.
- Part 2: Duality, KKT Conditions, and Advanced Applications.
- Part 3: Convex Loss Functions.
1. Identifying Convex Functions
A function is convex if and only if, for all and all ,
For a function defined on a smaller domain, the domain must itself be convex, and the inequality is required for points in that domain. The derivative tests below apply on an open convex domain. These definitions and tests follow Boyd and Vandenberghe's convex-functions notes.
1.1 First-Order and Second-Order Criteria
-
First-Order Test (if is differentiable):
This criterion says that the function lies above each of its first-order approximations. At a fixed point , define the affine approximation . Convexity requires throughout the domain; equality holds at .
-
Second-Order Test (if is twice differentiable):
That is, the Hessian is positive semidefinite at every point .
A real symmetric matrix is positive semidefinite (PSD) if the quadratic form is nonnegative for every vector .
How to check:
- Eigenvalue Method: Compute the eigenvalues of . If all eigenvalues are nonnegative, is PSD.
- Principal Minors: For a symmetric matrix, PSD is equivalent to every principal minor being nonnegative. A principal submatrix uses the same index set for its rows and columns. Checking only the leading, top-left submatrices is not sufficient for PSD.
The quadratic form tests the matrix along a chosen direction. Positive semidefiniteness requires a nonnegative value in every direction.
Below are some important examples demonstrating these criteria in action—some are convex, one is not.
1.2 Preserving Convexity
Derivative tests are useful when the derivatives are simple to compute. For functions assembled from simpler pieces, the following closure properties provide another route:
-
Nonnegative Weighted Sum: If are convex and , then is convex.
-
Affine Transformation: If is convex, then is convex for any matrix and vector .
-
Pointwise Maximum: If are convex, then is convex.
-
Composition with a Nondecreasing Convex Function: If is convex and nondecreasing in each argument, and every component of is convex on a common convex domain, then is convex. For restricted domains, the composition must also satisfy the relevant domain conditions.
2. Examples
2.1 Quadratic Function
Consider the univariate quadratic
or the multivariate version
where is symmetric and (positive semidefinite).
Step-by-step check:
- Gradient (multivariate):
- Hessian (multivariate):
- Because we have Hence, is positive semidefinite for all implying convexity.
Interpretation: A PSD coefficient matrix gives nonnegative curvature in every direction. Zero curvature in some directions is allowed, so convexity here does not imply a unique minimizer.
2.2 Log-Sum-Exp
Define
Step-by-step check (Hessian test):
-
Gradient of :
If we let , thenSo the gradient is
-
Hessian of :
For ,where and is if and otherwise.
The matrix form of the Hessian is
where is the column vector of exponentials. To see why this matrix is positive semidefinite, write . For any vector , its quadratic form is
the variance . Here and are fixed; only the auxiliary index is random. Its probabilities are the displayed softmax weights, so nonnegativity follows from the definition of variance.
Thus, , so is convex.
Interpretation: Log-sum-exp gives a smooth alternative to . Its convexity follows from the nonnegative variance just derived, not merely from approximating a convex function.
It is convex but not strictly convex on all of : adding the same constant to every coordinate gives , an affine direction.
2.3 Euclidean Norm ()
Consider
Step-by-step check (first-order or second-order approach):
-
Second-Order tests do not apply at because the norm is not differentiable there. We therefore use the more general fact that norms are convex.
- Geometric argument: The unit ball of is a disk or ball, which is convex. The norm measures how much we must scale this unit ball to include a point. This scaling function, called its Minkowski functional, is convex because the unit ball is convex and symmetric.
-
Subgradient at :
whereas a subgradient approach is needed at .
Thus, the Euclidean norm is convex.
General fact: is convex for all .
2.4 Non-Convex Example:
Consider (univariate, for simplicity).
Step-by-step check:
- First derivative:
- Second derivative:
Global convexity would require for all . However, changes sign. In particular, for , so is concave on that interval. At , we have , but the value at a single point does not establish convexity. Therefore, is not convex over .
Interpretation: oscillates, so it curves up and down infinitely often, violating any global convexity requirement.
Notes
- Quadratic + PSD → Convex.
- Log-sum-exp: Convex, but not strictly convex on its full domain.
- ℓ₂-norm: Convex (more generally, ℓₚ-norms for are convex).
- : Not convex, since its second derivative changes sign.
General thinking process when Verifying Convexity:
-
Definition Check: Confirm that for any two points and in the domain and any ,
This is the fundamental property of convex functions.
-
First-Order Condition: For differentiable functions, verify that the function always lies above its tangent lines. In other words, check that
holds for all and .
-
Second-Order Condition: For twice differentiable functions, check that the Hessian matrix is positive semidefinite everywhere in the domain. This guarantees that the curvature is non-negative throughout (and watch for points of non-differentiability).
-
Composition Rules: Many functions are built from simpler components. Convexity is preserved under operations such as:
-
Sum: If and are convex, then
is convex.
-
Scaling: If is convex and is a scalar, then
is convex.
-
Affine Transformation: If is convex and is an affine mapping, then
is convex.
-
Nondecreasing/Nonincreasing Composition:
If is convex and nondecreasing and is convex, thenis convex.
Similarly, if is convex and nonincreasing and is concave, then is convex. -
Pointwise Maximum: The pointwise maximum of convex functions is also convex. If are convex for , then
is convex.
-
Perspective Function: Given a convex function , its perspective
is convex on . This is particularly useful for scaling or normalization.
-
Elementwise Composition: A convex outer function alone does not guarantee a convex composition. For example, is convex if each component of is convex and nonnegative: the Euclidean norm is convex and coordinatewise nondecreasing on the nonnegative orthant.
-
-
Reformulation: If the convexity of the original function is not immediately clear, try to reformulate it as a combination of simpler convex components. This can often reveal the hidden structure.
-
Convex Relaxation: Replacing a nonconvex problem by a convex relaxation changes the problem. It can provide a bound or a tractable approximation, but it does not establish convexity of the original problem or automatically preserve its optimizer.
-
Additional Tools: Numerical checks can expose counterexamples or suggest an argument, but checking finitely many points does not prove global convexity. Symbolic calculations can support a proof when their domain and assumptions are explicit.
Use the expression and domain to choose the proof. Derivative tests require differentiability throughout the domain; closure properties can also cover corners such as the origin of a norm. A numerical check can suggest a counterexample, but cannot replace either argument.
These examples establish the tools used in the rest of the series. Part 2: Duality, KKT Conditions, and Advanced Applications uses them to study constrained problems, while Part 3: Convex Loss Functions collects common functions and their derivatives.
References & Further Reading
- Boyd, S., & Vandenberghe, L. (2004). Convex Optimization. Cambridge University Press.
- Hastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning.
- Schölkopf, B., & Smola, A. (2001). Learning with Kernels. MIT Press.
