# Is my use of Lagrange multipliers correct?

Given $n$ positive values. $x_i \ge 1 (1\le i \le n)$. Their sum is $k$. $$\sum_{i=1}^{n}x_i = k$$ Define the following value: $$\sum_{i=1}^{n}x_i(x_i-1)$$

Now use Lagrange multipliers to find when this value is minimum.

Define $J = \sum_{i=1}^{n}x_i(x_i-1) + \lambda ((\sum_{i=1}^{n}x_i)-k)$. Then $\frac{\partial J}{\partial x_i}=0$ implies that $x_{i} = -\frac{(\lambda-1)}{2}$. Substituting this back into the constraint give $-\frac{\lambda -1}{2} = k/n$. Thus we have $x_i=k/n$.

• Note that minimizing $\sum_{i=1}^{n}x_i(x_i-1) = \sum_{i=1}^{n}x_i^2 - \sum_{i=1}^{n}x_i = \sum_{i=1}^{n}x_i^2 - k$ is equivalent to minimizing $\sum_{i=1}^{n}x_i^2$, so obviously the answer will be the same as the answer to your earlier question. – TMM Sep 24 '11 at 15:55
• No (number-theory) here. Cancelled the tag. – Did Sep 24 '11 at 16:38
• Thijs, thanks again. – Jingguo Yao Sep 25 '11 at 14:39
• Yes, your usage of the Lagrange multipliers rule is correct. – Dominique Oct 27 '11 at 19:39