# Trouble Understanding a Part of the Method of Moment Estimator Solution for Normal Random Variables

Good day. I've been trying to understand the solution for the $$\sigma^2$$ of the method of moment point estimator for the normal random variables $$X_1, X_2,...,X_n$$ of mean $$\mu$$ and variance $$\sigma^2$$. As given, the sample moments equated to the theoretical moments are :

1. $$\bar{X}=\hat{\mu}=\frac{1}{n}\sum_{i=1}^nX_i$$
2. $$\hat{\sigma}^2-\hat{\mu}^2=\frac{1}{n}\sum_{i=1}^nX_i^2$$

Substituting (1) to (2) and isolating $$\hat{\sigma}^2, we get$$

$$\sigma^2=\frac{1}{n}\sum_{i=1}^nX_i^2-\bar{X}^2$$

Which, somehow, can be simplified to this:

$$\sigma^2=\frac{1}{n}\sum_{i=1}^n(X_i-\bar{X})^2$$

I can't wrap my head around how this part happened. Am I forgetting some property of the sigma notation that allows for this to happen? Moreso, how are they able to factor the exponent out. I have tried looking it up, but nothing I found elaborates much on this, and I'm on my wit's end. Please help me understand this, and if possible, please link me up to some readings about Point Estimation and Method of Moments.

\begin{align} \frac1n \sum_{i=1}^n X_i^2 - \bar{X}^2 &= \frac1n \sum_{i=1}^n X_i^2 - 2\bar{X}^2 + \bar{X}^2 \\ &=\frac1n \sum_{i=1}^n X_i^2 - 2\frac{1}n \bar{X}\sum_{i=1}^n X_i + \bar{X}^2 \\ &=\frac1n \left(\sum_{i=1}^n X_i^2 - 2 \bar{X}\sum_{i=1}^n X_i + n\bar{X}^2\right) \\ &=\frac1n \left(\sum_{i=1}^n X_i^2 - 2 \bar{X}\sum_{i=1}^n X_i + \sum_{i=1}^n\bar{X}^2\right) \\ &=\frac1n \sum_{i=1}^n\left( X_i^2 - 2 \bar{X} X_i + \bar{X}^2\right) \\ &=\frac1n\sum_{i=1}^n (X_i-\bar{X})^2 \end{align}