I am working on homework currently and am having a difficult time with a specific question dealing with rewriting sample variance. The question is as follows:
Suppose $y_1, ..., y_n$ follow distribution $N(\mu, \sigma^{2})$. Let $\textbf y=[y_1, ... ,y_n]'$, and let $\overline{y_.} = \frac{1}{n} \Sigma_{i=1}^{n}y_i$. Show that $s^{2}=\frac{1}{n-1} \Sigma_{i=1}^{n}(y_i-\overline{y_.})^{2}$ can be written as $\textbf{y'By}$ for some matrix $\textbf B$. Find matrix $\textbf B$.
I've tried to see about just manipulating the given $s^2$ formula to get it into a form that might look useful, and I've tried working backwards from $\textbf{y'By}$ to expand some general form that gets close to the given $s^2$ formula, but I feel like I'm missing something. Thanks in advance for any help!
Hint:
Expand the square to get $$\sum_{i=1}^n(y_i-\overline y)^2=\sum_{i=1}^n y_i^2-n\overline y^2=\sum_{i=1}^n y_i^2-\frac1n\left(\sum_{i=1}^n y_i\right)^2$$
Now it is easy to see that $$\sum\limits_{i=1}^n y_i^2=(y_1\,\,y_2\,\ldots\,\,y_n)\begin{pmatrix}y_1 \\ y_2\\\vdots\\ y_n\end{pmatrix}=\boldsymbol y^T\boldsymbol y$$
Similarly, you have
$$\sum_{i=1}^n y_i=(1\,\,1\,\ldots\,\,1)\begin{pmatrix}y_1 \\ y_2\\\vdots\\ y_n\end{pmatrix}=\boldsymbol 1^T\boldsymbol y=\boldsymbol y^T\boldsymbol 1$$