What's the minimum value of this function? I am considering these functions: For $i=1,\ldots,n$, define
$$f_i(\lambda_1,\dots,\lambda_n)=\frac{1}{(n-2)^2}\sum_{k,l\neq i}(\lambda_k-\lambda_l)^2-\frac{2n}{n-2}\sum_{k=1}^n\lambda_k^2.$$
Suppose that $$\lambda_1+\cdots+\lambda_n=R$$ where $R$ is a positive constant. I wonder what the minimum value of $f_i(\lambda_1,\ldots,\lambda_n)$ is. 
 A: We suppose of course that $n \ge 3$.
If the $\lambda_j$ are $\ge 0$, it is clear that if we can make the first sum as small as it could conceivably be, and the second as large as it could conceivably be, $f_i$ will be as small as possible.  
The smallest conceivable value of the first sum is $0$, and it is reached for example when all the $\lambda_j$ other than $\lambda_i$ are $0$.
Now given any non-negative $\lambda_j$ summing to $R$, the maximum value of the second sum is $R^2$, reached when all $\lambda_j$ but one are $0$.  
This is an easy general fact.  Probably the easiest proof is the observation that
$$\sum \lambda_j^2 \le \left(\sum \lambda_j\right)^2$$
(just expand the right-hand side, the "mixed" terms are non-negative). Clearly we have equality iff one $\lambda_j$ is $R$ and the rest are $0$. 
By the way, but not relevant to your problem, the minimum of $\sum \lambda_j^2$ is reached when the $\lambda_j$ are equidistributed, meaning that $\lambda_j=R/n$ for all $j$.
Thus, if the $\lambda_j$ are $\ge 0$, we can simultaneously minimize the first sum and maximize the second by choosing $\lambda_i=R$ and $\lambda_j=0$ for $j \ne i$.  
If the condition is that the $\lambda_j$ are positive, then there is no minimum, but your expression can be made arbitrarily close to $-2nR^2/(n-2)$ by choosing $\lambda_i$ very close to $R$ and the remaining $\lambda_j$ (say) equal and very close to $0$. Under the positivity constraint, although the minimum does not exist, the infimum does and is equal to $-2nR^2/(n-2)$.
