Showing that $\hat \beta_1 = S_{xy}/S_{xx}$ for a simple linear regression To show $\hat \beta_1 = S_{xy}/S_{xx}$ I know I can use $\mathbf{\hat\beta_{2x1} = (X'X)^{-1} X' y}$
However, when I do this problem I only get to this step and I'm unsure if I'm even taking the right approach. Can someone please show me hot solve this problem, or at least steer me in the right direction?
My work:
I know these are matrices, but I'll just show you my work algebraically. 
$\mathbf{X'X}$ $=$ $n$ $*$ $\sum_{i=0}^n x_i^2 $ $-$ $(\sum_{i=0}^n x_i)^2$ 
$=$ $n^2$ $*$ $\frac1n$ $*$ $\sum_{i=0}^n x_i^2$ $-$ $n^2$ $*$ $(\frac1n\sum_{i=0}^n x_i)^2$
$=$ $n^2$ $*$ $(\frac1n$ $\sum_{i=0}^n x_i^2$ $-$ $(\frac1n\sum_{i=0}^n x_i)^2)$
$=$ $n^2 Var(x_i)$
I'm stuck here. Any help appreciated! 
 A: Note that 
$$
\hat{\beta} = (X'X)^{-1}X'y = \frac{ 1 }{ n \sum (x_i - \bar{x}  ) ^ 2 } 
\begin{pmatrix}
\sum x_i ^ 2& - \sum x_i \\
- \sum x_i & n
\end{pmatrix} 
\begin{pmatrix}
\sum y_i \\
\sum x_i y_i
\end{pmatrix} ,
$$
hence 
$$
\hat{\beta}_1 = \frac{ n\sum x_i y_i - \sum x_i \sum y_i }{n \sum (x_i - \bar{x} ) ^ 2} = 
\frac{ n( \sum x_i y_i - n \bar{x} \bar{y}) }{n \sum (x_i - \bar{x} ) ^ 2}
=
\frac{ \sum (x_i - \bar{x} ) ( y_i - \bar{y})  }{ \sum (x_i - \bar{x} ) ^ 2}  = \frac{S_{xy}}{S_{xx}}
$$
A: In order to find $\beta_0$ and $\beta_1$ you have to solve the linear system 
$$\begin{align}
\frac{\partial L}{\partial \beta_0} &= -2\sum_{i=1}^N (y_i-(\beta_0 + \beta_1  x_i))=0,\\
\frac{\partial L}{\partial \beta_1} &= -2\sum_{i=1}^N x_i(y_i-(\beta_0 + \beta_1  x_i))=0.
\end{align}
$$
where $L$ is loss function for OLS.
Which has the solutions 
$$
\begin{align}
\beta_1 &= \frac{\sum_{i=1}^N (x_i-\bar{x})(y_i-\bar{y})}{\sum_{i=1}^N  (x_i-\bar{x})^2}\\
\beta_0 &= \bar{y}-\beta_1 \bar{x}
\end{align}
$$
where $\bar{x} = \mu(x_i), \qquad  \bar{y} = \mu(y_i) $
The previous equation can be written in matricial form as you said.
