We are looking at the sample variance ( of $n$ iid random variables)
$S^2 = \frac{1}{n-1} \Sigma_{i=1}^{n} (Y_i - \bar{Y} )^2$ where $\bar{Y}$ is the sample average.
My lecturer has rearranged this to:
$S^2 = \frac{1}{n-1} ( \Sigma_{i=1}^{n}Y_i - \frac{1}{n} \Sigma_{i \ne j} \ Y_i Y_j) $
But I cannot understand how he got that. It's talked about like a trivial manipulation but I can't see it.
This is simply not true. Let $n=3$, $Y_1=1$, and $Y_2=Y_3=0.$ $\overline Y$ is supposed to be the average, that is $\overline Y=\frac13.$ Then on the one hand
$$S^2 = \frac{1}2 \sum_{i=1}^{3} \left(Y_i - \frac13 \right)^2=$$ $$=\frac12\left(\frac49+\frac19+\frac19\right)=\frac{1}{3}.$$
On the other hand,
$$S^2 = \frac12 \left( \sum_{i=1}^{3}Y_i - \frac{1}{3} \sum_{i \ne j} \ Y_i Y_j\right) =$$ $$=\frac12\left(1-\frac130\right)=\frac12.$$