Sum of a Sum of a Squared Difference

How did the author jump from the second equation to the third equation? I suspect there’s a rule I’m forgetting that allows for this, any help is appreciated.

• I'm more interested in how they jumped from the first line to the second. Where do the 8s and 7s come from, what happened to good old $\mu$? – Vincent Jul 19 at 10:01

Note that

\begin{align} -\left(\sum_{i=1}^{160} (x_i - 8)^2 - \sum_{i=1}^{160} (x_i - 7)^2\right) & = -\left(\sum_{i=1}^{160} (x_i^2 - 16x_i + 64) - (x_i^2 - 14x_i + 49)\right) \\ & = -\left(\sum_{i=1}^{160} (-2x_i + 15)\right) \\ & = 2\sum_{i=1}^{160} x_i - 2400 \tag{1}\label{eq1} \end{align}

As you can see, the $$15$$ is a constant repeating $$160$$ times for a total of $$15 \times 160 = 2400$$. Also, the author used the minus sign in front to remove the first minus sign for the $$2x_i$$, moved the $$2$$ outside the summation and changed the plus to a minus for the sum of $$2400$$.

• Brilliant, thanks for breaking that down for me. – Seraphim Jul 19 at 1:36
• @Seraphim You're welcome. I'm glad I could be of some help. – John Omielan Jul 19 at 1:37

A simpler way, using $$a^2-b^2 = (a-b)(a+b)$$, is

$$\begin{array}\\ \sum_{i=1}^{160} (x_i - 8)^2 - \sum_{i=1}^{160} (x_i - 7)^2) &=\sum_{i=1}^{160} ((x_i - 8)^2 -(x_i - 7)^2)\\ &=\sum_{i=1}^{160} ((x_i - 8) -(x_i - 7))((x_i - 8) +(x_i - 7))\\ &=\sum_{i=1}^{160} (-1)(2x_i -15)\\ &=160\cdot 15-2\sum_{i=1}^{160} x_i\\ \end{array}$$

• Simpler? Debatable. Cooler? Yes. – Hendrix Jul 19 at 2:22
• I think it's simple because you don't have to expand the squares. – marty cohen Jul 19 at 2:30