Show $\mathbb{E}(\sum_{i=1}^n(X_i-(\frac{1}{n}\sum_{i=1}^{n}X_i))^2)=(n-1)\mathbb{V}(X)$ Let $X_1, X_2, \ldots$ be a sequence of i.i.d random variables with finite variance and $M_n=\frac{1}{n}\sum_{i=1}^{n}X_i$.
We need to show that $\mathbb{E}(\sum_{i=1}^n(X_i-M_n)^2)=(n-1)\mathbb{V}(X)$.
Here is what I tried:
By linearity of expectation, we have $\mathbb{E}(\sum_{i=1}^n(X_i-M_n)^2)=\sum_{i=1}^n\mathbb{E}(X_i-M_n)^2$.
Then we need to show that $M_n$ is also the mean for every $X_i$:
Since $X_1, X_2, \ldots$ are i.i.d r.v, then they have the same mean, let it be $m$, then
$M_n=\mathbb{E}(M_n)=\mathbb{E}(\frac{1}{n}\sum_{i=1}^{n}X_i)=\frac{1}{n}\mathbb{E}(\sum_{i=1}^{n}X_i)=\frac{1}{n}\sum_{i=1}^{n}\mathbb{E}(X_i)=\frac{1}{n}nm=m$.
Then $\mathbb{E}(\sum_{i=1}^n(X_i-M_n)^2)=\sum_{i=1}^n\mathbb{E}(X_i-M_n)^2=\sum_{i=1}^n\mathbb{E}(X_i-m)^2=\sum_{i=1}^n\mathbb{V}(X_i)=n\mathbb{V}(X_i)$.
What I don't understand are:
1. what is $X$? Should it be $X_i$? Is it a typo?
2. or is it $X_1+X_2+\ldots=X$?
3. how to get $n-1$ instead of $n$?
Thanks for the help!
 A: 
  
*
  
*what is $X$? Should it be $X_i$? Is it a typo?
  
*or is it $X_1+X_2+…=X$?
  

$\{X_i\}_{i\in\{1..n\}}$ is a sequence of $n$ iid random variables; also known as a sample.   $X$ is a generic random variable of the same distribution.   So because all of these are independent and identically distributed, $\mathsf E(X)=\mathsf E(X_1)=\ldots=\mathsf E(X_n)$, and $\mathsf {Var}(X)=\mathsf {Var}(X_1)=\ldots=\mathsf {Var}(X_n)$


  
*how to get $n−1$ instead of $n$?
  

$M_n = \tfrac 1n\sum_{i=1}^n X_i$ is the sample mean.   It is itself a random variable, and not a constant, and it is not independent of any $X_i$ in the sample.   Hence :
$$\begin{align}\mathsf E(\sum_{i=1}^n X_iM_n) ~=~ &\tfrac 1n \sum_{i=1}^n\sum_{j=1}^n\mathsf E(X_iX_j)
\\ =~&\tfrac 1 n\Big(\sum_{i=1}^n\mathsf E(X_i^2) +\raise{1ex}{\mathop{\sum_{i=1}^n\sum_{j=1}^n}\limits_{i\neq j}}\mathsf E(X_i)\mathsf E(X_j)\Big)
\\[1ex] ~=~ & \mathsf E(X^2)+(n-1)\mathsf E(X)^2
\end{align}$$
Similarly we have: $$\begin{align} \mathsf E(\sum_{i=1}^n M_n^2) ~=~&\sum_{i=1}^n\tfrac 1{n^2} \sum_{j=1}^n\sum_{k=1}^n\mathsf E(X_jX_k) \\[1ex]=~& \tfrac1{n}\Big(\sum_{j=1}^n \mathsf E(X_j^2)+\raise{1ex}{\mathop{\sum_{j=1}^n\sum_{k=1}^n}\limits_{j\neq k}}\mathsf E(X_j)\mathsf E(X_k)\Big) \\[1ex]~=~& \mathsf E(X^2)+(n-1)\mathsf E(X)^2\end{align}$$
And thus we use these to evaluate our expectation:
$$\begin{align}
\mathsf E\Big(\sum_{i=1}^n\big(X_i-M_n\big)^2\Big)
~=~& \sum_{i=1}^n\mathsf E(X_i^2-2X_iM_n+M_n^2)
\\[1ex] ~=~& \sum_{i=1}^n\mathsf E(X_i^2)-2\sum_{i=1}^n\mathsf E(X_iM_n)+\sum_{i=1}^n\mathsf E(M_n^2) 
\\[1ex] ~=~& n\mathsf E(X^2)-2\big(\mathsf E(X^2)+(n-1)\mathsf E(X)^2\big)+\big(\mathsf E(X^2)+(n-1)\mathsf E(X)^2\big) 
\\[1ex] ~=~& (n-1)\big(\mathsf E(X^2)-\mathsf E(X)^2\big) 
\\[1ex] ~=~& (n-1)\mathsf {Var}(X) 
\end{align}$$
