The slope of the best-fit line using least squares in two dimensions is given by
$$m = \dfrac{\sum\limits^n (x_i - \bar{x})(y_i - \bar{y})}{\sum\limits^n(x_i - \bar{x})^2}$$
However, I've found this site which states this equation can be simplified to
$$m = \dfrac{\sum\limits^n x_iy_i - x_i\bar{y}}{\sum\limits^n x_i^2 - x_i\bar{x}}$$
I can't see how to get from the traditional form to this one. Expanding the products in the first form, we get
$$m = \dfrac{\sum\limits^n x_i y_i - x_i\bar{y} - \bar{x}y_i + \bar{x}\bar{y}}{\sum\limits^n x_i^2 - 2x_i\bar{x} + \bar{x}^2}$$
This contains all the terms in the site's formulation, but also others, and I can't possibly see how to simplify them away.
Is that formulation incorrect, it is a simplification for a specific case I haven't realized, or am I just doing this wrong?