[Math] Convexity of difference of log-sum-exp: $f(x_1, x_2, x_3, x_4) = \log(e^{x_1} + e^{x_2}) – \log(e^{x_1} + e^{x_2} + e^{x_3} + e^{x_4})$

convex-analysislogarithms

I would like to know whether the following function $f: \mathbf{R}^4 \to \mathbf{R}$ is concave or not:

$$
f(x_1, x_2, x_3, x_4) = \log(e^{x_1} + e^{x_2}) – \log(e^{x_1} + e^{x_2} + e^{x_3} + e^{x_4})
$$

I tried to check whether the Hessian was negative semi-definite, but did not get anywhere. The Hessian can be written as

$$
\nabla^2 f(x) =
\frac{1}{\tilde{Z}^2}(\tilde{Z} \cdot \text{diag}(\tilde{\mathbf{z}}) – \tilde{\mathbf{z}}\tilde{\mathbf{z}}^\intercal)

\frac{1}{Z^2}(Z \cdot \text{diag}(\mathbf{z}) – \mathbf{z} \mathbf{z}^\intercal),
$$

where
$$
\tilde{\mathbf{z}} = \begin{bmatrix} e^{x_1} & e^{x_2} & 0 & 0 \end{bmatrix}^\intercal \\
\mathbf{z} = \begin{bmatrix} e^{x_1} & e^{x_2} & e^{x_3} & e^{x_4} \end{bmatrix}^\intercal \\
\tilde{Z} = e^{x_1} + e^{x_2} \\
Z = e^{x_1} + e^{x_2} + e^{x_3} + e^{x_4}
$$
but I did not get much further than that. Any help would be greatly appreciated!

This question discusses in detail the convexity of the log-sum-exp function, but does not apply to my case (difference of fcts).

Best Answer

(This answer builds up on the first comment to the question above).

Short answer: no, the function is not concave.

Instead of analyzing the full $4 \times 4$ hessian, we can start by restricting our attention to a subspace of the input, e.g., the line induced by setting $x_2 = x_3 = x_4 = 0$. Along this line, the original function can be rewritten as a univariate function $\tilde{f}(x) = \log(e^x + 1) - \log(e^x + 3)$.

the second derivative of $\tilde{f}$ is $$ \frac{d^2\tilde{f}}{dx^2} = \frac{e^x(6 - 2 e^{2x})}{(e^x + 1)^2 (e^x + 3)^2} $$ it is easy to see that the second derivative is positive for $x = 0$, hence $\tilde{f}$ is not concave (furthemore, it is negative for $x = 1$, so it is not convex either). We conclude that $f$ is not concave.

Note that the type of functions described here (difference of log-sum-exps) appears in the log-likelihood function of certain statistical models of paired comparisons, such as Elimination by Aspects and team comparisons.