# Thread: How to simplify this sample mean expression?

1. ## How to simplify this sample mean expression?

$\displaystyle {1 \over n}\sum_{i=1}^{n} {X_i}^2 - ({1 \over n} \sum_{i=1}^{n} {X_i})^2$

2. There is not much "simplification" to be done, but you may want to write one of the following:

$\displaystyle {1 \over n}\sum_{i=1}^{n} {X_i}^2 - ({1 \over n} \sum_{i=1}^{n} {X_i})^2 = {1\over n}\sum_{i=1}^n \left(X_i - \frac{1}{n}\sum_{j=1}^n X_j\right)^2$

(which you get by expanding to square in the right-hand side into $\displaystyle X_i^2 - 2X_i{1\over n}\sum_{j=1}^n X_j + \left({1\over n}\sum_{j=1}^n X_j\right)^2$). It is the other expression for the empirical variance.

or:

$\displaystyle {1 \over n}\sum_{i=1}^{n} {X_i}^2 - ({1 \over n} \sum_{i=1}^{n} {X_i})^2 = {1\over n}\sum_{i=1}^n X_i^2 - {1\over n^2}\sum_{1\leq i, j\leq n}X_iX_j$$\displaystyle ={1\over n}\sum_{i=1}^n X_i^2 - {1\over n^2}\sum_{i=1}^n X_i^2 - {1\over n^2}\sum_{1\leq i\neq j\leq n} X_iX_j = \left(\frac{1}{n}-\frac{1}{n^2}\right)\sum_{i=1}^n X_i^2 - \frac{2}{n^2} \sum_{1\leq i<j \leq n} X_i X_j$
(which is the expansion of the square of the sum. In the last expression, every product $\displaystyle X_iX_j$ appears exactly once)

I hope it answers you question.
Laurent.

3. Originally Posted by chopet
$\displaystyle {1 \over n}\sum_{i=1}^{n} {X_i}^2 - ({1 \over n} \sum_{i=1}^{n} {X_i})^2$
This is sample mean square minus the square sample mean, which is the sample variance.

RonL