For values $\mathbf{a}=(a_1, a_2, ..., a_N)$ with corresponding weights $\mathbf{w}=(w_1, w_2, ..., w_N)$ (assume $\sum_{i=1}^{N} w_i = 1$ and $0 \le w_j \le 1$ for $j \in {\{1,2,...,N\}}$), the weighted average is
$$ \bar{a} = \sum_{i=1}^{N} w_i a_i $$
How can I solve for the weights $\mathbf{w}$ that maximize $\bar{a}$ using the method of Lagrange multipliers?
It is obvious that the solution will give a value 1 to the weight that corresponds to the largest value in $\mathbf{a}$, and 0 for the remaining weights, e.g. $\mathbf{a}=(1,2,3)$ will give $\mathbf{w}=(0,0,1)$ and $\bar{a}=3$. However, I am somehow not able to show this using Lagrange Multipliers.
What I have tried is to solve the following set of equations ($j \in {\{1,2,...,N\}}$) $$ \dfrac{\partial \bar{a}}{\partial w_j} = \lambda \dfrac{\partial g}{\partial w_j} $$ with the constraint equation
$$ g = \sum_{i=1}^{N} w_i = 1 $$
I then calculate $\dfrac{\partial \bar{a}}{\partial w_j} = a_j$ and $\dfrac{\partial g}{\partial w_j} = 1$, and thus get $a_j = \lambda$ for all $j$ which is obviously not always true, and moreover the equations are independent of $w_j$'s to solve for.
It seems like a straightforward problem. How is this done correctly?
Both the function You want to optimize and the constraint are $N$ dimensional plane and their normal vectors do not necessarily coincide. This lead to one of the followings: