I am confused how $\bar X$ is used sometimes as a constant and othertimes as a random variable.
My understanding is that $\bar X$ is a random variable because it changes every time our sample changes. I also understand that $E[\bar X]= E[\frac{X_1 +X_2 +...+X_n}{n}]=\frac{ nE[X]}{n} = E[X] = \mu $
I get confused when the professor writes $\bar{X}=E[\bar X]= E[\frac{X_1 +X_2 +...+X_n}{n}]=\frac{ nE[X]}{n} = E[X] = \mu $ and when he uses $\sum_1^n \bar X = n \bar X$ to proove another equation wich is $(X_i-\bar X)^2=\sum_1^nX_i^2-n\bar X^2$.
Someone can explain me this please? thank you