# Maximise $\log\left(1+\sum_i a_i x_i\right) + \sum_i \log x_i$ subject to $\sum_i x_i = 1$

I would like to Maximise the function $\log\left(1+\sum_i a_i x_i\right) + \sum_i \log x_i$ subject to the constraint $\sum_i x_i = 1$, where $a_i > 0$ and $x_i>0$. My first hunch was to define the Lagrangian $$L = \log(1+\sum_i a_i x_i) + \sum_i \log x_i + \lambda(\sum_i x_i - 1).$$ Taking the derivative and setting to zero gives $$\frac{\partial L}{\partial x_i} = \frac{a_i}{1+\sum_j a_j x_j}+\frac{1}{x_i}+\lambda=0.$$ Multiplying through by the product of the denominators, we find $$0 = a_i x_i+1+\sum_j a_j x_j + \lambda x_i\left(\sum_j a_j x_j\right).$$ But now I am a bit stuck because the expression couples different $x_i$ and $x_j$. Any idea how to make progress with this?

Let $S=\sum_{j} a_j x_j$. Starting from $$\frac{a_i}{1+S} + \frac{1}{x_i}+\lambda=0,$$ one gets $$a_ix_i + (1+S)(1 +\lambda x_i)=0.$$ Summating on $i$ yields $$S + (1+S)(n+\lambda)=0,$$ i.e. $$S=-\frac{n+\lambda}{1+n+\lambda},$$ where $n$ is the number of variables. Now starting again from the beginning we get $$x_i(a_i + \lambda(1+S))+1+S=0,$$ so $$x_i=-\frac{1+S}{a_i+\lambda(1+S)},$$ and summating on $i$ gives you a condition on $\lambda$ : $$1=-\sum_i \frac{1}{\lambda+(1+n+\lambda)a_i}.$$ Such a $\lambda$ exists and is unique in the interval $(-(n+1),-n)$. Though i do not know if there is a nice way to express $\lambda$ as a function of the parameters $a_i$. Then plug in $\lambda$ in the expressions to find $S$ and $x_i$. I hope this is correct.