Suppose $X_1, ..., X_n$ are iid normal with parameters $(\mu, \sigma^2).$ What would be the distribution of $\frac{\sum(X_i-\bar X)^{2}}{\sigma^2}?$ I think the right answer would be $\chi_{n-1}^2$, however form another route, I got completely different answer.
My attempt:
Firstly we know that $X_i-\bar X$ is normal distributed, also trivially the mean of the expression is $0$. $Var(X_i-\bar X)=\frac{n-1}{n}\sigma^2$ after using $Var(aX)=a^2Var(X)$ and $Var(X_1+X_2)=Var(X_1)+Var(X_2)$ for independent variables. Hence $X_i-\bar X$ is $N(0, \frac{n-1}{n}\sigma^2$). Hence we would see that $\sqrt{\frac{n}{n-1}}{(X_i-\bar X)}$ is the standard normal variables. Hence at the end I got $\frac{n}{(n-1)\sigma^2}\sum(X_i-\bar X)^2$ is $\chi^2_{n}$. Obviously I don't think two are the same so where did my solution go wrong?
Any suggestion is much appreciated!
Let $\vec{X}:=(X_1-\mu,\ldots,X_n-\mu)^{\top}$ and $M:=I-n^{-1}ii^{\top}$, where $i$ is the vector of $1$'s. Then
\begin{align} \sigma^{-2}\sum_{i=1}^n (X_i-\bar{X}_n)^2=\sigma^{-2}(M\vec{X})^{\top}(M\vec{X})=(\vec{X}/\sigma)M(\vec{X}/\sigma)\sim\chi_{\operatorname{tr}(M)}^2 \end{align} because $M$ is symmetric and idempotent and $\vec{X}/\sigma\sim N(0,I)$. The trace of $M$ can be computed as follows: $$ \operatorname{tr}(M)=\operatorname{tr}(I)-n^{-1}\operatorname{tr}(ii^{\top})=n-1. $$