$\displaystyle \sum^{n-3}_{j=0}(2(n+j-2))$

= 2 *((n-2) + (n-1) + n +... + (2n-5))

$\displaystyle = 2 * ( \sum^{2n-5}_{i=1}(i) - \sum^{n-3}_{i=1}(i) )$

...

I don't understand where the (2n-5) comes from in line 2, and then why we use it in the summation on line 3. Nor do I understand where those summations come from on line 3 and why we subtract them.