TITLE: How can I show that $X$ and $Y$ are independent and find the distribution of $Y$?
QUESTION [10 upvotes]: $X_1,X_2,\dots,X_n$ is an i.i.d. sequence of standard Gaussian random variables. 
\begin{align}X&=\frac{1}{n}(X_1+X_2+\dots+X_n) \\[0.2cm] Y&=(X_1-X)^2+(X_2-X)^2+\dots+(X_n-X)^2\end{align}

How can I show that $X$ and $Y$ are independent?
How can I find the distribution of $Y$?

Can we use the following method to show that $X$ and $Y$ are independent?
$$Cov(X,Y)=0$$
Or is there any other proper way?

REPLY [2 votes]: Partial solution here.
$Y$ is a quadratic form. In particular, let $\mathbf{1} \in \mathbb{R}^n$ be a vector of ones, and define $$P_\mathbf{1} = \mathbf{1}\left(\mathbf{1}^{T}\mathbf{1}\right)^{-1}\mathbf{1}^{T} = \mathbf{1}\left(\dfrac{1}{n}\right)\mathbf{1}^{T}\text{.}$$
Let $$\mathbf{X}=\begin{bmatrix}
X_1 \\
X_2 \\
\vdots\\
X_n
\end{bmatrix}\text{.}$$
Then $$P_\mathbf{1}\mathbf{X} = \mathbf{1}\left(\dfrac{1}{n}\right)\begin{bmatrix}
1 & 1 & \cdots & 1
\end{bmatrix}\begin{bmatrix}
X_1 \\
X_2 \\
\vdots\\
X_n
\end{bmatrix} = \mathbf{1}\left(\dfrac{1}{n}\right)\sum_{i=1}^{n}X_i = \mathbf{1}X = X\mathbf{1}\text{.}$$
Furthermore,
$$\begin{align}
Y &= \sum_{i=1}^{n}(X_i-X)^2 \\
&= (\mathbf{X}-X\mathbf{1})^{T}(\mathbf{X}-X\mathbf{1}) \\
&= (\mathbf{X}-P_\mathbf{1}\mathbf{X})^{T}(\mathbf{x}-P_\mathbf{1}\mathbf{X}) \\
&= [(\mathbf{I}-P_{\mathbf{1}})\mathbf{X}]^{T}(\mathbf{I}-P_{\mathbf{1}})\mathbf{X} \\
&= \mathbf{X}^{T}(\mathbf{I}-P_{\mathbf{1}})^{T}(\mathbf{I}-P_{\mathbf{1}})\mathbf{X}\text{.}
\end{align}$$
$\mathbf{I}$ is obviously symmetric, and notice
$$P_{\mathbf{1}}^{T} = \left[\mathbf{1}\left(\dfrac{1}{n}\right)\mathbf{1}^{T}\right]^{T} = \mathbf{1}\left(\dfrac{1}{n}\right)\mathbf{1}^{T} = P_{\mathbf{1}}$$
so hence $P_{\mathbf{1}}$ is symmetric, so that $\mathbf{I}-P_{\mathbf{1}}$ is symmetric as well, and 
$$(\mathbf{I}-P_{\mathbf{1}})^{T} = \mathbf{I}-P_{\mathbf{1}}\text{.}$$
This gives $Y = \mathbf{X}^{T}(\mathbf{I}-P_{\mathbf{1}})^{2}\mathbf{X}$. Observe also that
$$P_\mathbf{1}^2 = \left(\mathbf{1}\left(\dfrac{1}{n}\right)\mathbf{1}^{T}\right)^2 = \mathbf{1}\left(\dfrac{1}{n}\right)\mathbf{1}^{T}\mathbf{1}\left(\dfrac{1}{n}\right)\mathbf{1}^{T} = \mathbf{1}\left(\dfrac{n}{n}\right)\left(\dfrac{1}{n}\right)\mathbf{1}^{T} = \mathbf{1}\left(\dfrac{1}{n}\right)\mathbf{1}^{T} = P_{\mathbf{1}}$$
hence $P_{\mathbf{1}}$ is idempotent. Notice
$$(\mathbf{I}-P_{\mathbf{1}})^{2} = \mathbf{I}^2-2\mathbf{I}P_{\mathbf{1}}+P_{\mathbf{1}}^2 = \mathbf{I}-2P_{\mathbf{1}}+P_{\mathbf{1}} = \mathbf{I}-P_{\mathbf{1}}$$
since $P_{\mathbf{1}}^2 = P_{\mathbf{1}}$, as shown earlier. Hence $Y = \mathbf{X}^{T}(\mathbf{I}-P_{\mathbf{1}})\mathbf{X}$.
It can be shown that the rank of $\mathbf{I}-P_{\mathbf{1}}$ is $n - 1$. Using the theorem 7 here (p. 29), you can show that $$Y \sim \sigma^2\chi^2_{n-1}(\boldsymbol{\mu}^{\prime}(\mathbf{I}-P_{\mathbf{1}})\boldsymbol{\mu}^{\prime})$$
If
$$Q = \left(\mathbf{1}^{T}\mathbf{1}\right)^{-1}\mathbf{1}^{T} = \left(\dfrac{1}{n}\right)\mathbf{1}^{T}\text{.}$$
then $X = Q\mathbf{X}$. 
For the remainder of the proof, see this page, under "Examples."