Given $X_1, \dots , X_n$ i.i.d. and the two sample moments $$M_1 = \frac{1}{n} \sum_{i = 1}^{n} X_i = \bar{X}$$ and $$ M_2 = \frac{1}{n} \sum_{i = 1}^{n} X_i^2$$ how can I compute: $$ S^2 = \frac{1}{n} \sum_{i = 1}^{n} (X_i - \bar{X})^2$$ such as: $$S^2 = f(M_1, M_2)$$
Thank you.