[Math] Find max/min values of the sum of squares

optimization

How to find max/min values for the sum of squares:

$n_1^2 + n_2^2 + … + n_i^2$

where

$n_1 + n_2 + … + n_i = c$

Is it true that max value is always obtained when $n_1 = n_2 = … = n_i$?

Best Answer

Let $$f(x_1,\cdots, x_n)=x_1^2+x_2^2+\cdots+x_n^2$$ $$g(x_1,\cdots, x_n)=x_1+x_2+\cdots +x_n-c=0$$ Using Lagrange multiplier (also see here)

$$2x_1=2x_2+2x_3=\cdots=2x_n$$ This implies that minima will always occur at $$x_1=x_2=x_3=\cdots=x_n=\frac cn$$

$$f_{min}=\frac{c^2}{n}$$

Related Question