3
$\begingroup$

Define the function:

$$f(a_1, a_2, · · · , a_n) = \ln (e^{a_1} + e^{a_2} + \cdots + e^{a_n} ).$$

I want to prove that $f$ is convex. Now, to show that is a function is convex, we can take second derivative of the function and if it is greater than zero then the function is convex. But here second derivative would be negative, if I am not wrong. Alternatively, $f$ is convex if and only if the Hessian matrix $Hf(x)$ is positive semi-definite for all $x \in \mathbb{R}$. How do I do the proof?

$\endgroup$
7
  • $\begingroup$ Not all second derivatives are negative. Note that matrices with negative values (off the diagonal) can be positive-semidefinite. Why not work out the derivatives in the case $n=2$ and maybe the case $n=3$ to see what is going on? $\endgroup$
    – whuber
    Commented May 22, 2019 at 19:39
  • $\begingroup$ if we calculate hesian matrix, it would be a symmetric matrix with all diagonal value -ve, would it be positive semidefinite? $\endgroup$ Commented May 22, 2019 at 19:41
  • $\begingroup$ You must be miscalculating: all diagonal elements are positive. $\endgroup$
    – whuber
    Commented May 22, 2019 at 19:44
  • 1
    $\begingroup$ okay, I was calculating first derivative, once we calculate second derivative all values will be positive, thanks. $\endgroup$ Commented May 22, 2019 at 19:45
  • $\begingroup$ How do we prove then that the matrix is semi-definite? $\endgroup$ Commented May 22, 2019 at 19:46

1 Answer 1

9
$\begingroup$

The function you are looking at is the LogSumExp function:

$$f(\mathbf{a}) = \ln \Big( \sum_{i=1}^n \exp(a_i) \Big) \quad \quad \quad \text{for all } \mathbf{a} \in \mathbb{R}^n.$$

Its gradient vector and Hessian matrix are given respectively by:

$$\begin{equation} \begin{aligned} \nabla f(\mathbf{a}) &= \frac{1}{\sum_{i=1}^n \exp(a_i)} (\exp(a_1),...,\exp(a_n)), \\[12pt] \nabla^2 f(\mathbf{a}) &= \text{diag}(\nabla f(\mathbf{a})) - \nabla f(\mathbf{a}) \nabla f(\mathbf{a})^\text{T}. \\[6pt] \end{aligned} \end{equation}$$

(Here we have written the Hessian matrix in terms of the gradient vector. This is useful for the next step.) For any $\mathbf{z} \in \mathbb{R}^n$ we have the quadratic form:

$$\begin{equation} \begin{aligned} \mathbf{z}^\text{T} (\nabla^2 f(\mathbf{a})) \mathbf{z} &= \mathbf{z}^\text{T} \Big[ \text{diag}(\nabla f(\mathbf{a})) - \nabla f(\mathbf{a}) \nabla f(\mathbf{a})^\text{T} \Big] \mathbf{z} \\[6pt] &= \mathbf{z}^\text{T} \text{diag}(\nabla f(\mathbf{a})) \mathbf{z} - \mathbf{z}^\text{T} \nabla f(\mathbf{a}) \nabla f(\mathbf{a})^\text{T} \mathbf{z} \\[6pt] &= \mathbf{z}^\text{T} \text{diag}(\nabla f(\mathbf{a})) \mathbf{z} - (\nabla f(\mathbf{a}) \cdot \mathbf{z})^\text{T} (\nabla f(\mathbf{a}) \cdot \mathbf{z}) \\[6pt] &= \mathbf{z}^\text{T} \text{diag}(\nabla f(\mathbf{a})) \mathbf{z} - || \nabla f(\mathbf{a}) \cdot \mathbf{z} ||^2 \\[6pt] &= \sum_{i=1}^n \bigg( \frac{\exp(a_i)}{\sum_{i=1}^n \exp(a_i)} \bigg) z_i^2 - \sum_{i=1}^n \bigg( \frac{\exp(a_i)}{\sum_{i=1}^n \exp(a_i)} \bigg)^2 z_i^2 \\[6pt] &= \frac{1}{\sum_{i=1}^n \exp(a_i)} \sum_{i=1}^n \exp(a_i) z_i^2 \Bigg[ 1 - \frac{\exp(a_i)}{\sum_{i=1}^n \exp(a_i)} \Bigg] \\[6pt] &= \frac{\sum_{i=1}^n \sum_{j \neq i} \exp(a_i) \exp(a_j) z_i^2}{(\sum_{i=1}^n \exp(a_i))^2} \geqslant 0. \\[6pt] \end{aligned} \end{equation}$$

This establishes that the Hessian matrix is non-negative definite, which means that the LogSumExp function is (weakly) convex.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.