Applying Cochran's Theorem to prove $\sum_{i = 1}^{n}\left(\frac{X_{i} - \bar{X}}{\sigma}\right)^{2} \sim \chi_{n - 1}^{2}$? Apply Cochran's theorem to show that if $X_{1}, \dots ,X_{n} \stackrel{i.i.d.}{\sim} \mathcal{N}(\mu, \sigma)$, then 
\begin{align*}
\sum_{i = 1}^{n}\left(\frac{X_{i} - \bar{X}}{\sigma}\right)^{2} \sim \chi_{n - 1}^{2},
\end{align*}
where $\bar{X} = \frac{1}{n}\sum_{i = 1}^{n}X_{i}$.
Following this wikipedia proof, we arrive at
\begin{align*}
\sum \left(\frac{X_{i} - \mu}{\sigma}\right)^{2} = \sum \left(\frac{X_{i} - \bar{X}}{\sigma}\right)^{2} + n\left(\frac{\bar{X} - \mu}{\sigma}\right)^{2}.
\end{align*}
From here one can see that 
\begin{align*}
\sum \left(\frac{X_{i} - \bar{X}}{\sigma}\right)^{2} = \frac{1}{\sigma^{2}}X^{\top}\underbrace{\left(I_{n} - \frac{1}{n}1_{n}1_{n}^{\top}\right)}_{=B_1}X,
\end{align*}
where $X = [X_1, \dots ,X_n]^{\top}$. We can see that since $B_{1}$ has rank $n - 1$ and is symmetric positive semidefinite, it can be used by Cochran's theorem to complete the proof. However, I am unsure of how to complete the proof because


*

*Cochran's theorem applies when the $X_{i}$'s above are standard normal, which is not the case here.

*Not sure how to write $n\left(\frac{\bar{X} - \mu}{\sigma}\right)^{2}$ in the form $Z^{\top}B_{2}Z$, where $Z$ is a vector of standard normal random variables and $B_{2}$ is a matrix to be solved.


Asking for a proof expressing $\sum \left(\frac{X_{i} - \mu}{\sigma}\right)^{2}$ as a sum of quadratic forms involving standard normals $Z_1, \dots ,Z_n$ such that Cochran's Theorem can be directly applied to complete the proof? Thanks!
 A: Thanks @StubbornAtom for the comment.
Note that
\begin{align*}
\frac{X_{i} - \bar{X}}{\sigma} &= \frac{X_{i}}{\sigma} - \frac{\mu}{\sigma} - \frac{1}{n\sigma}\sum_{i = 1}^{n}X_{i} + \frac{\mu}{\sigma}\\
&= \frac{X_{i} - \mu}{\sigma} - \frac{1}{n}\sum_{i = 1}^{n}\frac{X_{i} - \mu}{\sigma}\\
&= Z_{i} - \frac{1}{n}\sum_{j = 1}^{n}Z_{j}
\end{align*}
Thus,
\begin{align*}
\sum_{i = 1}^{n}\left(\frac{X_{i} - \bar{X}}{\sigma}\right)^{2} &= \sum_{i = 1}^{n}\left(Z_{i} - \frac{1}{n}\sum_{j = 1}^{n}Z_{j}\right)^{2}\\
&= Z^{\top}\underbrace{\left(I_{n} - \frac{1}{n}1_{n}1_{n}^{\top}\right)}_{=B_1}Z.
\end{align*}
It can be shown that $B_1 \in \mathbb{R}^{n \times n}$ is symmetric positive semidefinite of rank $n - 1$. The matrix $B_1$ is positive semidefinite because a symmetric idempotent matrix only has eigenvalues 1 and 0. Next since
\begin{align*}
\frac{\bar{X} - \mu}{\sigma} &= \frac{1}{n\sigma}\sum_{i = 1}^{n}X_{i} - \frac{\mu}{\sigma} - \frac{\mu}{\sigma} + \frac{\mu}{\sigma}\\
&= \frac{1}{n}\sum_{i = 1}^{n}\frac{X_{i} - \mu}{\sigma} - \left(\frac{\mu - \mu}{\sigma}\right)\\
&= \frac{1}{n}\sum_{i = 1}^{n}Z_{i},
\end{align*}
this leads to
\begin{align*}
n\left(\frac{\bar{X} - \mu}{\sigma}\right)^{2} &= n\left(\frac{1}{n}\sum_{i = 1}^{n}Z_{i}\right)^{2}\\
&=\frac{1}{n}\left(\sum_{i = 1}^{n}Z_{i}\right)^{2}\\
&= Z^{\top}\underbrace{\left(\frac{1}{n}1_{n}1_{n}^{\top}\right)}_{= B_{2}}Z.
\end{align*}
From this point on we can verify that


*

*$B_{1} + B_{2} = I_{n}$

*rank($B_{1}$) + rank($B_{2}$) = $n - 1 + 1 = n$

*$B_{1}$ and $B_{2}$ are positive semidefinite


which by Cochran's Theorem, implies $\sum_{i = 1}^{n}\left(\frac{X_{i} - \bar{X}}{\sigma}\right)^{2} \sim \chi_{n - 1}^{2}$
