Below is part of the proof to show $E[S^2] = \sigma^2$.

I don't understand how $2\bar{Y} \sum_{i=1}^n {Yi} = 2n\bar{Y}^2$?
Below is part of the proof to show $E[S^2] = \sigma^2$.

I don't understand how $2\bar{Y} \sum_{i=1}^n {Yi} = 2n\bar{Y}^2$?
By definition $$\overline{Y}=\frac1n\sum_{i=1}^nY_i\,,$$ so $$n\overline{Y}=\sum_{i=1}^nY_i\,,$$ and $$2\overline{Y}\sum_{i=1}^nY_i=2\overline{Y}(n\overline{Y})=2n\overline{Y}^2\,.$$