I started with this

and rewrote it as this, factoring out sum(ei)

Is this correct? What I am unsure about is the bottom of the fraction, should it be sum(xj-xbar) or sum(xi-xbar)?

It's a question in which the final answer has (xj-xbar) on the bottom of that fraction (once you use common denominator) I am trying to establish if it is a typo.