How to show that $\sum_{i=1}^n\left(x_i^2 - \bar{x}^2\right) = \sum_{i=1}^n\left(x_i - \bar{x}\right)^2$

81 Views Asked by At

I am reading through a book on linear regression and I am confused as to how a derivation has been done. The derivation up to where I have got is below.

$$ \sum_{i=1}^nx_i^2 - \frac{\left(\sum_{i=1}^nx_i\right)^2}{n} = \sum_{i=1}^nx_i^2 - \frac{\left(n\bar{x}\right)^2}{n} = \sum_{i=1}^nx_i^2 - n\bar{x}^2 = \sum_{i=1}^n\left(x_i^2 - \bar{x}^2\right) $$

I am not sure where to go from here, as the result I am aiming to derive is shown below.

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

How is this final result obtained?

1

There are 1 best solutions below

1
On BEST ANSWER

On one side of the equality you want to prove there is a sum of squares, so let us expand this: $$\sum_{i=1}^n\left(x_i - \bar{x}\right) ^2=\sum_{i=1}^n\left( x_i^2 - 2x_i\bar{x}+\bar{x}^2\right)=\sum_{i=1}^nx_i^2-2\bar{x}\sum_{i=1}^nx_i+\bar{x}^2\sum_{i=1}^n1=$$ $$=\sum_{i=1}^nx_i^2-2\bar{x}n\bar{x}+\bar{x}^2n=\sum_{i=1}^nx_i^2-n\bar{x}^2=\sum_{i=1}^nx_i^2-\bar{x}^2\sum_{i=1}^n1=\sum_{i=1}^n(x_i^2-\bar{x}^2)$$