# Test Function Convexity

I'm trying to test if $f : \mathbb{R}^n\rightarrow \mathbb{R}$ given by :

$$f(x) = \ln \left(\sum\limits_{i=1}^n e^{x_i}\right)$$ is convex.

I tried computing positivity of the Hessian $H$ matrix by definition, multiplying by $a \in \mathbb{R}^n$. I got the expression

$$a^T H a = \displaystyle\sum_{i=1}^n a_i^2 e^{x_i} -(a_1 + ... + a_n)\frac{a_1 e^{x_1} + ... + a_n e^{x_n}}{e^{x_1} + ... + e^{x_n} }$$

Where $a_i$ is the $i$-th coordinate of $a$.

Is there a way to check if this expression is higher than zero? I can't see if an averages inequality would help.

## 1 Answer

Let $\lambda, \mu \in \langle 0,1\rangle$ be such that $\lambda + \mu = 1$ and $x = (x_1, \ldots, x_n), y= (y_1, \ldots, y_n) \in \mathbb{R}^n$. We wish to show that $$f(\lambda x + \mu y) \le \lambda f(x) + \mu f(y)$$

We shall use Hölder's inequality for conjugate exponents $\frac1{\lambda}$ and $\frac{1}\mu$. We have:

\begin{align} f(\lambda x + \mu y) &= \ln \sum_{i=1}^n e^{\lambda x_i + \mu y_i} \\ &= \ln \sum_{i=1}^n e^{\lambda x_i}e^{\mu y_i}\\ &\le \ln\, \left[\left(\sum_{i=1}^n e^{\lambda x_i\cdot \frac1\lambda}\right)^{\lambda}\left(\sum_{i=1}^n e^{\mu y_i\cdot \frac1\mu}\right)^{\mu}\right]\\ &= \lambda \ln \sum_{i=1}^n e^{x_i} + \mu \ln \sum_{i=1}^n e^{y_i}\\ &= \lambda f(x) + \mu f(y) \end{align}

Hence, $f$ is convex on $\mathbb{R}^2$.

• Awesome! Thank you so much! – Mateus Nov 16 '17 at 11:23