Simplify $ a = \frac{N\sum(xy)-\sum(x)\sum(y)}{N\sum(x^2)-(\sum(x))^2} $ to yield $ a = \frac{\bar{xy} - \bar{x}\bar{y}}{\bar{x^2}-\bar{x}^2}$ I'm working out some multivariable linear regression equations on paper for a class I'm taking, and I'm getting an erroneous factor of N in my solution according to the class.  I'm sure it is my error but I can't figure out where.
Starting with these equations:
$ a =  \frac{N\sum(xy)-\sum(x)\sum(y)}{N\sum(x^2)-(\sum(x))^2} $
$ b = \frac{\sum(y)\sum(x^2)-\sum(x)\sum(yx)}{N\sum(x^2)-(\sum(x)^2)}$
And using the identities:
$\bar{x} = \frac{1}{N}\sum(x) $
$\bar{xy} = \frac{1}{N}\sum(xy) $
I'm told that we can simplify the expressions by dividing both numberators and denominators by $N^2$.
They should yield these identities:
$ a = \frac{\bar{xy} - \bar{x}\bar{y}}{\bar{x^2}-\bar{x}^2}$
$ b = \frac{\bar{y}\bar{x^2}-{\bar{x}\bar{xy}}}{\bar{x^2}-\bar{x}^2}$
I'm attempting to simplify as suggested by dividing both the numerator and denominator by $N^2$
$ \frac{\frac{N\sum(xy)-\sum(x)*\sum(y)}{N^2}}{\frac{N\sum(x^2)-(\sum(x)^2)/}{N^2}} $
For $a$ I'm getting an extra factor of $N$ in both the numerator and denominator:
$ a = \frac{N\bar{xy}-\bar{x}\bar{y}}{N\bar{x^2}-\bar{x}^2}$ 
I haven't yet solved b, because I want to get this first.  Can someone please confirm or point out the mistake?  I've done it on paper twice and gotten the same answer, and can't tell when I go wrong.
Note: I hope my MathJax accurately portrayed all elements, as I haven't written many complex expressions in MathJax before.
EDIT: To show how I got to this solution, I had the following after dividing by $N^2$:
$ a = \frac{\bar{xy}-\bar{x}\bar{y}\frac{1}{N}}{\bar{x^2}-\bar{x}^2\frac{1}{N}} $
In order to get rid of the factor of $\frac{1}{N}$ on both numerator and denominator, I multiplied numerator and denominator by $N$, which yielded my solution above.
Here are screenshots from the class slides that show where we begin, and what we should yield (in case I misinterpreted something):



There is no extra factor. We have  $\sum\limits_{i=1}^Nx_i\sum\limits_{i=1}^Ny_i$. Now we divide it by $N$.
$\underbrace{\frac1N\sum\limits_{i=1}^Nx_i}_{=\overline x}\sum\limits_{i=1}^Ny_i$
$\overline x\sum\limits_{i=1}^Ny_i$
Dividing the term by $N$ again
$\overline x\cdot \underbrace{ \frac1N\cdot \sum\limits_{i=1}^Ny_i}_{\overline y}=\overline x \ \overline y$
