How do you take the first and second derivative of a summation with two variables?

548 Views Asked by At

I want to prove that $log(\sum_{i=1}^{n}{e^{x_i}})$ is convex. To do that I would need to find its gradient and Hessian, but I'm not sure how to take derivatives of summations with two variables.

EDIT: I was mistaken and there is only one variable $x$. I believe the first derivative would thus be, $\frac{d}{dx}$ $log(\sum_{i=1}^{n}{e^{x_i}})$ = $\frac{1}{\sum_{i=1}^{n}{e^{x_i}}}$. Is this correct? Also, from there, how would I take the derivative of a summation of one variable to get the second derivative?

1

There are 1 best solutions below

12
On BEST ANSWER

Note that $$\frac{\partial}{\partial x_k} \log \left(\sum_{i=1}^{n} e^{x_i}\right)=\frac{1}{\sum_{i=1}^{n} e^{x_i}}\cdot \frac{\partial}{\partial x_k}\left(\sum_{i=1}^{n} e^{x_i}\right) = \frac{e^{x_k}}{\sum_{i=1}^{n} e^{x_i}}.$$ Consequently, $$\frac{\partial^2}{\partial x_k^2}\log \left(\sum_{i=1}^{n} e^{x_i}\right)=\frac{e^{x_k}\left(\sum_{i=1}^{n} e^{x_i}-e^{x_k}\right)}{\left(\sum_{i=1}^{n} e^{x_i}\right)^2},$$ and $$\frac{\partial^2}{\partial x_k \partial x_j}\log \left(\sum_{i=1}^{n} e^{x_i}\right)=-\frac{e^{x_k}e^{x_j}}{\left(\sum_{i=1}^{n} e^{x_i}\right)^2},$$ where $j \neq k$, and $1 \le j,k \le n$.