# Deriving covariance of sample mean and sample variance

$\newcommand{\cov}{\operatorname{cov}}$I want to find the covariance between the sample mean and the sample variance, I think I am along the right track but am not sure.

Suppose we have i.i.d. random variables $X_1, X_2, \ldots, X_n$.

Define

$$\overline{X} = \frac{1}{n} \sum_{i=1}^n X_i \text{ and } S^2 = \frac{1}{2n(n-1)} \sum_{i=1}^n \sum_{j=1}^n (X_i - X_j)^2$$

I want to find their covariance $\cov(\overline{X}, S^2)$. Here is what I have done:

\begin{align} & \cov(\overline{X}, S^2) = \cov\left(\frac{1}{n}\sum_{i=1}^n X_i, \frac{1}{2n(n-1)} \sum_{i=1}^n\sum_{j=1}^n (X_i - X_j)^2 \right) \\ = {} & \frac{1}{2n^2(n-1)} \sum_{i=1}^n \cov(X_i,\sum_{k=1}^{n}\sum_{j=1}^{n} (X_k - X_j)^2) \\ = {} & \frac{1}{2n^2(n-1)} \sum_{i=1}^n \cov(X_i,2\sum_{k=1}^{n} (X_i - X_k)^2) \end{align}

(because $\cov(X_i, (X_a - X_b)^2)$ is zero if $i$ isn't $a$ or $b$)

$$= \frac{1}{n^2(n-1)} \sum_{i=1}^{n} \sum_{k=1}^n \cov(X_i, (X_i - X_k)^2).$$

Now, I compute $\cov(X_i, (X_i - X_k)^2)$:

for $i = k, \cov(X_i, (X_i - X_k)^2) = 0$

for $i \neq k,$

\begin{align} & \cov(X_i, (X_i - X_k)^2) = \cov(X_i, X_i^2 - 2X_iX_k + X_k^2) = \cov(X_i, X_i^2) - 2\cov(X_i, X_iX_k) \\[8pt] = {} & E(X^3) - E(X)E(X^2) -2E(X)E(X^2) + 2(E(X))^3 \\[8pt] = {} & E(X^3) -3E(X)E(X^2) + 2(E(X))^3. \end{align}

When I plug this in, I do not get the answer that I want which is $E(X-E(X))^3$, can anyone please tell me where I went wrong?

UPDATE: I plugged it in again and it is actually correct! Sorry for being so careless. Thanks to anyone who has read the question. Should I delete this post?

• Does $\operatorname E(X-\operatorname E(X))^3$ mean $(\operatorname E(X-\operatorname E(X)))^3$ or $\operatorname E((X-\operatorname E(X))^3) \text{ ?}$ I would guess the latter, but I prefer being explicit about this. – Michael Hardy Jul 10 '18 at 17:27
• In more conventional notation, $S^2$ often denotes $\displaystyle \frac 1 {n-1} \sum_{i=1}^n \big( X_i -\overline X \,\big)^2.$ I haven't checked whether your notation agrees with that, but can you tell us whether you intended it to be the same thing? $\qquad$ – Michael Hardy Jul 10 '18 at 17:31
• $E(X - E(X))^3$ means $E((X - E(X))^3)$. – Noppawee Apichonpongpan Jul 11 '18 at 3:08
• Yes, my book also uses $S^2 = \frac{1}{n-1} \sum_{i=1}^{n} (X_i - \overline X)^2$, but the first part of the exercise is actually to show that $S^2 = \frac{1}{2n(n-1)} \sum_{i=1}^{n} \sum_{j=1}^{n} (X_i - X_j)^2$, so they are equal. – Noppawee Apichonpongpan Jul 11 '18 at 3:10
• Since they are equal, why not use the simpler form? – Michael Hardy Jul 11 '18 at 6:36

## 1 Answer

I hope this will help you to find a mistake.

https://www.tandfonline.com/doi/pdf/10.1198/000313007X188379

• It's behind a pay wall...? – Noppawee Apichonpongpan Jul 10 '18 at 14:29
• I suggest you to check the result for $Cov(X_{i},X_{i}X_{k})$. – Mr.M Jul 10 '18 at 14:38
• $Cov(X_i, X_i X_k) = E(X_i^2 X_k) - E(X_i)E(X_i X_k) = E(X_i^2)E(X_k) - (E(X_i))^2E(X_k) = E(X^2)E(X) - (E(X))^3$ – Noppawee Apichonpongpan Jul 10 '18 at 14:54
• Is that not correct? – Noppawee Apichonpongpan Jul 10 '18 at 14:56