Missing intermediate steps for identity

63 Views Asked by At

Can someone please help fill in the intermediate steps for the following identity:

$$\sum_{i=1}^n (x_i - \mu)^2 = n (\mu - \bar{x}) + \sum_{i=1}^n (x_i - \bar{x})^2$$

where $\bar{x} = \frac{1}{n}\sum_{i=1}^n x_i$ and $\mu$ is an unknown variable.

--UPDATE in response to amWhy's comment below --

This question is not for a homework assignment or any such task. I am reading a PDF compendium of conjugate priors for fun and saw the above identity, which I was unable to verify on my own. The above identity is found on page 3 of the following link (I realize external links are discouraged, but context was requested: https://www.johndcook.com/CompendiumOfConjugatePriors.pdf).

$$ \sum_{i=1}^n (x_i - \mu)^2 = \sum_{i=1}^n(\mu - \bar{x}) + \sum_{i=1}^n (x_i - \bar{x})^2 \\ = \sum_{i=1}^n[ (\mu - \bar{x} + (x_i - \bar{x})^2 ] \\ = \sum_{i=1}^n[ \mu - \bar{x} + x_i^2 -2x_i\bar{x} + \bar{x}^2 ] $$

I don't see how to turn: $$ \mu - \bar{x} + x_i^2 -2x_i\bar{x} + \bar{x}^2$$ into $$ (x_i - \mu)^2 $$

1

There are 1 best solutions below

0
On BEST ANSWER

Even corrected, I don't think that this is correct.

I think what you should have is.

$\sum_\limits{i=1}^n (x_i - \mu)^2 = n(\mu - \bar x)^2 + \sum_\limits{i=1}^n(x-\bar x)^2$

This is also incorrect in the linked document. Nonetheless,

$\sum_\limits{i=1}^n (x_i - \mu)^2\\ \sum_\limits{i=1}^n (x_i -\bar x + \bar x - \mu)^2\\ \sum_\limits{i=1}^n (x_i -\bar x)^2 + 2(\bar x - \mu)\sum_\limits{i=1}^n (x_i -\bar x) + \sum_\limits{i=1}^n(\bar x - \mu)^2\\ \sum_\limits{i=1}^n (x_i -\bar x) = 0\\ \sum_\limits{i=1}^n (x_i - \mu)^2 = \sum_\limits{i=1}^n (x_i - \bar x)^2+n(\bar x - \mu)^2$