# Constrained nonlinear optimization

I am wondering what is the easiest/best way to find the values of $x_i$ that maximize the expression $\sum_{i=1}^N a_i \ln (x_i)$ under the constraints $\sum_{i=1}^Nx_i = 1$ and $0\leq x_i \leq 1$

Do I have to use Lagrange multipliers? Is there an easier way?

By using the Lagrange multiplier and setting the derivative of the Lagrangian $\sum_i a_i\ln x_i + \lambda(1-\sum_i x_i)$ to 0 I arrive at the following conclusion:

\begin{align} x_i=\frac{a_i}{\lambda} \forall i \in \{1, \ldots, N \} \end{align}

How would I proceed from that?

# Update: solution

By enforcing $\sum_i x_i = 1$ it follows that $\sum_i \frac{a_i}{\lambda} = 1$ which leads to $\lambda = \sum_i a_i$ and $x_i = \frac{a_i}{\sum_j a_j}$

• Lagrange multipliers is very easy for this question, so there probably isn't an easier way. Nov 24, 2015 at 14:30
• I am trying to solve it with the Lagrange multipliers but, being quite inexperienced, I am stuck. Nov 24, 2015 at 15:39
• Read your notes carefully, and try to apply them here. Nov 24, 2015 at 15:40
• I added my progress to the post. I will be very grateful if you respond with some contribution Nov 24, 2015 at 15:54
• Good. You are nearly there. You need to find $\lambda$, then you will know $x_i$. Try $\sum_{i=1}^Nx_i=1$ Nov 24, 2015 at 15:57

# Solution

By enforcing $\sum_i x_i = 1$ it follows that $\sum_i \frac{a_i}{\lambda} = 1$ which leads to $\lambda = \sum_i a_i$ and $x_i = \frac{a_i}{\sum_j a_j}$