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

how can I prove that (if it is correct) ?

$\sum_{u,v \in P \times P} \frac{|u-v|^2}{N^2} = 2 \cdot Var(P)$

where $N$ is the number of elements of $P$. $P$ is a list of numbers.

share|cite|improve this question
up vote 0 down vote accepted

Note that

$$ \begin{align}\sum_{u,v \in P \times P} |u-v|^2 &= \sum_{i=1}^N \sum_{j=1}^N (u_i-v_j)^2 \\ &= \sum_{i=1}^N\sum_{j=1}^N \{ (u_i- \bar u)-(v_j- \bar v)\}^2\\&= \sum_{i=1}^N\sum_{j=1}^N\{ (u_i-\bar u)^2+ (v_j-\bar v)^2 -2(u_i-\bar u)(v_j-\bar v)\} \\&= \sum_{i=1}^N\sum_{j=1}^N (u_i-\bar u)^2 + \sum_{i=1}^N\sum_{j=1}^N(v_j-\bar v)^2 -2\sum_{i=1}^N(u_i-\bar u)\sum_{j=1}^N(v_j-\bar v) \\ &= \sum_{j=1}^NNS^2+\sum_{i=1}^NNS^2=2N^2S^2 \end{align}$$

Hence we get $\sum_{u,v \in P \times P} \frac{|u-v|^2}{N^2} = 2.Var(P)$

Just note that since $u,v \in P \times P$ we have $\bar u=\bar v$. Again we know that $\sum_{i=1}^N(u_i-\bar u)=0=\sum_{j=1}^N(v_j-\bar v)$ and $S^2=Var(P)$.

This is a measure of mutual differences and this is known as Gini's Mean Difference.

share|cite|improve this answer

Just write $(u - v)^2 = \left( (u - \mu) - (v - \mu) \right)^2$ and go from there: $$ \begin{align*} \frac{1}{N^2} \sum_{\substack{u \in P \\ v \in P}} \left (u - \mu)^2 -2 (u - \mu) (v - \mu) + (v - \mu)^2 \right) &= 2 \sigma^2 - 2 \frac{1}{N^2} \left(\sum_{u \in P} (u - \mu) \right) \cdot \left(\sum_{v \in P} (v - \mu) \right) \\ &= 2 \sigma^2 \end{align*} $$

share|cite|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.