# 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.

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:
Hence, $f$ is convex on $\mathbb{R}^2$.