# Proof of the independence of the sample mean and sample variance

I've been trying to establish that the sample mean and the sample variance are independent. One motivation is to try and write the sample variance, $S^{2}$ as a function of $\left\{ X_{2}-\bar{X},X_{3}-\bar{X},\cdots,X_{n}-\bar{X}\right\} =A$ only. Then we proceed by showing that $A$ and $\bar{X}$ are independent (which I'm unable to show), which then implies the independence of $S^{2}$ and $\bar{X}.$

I would appreciate it if the good people of M.SE would help guide me in the right direction.
Thanks.

Edit: The random samples $X_1,\cdots,X_n$ are from an $N(\mu, \sigma)$ distribution.

• No, $A$ and $\bar X$ are not independent in general. Since you seem to be following a book or some lecture notes, you might want to check these again.
– Did
Jun 24, 2011 at 7:07
• I have edited...:)
– Nana
Jun 24, 2011 at 7:24
• Do you know how to check if $(A,\bar{X})$ are jointly Gaussian in your case? The other method is to verify independence using characteristic function.
– Ilya
Jun 24, 2011 at 7:59
• @Gortaur:No, I do not. Could please show me how? thanks.
– Nana
Jun 24, 2011 at 12:27

I guess this is probably a little late, but this result is immediate from Basu's Theorem, provided that you are willing to accept that the family of normal distributions with known variance is complete. To apply Basu, fix $\sigma^2$ and consider the family of $N(\mu, \sigma^2)$ for $\mu \in \mathbb R$. Then $\frac{(n - 1)S^2}{\sigma^2} \sim \chi^2_{n - 1}$ so $S^2$ is ancillary, while $\bar X$ is complete sufficient, and hence they are independent for all $\mu$ and our fixed $\sigma^2$. Since $\sigma^2$ was arbitrary, this completes the proof.

This can also be shown directly without too much hassle. One can find the joint pdf of $(A, \bar X)$ directly by making a suitable transformation to the joint pdf of $(X_1,\cdots, X_n)$. The joint pdf of $(A, \bar X)$ factors as required, which gives independence. To see this quickly, without actually doing the transformation, skipping some algebra we may write

$$f(x_1, x_2, ..., x_n) = (2\pi \sigma^2)^{-n/2} \exp\left\{-\frac{\sum(x_i - \bar x)^2}{2\sigma^2}\right\} \exp\left\{-\frac{n(\bar x - \mu)^2}{2\sigma^2}\right\}$$

and we can see that everything except for the last term depends only on $$(x_2 - \bar x, x_3 - \bar x, ..., x_n - \bar x)$$ (note we may retrieve $x_1 - \bar x$ from only the first $n - 1$ deviations) and the last term depends only on $\bar x$. The transformation is linear, so the jacobian term won't screw this factorization up when we actually pass to the joint pdf of $(A, \bar X)$.

• +1. (Made some minor typographic edits, hope you do not mind.)
– Did
Jul 10, 2011 at 10:08
• Don't mind at all. I always use \[ to get inline equations and was grumpy that I had to use \displaystyle to get what I wanted on this site, so your edit makes me happy; I didn't know about  :) I think I accidentally figured out how to it using braces while typing up this comment too.
– guy
Jul 10, 2011 at 14:44
• @guy: No its never late. Thanks for your nice answer. I wasn't aware of Basu's theorem at that time...:)
– Nana
Jul 10, 2011 at 17:06
• This answer requires knowledge of Basu's theorem, but you certainly don't need that in order to prove this result. Feb 13, 2021 at 4:49

Hint:

1. Show that $A' = (\bar X, A)$ can be writen as $A' = C X$ where $C$ is some square matrix. Deduce from that that $A'$ is jointly gaussian.

2. Recall that independence is equivalent to zero correlation for jointly gaussian variables. Show that $E(A_i \bar X) = 0$. Conclude that $A$ and $\bar X$ are independent.

• I think there is an extra comma sitting in that expectation in (2). Maybe it was originally a covariance that got changed to an expectation since $E(A_i \bar X) = Cov(A_i, \bar X)$? I prefer calculating the covariance, myself.
– guy
Jul 10, 2011 at 14:55
• Fixed. That's the same as the covariance, yes, because $E(A_i)=0$ Jul 10, 2011 at 15:06
• @leonbloy: Thanks for your response.
– Nana
Jul 10, 2011 at 17:10
• @leonbloy This is maybe a little bit too late, but why does the independence of $A$ and $\bar{X}$ imply that $S^2$ and $\bar{X}$ are independent? Jan 30, 2014 at 22:40
• @leonbloy what is the form of $C$ . I have tried a lot but my efforts were futile !
– John
Apr 30, 2019 at 7:23

Here is an alternative matrix approach. By replacing each $$X_i$$ by $$(X_i - \mu)/\sigma$$, we can assume wlog that the $$X$$'s are independent standard normal variables.

Pack $$X_1,\ldots,X_n$$ into an $$n\times 1$$ column vector $$X$$. The idea is to express $$\sum X$$ and $$(X_1-\bar X,\ldots,X_n-\bar X)^T$$ as matrix transformations of $$X$$. This is achieved by taking $$U=(1,\ldots,1)$$, a $$1\times n$$ row vector of ones (so that $$UX=\sum X_i$$), and defining the $$n\times n$$ matrix $$C:=I_n - \frac1n U^TU$$ (so that $$CX$$ has $$i$$th member $$X_i-\bar X$$). Check that $$UX$$ and $$CX$$ each have zero mean. Their covariance is $$E[(UX)(CX)^T]=E(UXX^TC^T)=UC^T=UC=U-\frac1nUU^TU.$$ But $$UU^T=n$$, so the covariance matrix is zero. Since $$UX$$ are $$CX$$ are jointly normal, this implies that they are independent, hence so are $$\bar X$$ and $$S^2$$, which are functions respectively of $$UX$$ and $$CX$$.

Why are $$UX$$ and $$CX$$ jointly normal? The product of a partitioned matrix with $$X$$: $$\begin{pmatrix}U\\\hdashline C\end{pmatrix}X$$ yields a $$(n+1)\times 1$$ multivariate normal vector; $$UX$$ is the first member, and $$CX$$ is the remaining subvector.