# How does the nth sample impact Mean and Variance? [duplicate]

Given the Mean and Variance of $$n$$ samples $$x_i$$:

$$M_n=\frac {1}{n}\sum_{1}^{n} x_i$$

$$V_n=\frac {1}{n}\sum_{1}^{n}(x_i-μ_n)^2$$

How do Mean and Variance change, when we take into account one more sample?

In other words, what are the function $$f(x_n,\space...)$$ and $$g(x_n,\space...)$$ such that:

$$M_n = f(x_n,\space n, \space M_{n-1})$$

$$V_n = g(x_n, \space n, \space M_{n-1}, \space V_{n-1})$$

Thank you!