4

There's a formula of variance on wikipedia, but I'm confused with the last equality. How does it come out?

$$\sigma^2 = \frac{1}{N} \sum_{i=1}^N (x_i-\mu)^2 = \left(\frac{1}{N}\sum_{i=1}^N x_i^2\right)-\mu^2 = \frac{1}{N^2} \sum_{i<j} \left(x_i-x_j\right)^2$$

gerhard
  • 105
  • Welcome! I've taken the liberty to edit your question to bring it up to community standards. This should get it some more attention and make it easier to answer. :) – Emily Jun 16 '16 at 17:04
  • Try to make your posts as self-contained as possible. You should always include relevant formulas and work in your posts. Simply providing a link can be considered lazy and so your posts might get ignored. You can learn to type up your work here. – Em. Jun 17 '16 at 08:50

2 Answers2

2

\begin{align} & \frac{1}{N}\sum\limits_{i=1}^{N}{({{x}_{i}}}-\mu {{)}^{2}}=\frac{1}{N}\sum\limits_{i=1}^{N}{({{x}_{i}}^{2}}-2{{x}_{i}}\mu +{{\mu }^{2}})=\frac{1}{N}\sum\limits_{i=1}^{N}{{{x}_{i}}^{2}}-2\mu\,\,\underbrace{\left( \frac{1}{N}\sum\limits_{i=1}^{N}{{{x}_{i}}} \right)}_{\mu }+{{\mu }^{2}} \\ & {{\sigma }^{2}}=\left(\frac{1}{N}\sum\limits_{i=1}^{N}{{{x}_{i}}^{2}}\right)-{{\mu }^{2}} \\ \end{align} \begin{align} & 2I=\frac{1}{{{N}^{2}}}\sum\limits_{i\ne j}^{N}{({{x}_{i}}}-{{x}_{j}}{{)}^{2}}=\frac{1}{{{N}^{2}}}\sum\limits_{i\ne j}^{N}{[({{x}_{i}}}-\mu {{)}^{2}}-2({{x}_{i}}-\mu )({{x}_{j}}-\mu )+{{({{x}_{j}}-\mu )}^{2}}] \\ & 2I=\frac{1}{N}\sum\limits_{j=1}^{N}{\left( \frac{1}{N}\sum\limits_{i=1}^{N}{({{x}_{i}}}-\mu {{)}^{2}} \right)}+\underbrace{\frac{2}{N}\sum\limits_{i=1}^{N}{\left( ({{x}_{j}}-\mu )\frac{1}{N}\sum\limits_{j=1}^{N}{({{x}_{j}}}-\mu ) \right)}}_{0}+\frac{1}{N}\sum\limits_{i=1}^{N}{\left( \frac{1}{N}\sum\limits_{j=1}^{N}{({{x}_{j}}}-\mu {{)}^{2}} \right)}=2{{\sigma }^{2}} \\ \end{align} finally we have $I=\sigma^2$

2

Sometimes $\displaystyle\sum_{i<j}$ means $\displaystyle\sum_{i\,:\,i<j}$ and sometimes it means $\displaystyle\sum_{i,j\,:\,i<j}$ and mathematicians writing this expression usually rely on context to make it clear which is which, and at least sometimes, I would prefer that they be explicit about that. In this case it has the latter meaning.

\begin{align} \sum_{i,j\,:\,i<j} (x_i - x_j)^2 & = \sum_{i,j\,:\,i<j} ((x_i - \mu) - (x_j-\mu))^2 \\[10pt] & = \frac 1 2 \sum_{i,j\,:\,i\ne j} ((x_i - \mu) - (x_j-\mu))^2 \\[10pt] & = \frac 1 2 \sum_{\text{ (no restriction on $i,j$ this time)}} ((x_i - \mu) - (x_j-\mu))^2\\[10pt] & = \frac 1 2 \sum_i \sum_j ((x_i - \mu) - (x_j-\mu))^2. \tag 1 \end{align}

Now let's work on that double sum: \begin{align} & \sum_i \left( \sum_j ((x_i - \mu) - (x_j-\mu))^2 \right) \\[10pt] = {} & \sum_i \left( \sum_j ((x_i - \mu)^2 + (x_j-\mu)^2 - 2(x_i-\mu)(x_j-\mu)) \right) \\[10pt] = {} & \sum_i \left( \sum_j (x_i - \mu)^2 \right) + \sum_i \left( \sum_j (x_j - \mu)^2 \right) - 2\sum_i\left(\sum_j (x_i-\mu)(x_j-\mu)\right) \\[10pt] = {} & \sum_i \left( \sum_j (x_i - \mu)^2 \right) + \underbrace{\sum_j \left( \sum_i (x_j - \mu)^2 \right)}_{\begin{smallmatrix} \text{Here the order of} \\ \text{summation was changed.} \end{smallmatrix}} - 2\sum_i\left(\sum_j (x_i-\mu)(x_j-\mu)\right). \end{align} In the first double sum above, The index $i$ does not change as $j$ goes from $1$ to $N$, so we're summing $N$ terms all equal to each other, and we get $$ \sum_i N(x_i - \mu)^2. $$ This is equal to $N^2\sigma^2$. And so is the second sum, for the same reason.

And now on to that last double sum: $$ \sum_i\left(\sum_j (x_i-\mu)(x_j-\mu)\right). $$ In the inner sum, the index $i$ does not change as $j$ goes from $1$ to $N$, and so we get $$ \sum_i\left((x_i-\mu) \sum_j (x_j-\mu)\right). $$ But $$ \sum_j (x_j-\mu) = 0. $$ Now we see that line $(1)$ above adds up to $$ \frac 1 2 \left(N^2\sigma^2 + N^2\sigma^2\right). $$ Dividing this by $N^2$ yields $\sigma^2$.

gerhard
  • 105