It seems to me that the $x_i$ and the $\overline{x}$ switch places and when the chain rule is applied there is also a $-2$ that I cannot justify as to why it is negative.
When I try to derive this myself I get a similarly structured solution, but with different signs because I don't see how this is correct.
