I've tried my algebra backwards and forwards and starting from the left-hand side of the equation below I just can't get to the right-hand side. I'm always left with an extra term $-2Y_i\bar{Y}$.
$\sum (Y_i-\bar{Y})^2 = \sum Y_i^2 - n\bar{Y}^2$
I've tried my algebra backwards and forwards and starting from the left-hand side of the equation below I just can't get to the right-hand side. I'm always left with an extra term $-2Y_i\bar{Y}$.
$\sum (Y_i-\bar{Y})^2 = \sum Y_i^2 - n\bar{Y}^2$
On
Note that $$\overline Y\equiv\frac{\sum_i Y_i}{n}\Longleftrightarrow n\overline Y={\sum_i Y_i}.$$
Therefore, you have that
\begin{align*} \sum_i\left(Y_i-\overline Y\right)^2=&\,\sum_i\left(Y_i^2-2Y_i\overline Y+\overline Y^2\right)=\sum_i Y_i^2-2\overline Y\sum_i Y_i+\underbrace{\sum_i\overline Y^2}_{=n\overline Y^2}\\ =&\,\sum_i Y_i^2-2\overline Y(n\overline Y)+n\overline Y^2=\sum_i Y_i^2-2n\overline Y^2+n\overline Y^2=\sum_i Y_i^2-n\overline Y^2. \end{align*}
$$\begin{align*}\sum (Y_i-\bar{Y})^2 &= \sum (Y_i^2-2\bar{Y}Y_i+\bar{Y}^2)\\&= \sum Y_i^2-2\bar{Y}\underbrace{\sum Y_i}_{=\bar{Y}\cdot n} +\underbrace{\sum\bar{Y}^2}_{=n\times\bar{Y}^2}\\\\&= \sum Y_i^2-2\bar{Y}\bar{Y}\cdot n+ n\cdot \bar{Y}^2 \\&=\sum Y_i^2-n\bar{Y}^2\end{align*}$$