Compute Cov(X,Y) while X is the number of 1's and Y is the number of 2's in n dice rolls

16.1k Views Asked by At

Let $X$ be the number of 1's and $Y$ be the number of 2's that occur in $n$ rolls of a fair die. Compute $Cov(X,Y)$.

What's wrong with my solution?

Here it is:

$Cov(X,Y)=E[XY]-E[X]E[Y]$

Compute $E[X]$ as follows:

$E[X]=1*{n\choose 1}*\frac{1}{6}*(\frac{5}{6})^{n-1}+2*{n\choose 2}*\frac{1}{6^{2}}*(\frac{5}{6})^{n-2}+...+n*{n\choose n}*\frac{1}{6^{n}}$

This is binomial distribution so $$E[X]=np=\frac{n}{6}$$ There's no difference between $E[X]$ and $E[Y]$ so $$E[X]=E[Y]$$

I believe all's correct so far. My problem is in computing $E[XY]$. This is what i've done:

$E[XY]$ is the number of times we got 1 and 2 at the same time. Which is impossible. Hence $$E[XY]=0$$ Finally we can say $$Cov(X,Y)=0-\frac{n^2}{36}=-\frac{n^2}{36}$$

I found in some website that they got a final answer of $\frac{n}{36}$ because they divided the problem into 2 parts: (1) $X$ and $Y$ are dependent , (2) $X$ and $Y$ are independent. When they're independent $Cov(X,Y)=0$ , and when they're dependent $E[XY]=0$ and thus for roll $i$: $$Cov(X,Y)=E[X_i Y_i]-E[X_i]E[Y_i]=0-\frac{1}{36}=-\frac{1}{36}$$ And consequently: $$Cov(X,Y)=\sum_{i=1}^{n}\sum_{j=1}^{n}{Cov(X_i Y_j)}=\sum_{i=1}^{n}{Cov(X_i Y_i)}=-\frac{n}{36}$$ I mainly don't understand why the 2 sums turned into 1 sum. I think it should be $n$ times the answer.

edit(after considering @blf's answer):

So i guess: $$E[XY]=2\sum_{i=1}^{n}\sum_{j=i}^{n-i}i*j*{n\choose i}{n-i\choose j}*\frac{1}{6^{i}}*\frac{1}{6^j}*(\frac{4}{6})^{n-i-j}$$ $$-\sum_{i=1}^{n}i*i*{n\choose i}{n-i\choose i}*\frac{1}{6^{i}}*\frac{1}{6^i}*(\frac{4}{6})^{n-2i}$$ (I substract that last value because i counted the cases $i=j$ twice.)

So if this is correct, i have no clue how to compute that. Help?

2

There are 2 best solutions below

6
On BEST ANSWER

For your mistake see the answer of blf.

Define for $i=1,...,n$ the random variables $X_{i}$ by: $X_{i}=1$ if at the $i$-th roll number $1$ occurs an $0$ otherwise.

Likewise define the $Y_{i}$ when it concerns number $2$.

Then:

$X=X_{1}+...+X_{n}$ and $Y=Y_{1}+...+Y_{n}$ leading to $XY=\sum _i\sum_jX_{i}Y_{j}$ and $EXY=\sum _i\sum_jEX_{i}Y_{j}$.

Here $X_{i}Y_{j}=0$ if $i=j$ and $EX_{i}Y_{j}=\frac{1}{36}$ if $i\neq j$.

addendum

This leads to:

$EXY=\frac{n\left(n-1\right)}{36}$ and (since $EX=EY=\frac{n}{6}$):

$\text{Cov}\left(X,Y\right)=\frac{n\left(n-1\right)}{36}-\frac{n^{2}}{36}=-\frac{n}{36}$.

Saying that $\text{Cov}\left(X,Y\right)=\sum_{i=1}^{n}\sum_{j=1}^{n}\text{Cov}\left(X_{i},Y_{j}\right)$ is correct and leads to the same answer $-\frac{n}{36}$

1
On

Hint (where you made a mistake):

Suppose I roll the dice 10 times, and I get three 1's and four 2's. Then $X=3$ and $Y=4$, so $XY=12$. In particular, $E[XY]$ is not the number of times that we get $1$ and $2$ at the same time. It's just the expected value of the product of $X$ and $Y$.

$$E[XY] = \sum_x\sum_y xy \cdot P(X=x, Y=y)$$