How is this formula derived

slope= $\displaystyle \frac{\sum(x_{i}-x_{0})(y_{i}-y_{0})}{\sum(x_{i}-x_{0})^2}$

This seems to give me the average ratio of the slope

$\displaystyle \frac{\sum(y_{i}-y_{0})}{\sum(x_{i}-x_{0})}$

I know this is one, but why is it needed?

$\displaystyle \frac{\sum(x_{i}-x_{0})}{\sum(x_{i}-x_{0})}$