Post · 1 min read· p. 99

Convexity counterexample

Here's a fun counterexample: a function Rn→R\mathbb{R}^n \to \mathbb{R} that is jointly convex in any n−1n-1 of the variables, but not in all variables at once. The function is

f(x1,…,xn)=12(n−1.5)∑i=1nxi2−∑i<jxixjf(x_1,\ldots,x_n) = \frac{1}{2}(n-1.5)\sum_{i=1}^n x_i^2 - \sum_{i < j} x_ix_j

To see why this is, note that the Hessian of ff is equal to

[n−1.5−1⋯−1 −1n−1.5⋯−1 ⋮⋮⋱⋮ −1−1⋯n−1.5]\left[ \begin{array}{cccc} n-1.5 & -1 & \cdots & -1 \ -1 & n-1.5 & \cdots & -1 \ \vdots & \vdots & \ddots & \vdots \ -1 & -1 & \cdots & n-1.5 \end{array} \right]

This matrix is equal to (n−0.5)I−J(n-0.5)I - J, where II is the identity matrix and JJ is the all-ones matrix, which is rank 1 and whose single non-zero eigenvalue is nn. Therefore, this matrix has n−1n-1 eigenvalues of n−0.5n-0.5, as well as a single eigenvalue of −0.5-0.5, and hence is not positive definite.

On the other hand, any submatrix of size n−1n-1 is of the form (n−0.5)I−J(n-0.5)I-J, but where now JJ is only (n−1)×(n−1)(n-1) \times (n-1). This matrix now has n−2n-2 eigenvalues of n−0.5n-0.5, together with a single eigenvalue of $0.5$, and hence is positive definite. Therefore, the Hessian is positive definite when restricted to any n−1n-1 variables, and hence ff is convex in any n−1n-1 variables, but not in all nn variables jointly.