How to explain the equation about summation? $$\frac{\sum_{i=0}^nx_iy_i-\bar y\sum_{i=0}^nx_i}{\sum_{i=0}^nx_i^2-\bar x\sum_{i=0}^nx_i}= \frac{\sum_{i=0}^n(x_i-\bar x)(y_i-\bar y)}{\sum_{i=0}^n(x_i-\bar x)^2}$$
Maybe it refers some calculation rules about summation. I cannot solve that. Thanks! 
 A: In order to show  equality it is sufficient to show equality of both, numerator and denominator.

We obtain
  \begin{align*}
\color{blue}{\sum_{i=0}^n(x_i-\overline{x})(y_i-\overline{y})}
&=\sum_{i=0}^nx_iy_i-\overline{x}\sum_{i=0}^ny_i-\overline{y}\sum_{i=0}^nx_i+\overline{x}\overline{y}\sum_{i=0}^n1\tag{1}\\
&=\sum_{i=0}^nx_iy_i-\overline{x}(n+1)\overline{y}-\overline{y}(n+1)\overline{x}+\overline{x}\overline{y}(n+1)\tag{2}\\
&\,\,\color{blue}{=\sum_{i=0}^n x_iy_y-\overline{y}\sum_{i=0}^nx_i}\tag{3}\\\\
\color{blue}{\sum_{i=0}^n(x_i-\overline{x})^2}
&=\sum_{i=0}^n x_i^2-2\sum_{i=0}^nx_i\overline{x}+\sum_{i=0}^n\overline{x}^2\tag{4}\\
&=\sum_{i=0}^nx_i^2-\overline{x}^2(n+1)\tag{5}\\
&\,\,\color{blue}{=\sum_{i=0}^nx_i^2-\overline{x}\sum_{i=0}^nx_i}\tag{6}
\end{align*}
  and the claim follows.

Comment:


*

*In (1) and (4) we multiply out.

*In (2) and (5) we use the relations $\overline{x}=\frac{1}{n+1}\sum_{i=0}^n x_i$ and $\overline{y}=\frac{1}{n+1}\sum_{i=0}^ny_i$.

*In (3) and (6) we simplify and collect terms.
A: Noting that $\overline{x} = \frac{1}{n+1}\sum_{i=0}^{n}x_{i}$ implies that $\sum_{i=0}^{n}x_{i} = (n+1)\overline{x}$, we'll work from the right hand side to the left hand side.
By multiplying out the terms, we get
$$
\frac{\sum_{i=0}^{n}(x_{i} -\overline{x})(y_{i}-\overline{y})}{\sum_{i=0}^{n}(x_{i} -\overline{x})^{2}}
= \frac{\sum_{i=0}^{n}(x_{i}y_{i} - \overline{x}y_{i} - \overline{y}x_{i} + \overline{x}\overline{y})}{\sum_{i=0}^{n}(x_{i}^{2} - 2\overline{x}x_{i} + \overline{x}^{2})}.
$$
Distributing the sum,
$$
\frac{\sum_{i=0}^{n}(x_{i}y_{i} - \overline{x}y_{i} - \overline{y}x_{i} + \overline{x}\overline{y})}{\sum_{i=0}^{n}(x_{i}^{2} - 2\overline{x}x_{i} + \overline{x}^{2})}
= \frac{\sum_{i=0}^{n}x_{i}y_{i} - \sum_{i=0}^{n}\overline{x}y_{i} - \sum_{i=0}^{n}\overline{y}x_{i} + \sum_{i=0}^{n}\overline{x}\overline{y}}{\sum_{i=0}^{n}x_{i}^{2} - 2\sum_{i=0}^{n}\overline{x}x_{i} + \sum_{i=0}^{n}\overline{x}^{2}}
$$
and by taking the $\overline{x}$ and $\overline{y}$ out of the sums (since they don't depend on the sum), the right hand side becomes
$$
\frac{\sum_{i=0}^{n}x_{i}y_{i} - \overline{x}\sum_{i=0}^{n}y_{i} - \overline{y}\sum_{i=0}^{n}x_{i} + \overline{x}\overline{y}\sum_{i=0}^{n}1}{\sum_{i=0}^{n}x_{i}^{2} - 2\overline{x}\sum_{i=0}^{n}x_{i} + \overline{x}^{2}\sum_{i=0}^{n}1}.
$$
Now using $\sum_{i=0}^{n}1 = n+1$ and $\sum_{i=0}^{n}x_{i} = (n+1)\overline{x}$ (and the same identity for $\overline{y}$), we get
$$
\frac{\sum_{i=0}^{n}x_{i}y_{i} - \overline{y}\sum_{i=0}^{n}x_{i} - (n+1)\overline{x}\overline{y} + (n+1)\overline{x}\overline{y}}{\sum_{i=0}^{n}x_{i}^{2} - 2(n+1)\overline{x}^{2} + (n+1)\overline{x}^{2}}
$$
which simplifies to
$$
\frac{\sum_{i=0}^{n}x_{i}y_{i} - \overline{y}\sum_{i=0}^{n}x_{i}}{\sum_{i=0}^{n}x_{i}^{2} - (n+1)\overline{x}^{2}}.
$$
Finally, rewrite $(n+1)\overline{x}^{2} = (n+1)\overline{x}\overline{x} = \overline{x}\sum_{i=0}^{n}x_{i}$ to get
$$
\frac{\sum_{i=0}^{n}x_{i}y_{i} - \overline{y}\sum_{i=0}^{n}x_{i}}{\sum_{i=0}^{n}x_{i}^{2} - \overline{x}\sum_{i=0}^{n}x_{i}},
$$
exactly as required.
A: If $\;{\bf x}=(x_0,\dots,x_n)\;$ and $\;{\bf y}=(y_0,\dots,y_n)\;$ then the dot product is $\;{\bf x}\cdot{\bf y} :=\sum_i x_iy_i.\;$ Also let $\;{\bf 1}=(1,\dots,1).\;$
 Now 
$\; {\bf 1}\!\cdot\!{\bf x} = \sum_i 1 x_i = \sum_i x_i ,\;$
$\; {\bf 1}\!\cdot\!{\bf y} = \sum_iy_i ,\;$
and
 ${\bar x} = ({\bf 1}\!\cdot\!{\bf x}) / ({\bf 1}\!\cdot\!{\bf 1}) ,\;$
and  $\sum_i {\bar x}y_i = {\bar x}\sum_i y_i =
  ({\bf 1}\!\cdot\!{\bf x})({\bf 1}\!\cdot\!{\bf y}) / ({\bf 1}\cdot{\bf 1}).\;  $ Now define
 $ s :=\sum_i x_i{\bar y}\!=\!\sum_i {\bar x}y_i \!=\! \sum_i {\bar x}{\bar y} .\; $ Thus,
 $$ \sum_i (x_i-{\bar x})(y_i-{\bar y}) \!=\! \sum_i x_iy_i -{\bar x}y_i - x_i{\bar y} + {\bar x}{\bar y} = {\bf x}\!\cdot\!{\bf y} - s - s + s = {\bf x}\!\cdot\!{\bf y} - s.$$
Substituting $\;x\;$ for $\;y\;$ in this equation gives
  $\;\sum_i (x_i-{\bar x})^2 \!=\! {\bf x}\!\cdot\!{\bf x} - {\bar x}\sum_i x_i\; $ and the quotient gives the original equation.
