Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given $n$ positive values. $x_i \ge 1 (1\le x_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$.

share|cite|improve this question
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.