Derivation of formula for mean of a dataset after adding a new data point

150 Views Asked by At

I was reading an article that stated that if we know the mean $\bar{x}_{prev}$ of a dataset with $n$ datapoints, and that if we add a new data point $x_{k}$ to the dataset, then the new mean $\bar{x}_{new}$ can be expressed by the formula:

$\bar{x}_{new} = \bar{x}_{prev} + \frac{1}{n+1}(x_k-\bar{x}_{prev})$

It is not obvious to me how this expression is true.

This is my attempt at deriving the expression:

$\bar{x}_{new}=\frac{1}{n+1}\sum_{i=1}^{n+1}{x_i} = \frac{1}{n+1}(x_{k} + \sum_{i=1}^{n}x_i)$

Note that $\sum_{i=1}^{n}x_i = n\bar{x}_{prev}$

$\bar{x}_{new}=\frac{1}{n+1}(x_{k} + n\bar{x}_{prev})$

but is does not seem like this is getting me anywhere.

1

There are 1 best solutions below

0
On BEST ANSWER

$$\bar{x}_{new}=\frac{1}{n+1}(x_{k} + n\bar{x}_{prev})=\bar{x}_{prev}+\frac{1}{n+1}(x_{k} + n\bar{x}_{prev}-(n+1)\bar{x}_{prev})$$ $$\bar{x}_{new}=\bar{x}_{prev} + \frac{1}{n+1}(x_k-\bar{x}_{prev})$$