# How to break apart this sum?

I have a summation I need to break apart but I can't figure it out

$p.15$, right after line $(3.8)$

Going from the first $ns^{2}$ identity to the next line, where the author breaks apart the sum.

I understand how he's trying to take out the $nth$ (jth) in this case) term, and use the equality identity above (for the distance between the sample mean and "reduced sample" mean) to get to the solution, but I can't figure out how that's a legal move, to break out the sum of two things squared into its components or the sequence of steps that was omitted...

If you guys could help I would appreciate it, thanks

-

$$\sum_{i=1}^n(x_i-\hat x+\hat x-\bar x)^2=\sum_{i\ne j}(x_i-\hat x)^2+(x_j-\hat x)^2-n(\hat x-\bar x)^2\;.\tag{1}$$

Note that $j$ is a fixed index, $\bar x$ is the mean of $x_1,\dots,x_n$, and $\hat x$ is the mean of the $n-1$ numbers $x_i$ with $i\ne j$. That is,

$$\bar x=\frac1n\sum_{i=1}^nx_i\quad\text{and}\quad\hat x=\frac1{n-1}\sum_{i\ne j}x_i\;,$$

so $(n-1)\hat x+x_j=n\bar x$, $$x_j-\bar x=(n-1)\bar x-(n-1)\hat x=(n-1)(\bar x-\hat x)\;,\tag{2}$$ and

$$x_j-\hat x=n\bar x-n\hat x=n(\bar x-\hat x)\tag{3}\;.$$

First split the $i=j$ term out of the lefthand side of $(1)$:

\begin{align*} \sum_{i=1}^n(x_i-\hat x+\hat x-\bar x)^2&=(x_j-\hat x+\hat x-\bar x)^2+\sum_{i\ne j}(x_i-\hat x+\hat x-\bar x)^2\\ &=(x_j-\bar x)^2+\sum_{i\ne j}(x_i-\hat x+\hat x-\bar x)^2\;. \end{align*}

Now $$(x_i-\hat x+\hat x-\bar x)^2=(x_i-\hat x)^2+2(x_i-\hat x)(\hat x-\bar x)+(\hat x-\bar x)^2\;,$$

so

\begin{align*} \sum_{i\ne j}(x_i-\hat x+\hat x-\bar x)^2&=\sum_{i\ne j}(x_i-\hat x)^2+2\sum_{i\ne j}(x_i-\hat x)(\hat x-\bar x)+\sum_{i\ne j}(\hat x-\bar x)^2\\ &=\sum_{i\ne j}(x_i-\hat x)^2+2(\hat x-\bar x)\sum_{i\ne j}(x_i-\hat x)+(n-1)(\hat x-\bar x)^2\\ &=\sum_{i\ne j}(x_i-\hat x)^2+(n-1)(\hat x-\bar x)^2\;, \end{align*}

since $$\sum_{i\ne j}(x_i-\hat x)=\sum_{i\ne j}x_i-(n-1)\hat x=0\;.$$

Thus,

$$\sum_{i=1}^n(x_i-\hat x+\hat x-\bar x)^2=(x_j-\bar x)^2+\sum_{i\ne j}(x_i-\hat x)^2+(n-1)(\hat x-\bar x)^2\;,$$

and we need only verify that $(x_j-\bar x)^2+(n-1)(\hat x-\bar x)^2=(x_j-\hat x)^2-n(\hat x-\bar x)^2$. Use $(2)$ and $(3)$:

\begin{align*} (x_j-\bar x)^2+(n-1)(\hat x-\bar x)^2&=(n-1)^2(\bar x-\hat x)^2+(n-1)(\hat x-\bar x)^2\\ &=n(n-1)(\bar x-\hat x)^2\\ &=n^2(\bar x-\hat x)^2-n(\bar x-\hat x)^2\\ &=(x_j-\hat x)^2-n(\hat x-\bar x)^2\;. \end{align*}

-
beautiful, thanks –  pootieman Jan 19 '13 at 22:08
@pootieman: You’re welcome. –  Brian M. Scott Jan 20 '13 at 7:43

Since I worked this in chat, I might as well copy it here :-)

\begin{align} &\sum_{i=1}^n\left((x_i-\hat{x})+(\hat{x}-\bar{x})\right)^2\\ &=\sum_{i=1}^n\left(\color{#C00000}{(x_i-\hat{x})^2}+\color{#00A000}{2(x_i-\hat{x})(\hat{x}-\bar{x})}+\color{#0000FF}{(\hat{x}-\bar{x})^2}\right)\\ &=\sum_{\substack{i=1\\i\ne j}}^n\left(\color{#C00000}{(x_i-\hat{x})^2}\right)+\color{#C00000}{(x_j-\hat{x})^2}+\color{#00A000}{2n(\bar{x}-\hat{x})(\hat{x}-\bar{x})}+\color{#0000FF}{n(\hat{x}-\bar{x})^2}\\ &=\sum_{\substack{i=1\\i\ne j}}^n\left((x_i-\hat{x})^2\right)+(x_j-\hat{x})^2-n(\hat{x}-\bar{x})^2 \end{align} Note that in addition to $n(\bar{x}-\hat{x})$, as used above, $$\sum_{i=1}^n(x_i-\hat{x})=x_j-\hat{x}$$ Since $$\sum_{\substack{i=1\\i\ne j}}^n(x_i-\hat{x})=(n-1)(\hat{x}-\hat{x})=0$$

-
nice! thanks a lot. –  pootieman Jan 19 '13 at 22:08