# [SOLVED] 2 questions

• Apr 21st 2009, 11:08 PM
noob mathematician
[SOLVED] 2 questions
Let X be the number of 1's and Y the number of 2's that occur in n rolls of a fair die. Compute Cov(X,Y).

Do I use $\displaystyle Cov(X, Y)= E[XY] -E[X]E[Y]$?

A fair die is rolled. Let X and Y denote, respectively, the number of rolls necessary to obtain a 6 and a 5. Find E[X|Y=5].
• Apr 22nd 2009, 12:10 AM
Moo
Hello,
Quote:

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

Do I use $\displaystyle Cov(X, Y)= E[XY] -E[X]E[Y]$?

Why not ?
You can compute E[X] and E[Y] I guess ^^ (same binomial distributions)
$\displaystyle \mathbb{E}(XY)=\sum_{k=0}^n\sum_{l=0}^n k \cdot l \cdot \mathbb{P}(X=k,Y=l)=\sum_{k=0}^n\sum_{l=0}^n k \cdot l \cdot \mathbb{P}(Y=l|X=k)\mathbb{P}(X=k)$
$\displaystyle =\sum_{k=0}^n k \cdot \mathbb{P}(X=k) \sum_{l=0}^n l \cdot \mathbb{P}(Y=l|X=k)$

For the distribution $\displaystyle \mathbb{P}(Y=l|X=k)$, note that it's equivalent to saying "what is the probability to get l 2's, while there already had k 1's ?
You can also see that l can get values only between 0 and n-k.
And that it follows a binomial distribution (n-k,1/5) ~ Z

So we actually have :
$\displaystyle \mathbb{E}(XY)=\sum_{k=0}^n k \cdot \mathbb{P}(X=k) \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)$

But $\displaystyle \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)$ looks like a lot $\displaystyle \mathbb{E}(Z)$, doesn't it ? :D

Can you try to do this ?
• Apr 22nd 2009, 08:12 AM
noob mathematician
Quote:

Originally Posted by Moo
Hello,

Why not ?
You can compute E[X] and E[Y] I guess ^^ (same binomial distributions)
$\displaystyle \mathbb{E}(XY)=\sum_{k=0}^n\sum_{l=0}^n k \cdot l \cdot \mathbb{P}(X=k,Y=l)=\sum_{k=0}^n\sum_{l=0}^n k \cdot l \cdot \mathbb{P}(Y=l|X=k)\mathbb{P}(X=k)$
$\displaystyle =\sum_{k=0}^n k \cdot \mathbb{P}(X=k) \sum_{l=0}^n l \cdot \mathbb{P}(Y=l|X=k)$

For the distribution $\displaystyle \mathbb{P}(Y=l|X=k)$, note that it's equivalent to saying "what is the probability to get l 2's, while there already had k 1's ?
You can also see that l can get values only between 0 and n-k.
And that it follows a binomial distribution (n-k,1/5) ~ Z

So we actually have :
$\displaystyle \mathbb{E}(XY)=\sum_{k=0}^n k \cdot \mathbb{P}(X=k) \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)$

But $\displaystyle \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)$ looks like a lot $\displaystyle \mathbb{E}(Z)$, doesn't it ? :D

Can you try to do this ?

I have some doubt again..

So $\displaystyle E[X]=E[Y]=\frac{n}{6}$
Then from your equation $\displaystyle \sum_{k=0}^n k \cdot \mathbb{P}(X=k)=E[X]=\frac{n}{6}$ too..
However I'm stuck with $\displaystyle \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)$, especially the (n-k) part

By the way the answer is $\displaystyle -\frac{n}{36}$, so it must imply that $\displaystyle \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)=\frac{n-1}{6}$

But how do I obtain it?
• Apr 22nd 2009, 10:48 AM
Moo
Quote:

Originally Posted by noob mathematician
So $\displaystyle E[X]=E[Y]=\frac{n}{6}$
Then from your equation $\displaystyle \sum_{k=0}^n k \cdot \mathbb{P}(X=k)=E[X]=\frac{n}{6}$ too..

Yes, but the sum isn't exactly this !
There is the sum $\displaystyle \sum_{l=0}^{n-k}\dots$, which depends on k, so you can't just calculate the two sums separately.

I'm sorry I should've added brackets :

$\displaystyle \sum_{k=0}^n \left(k \cdot \mathbb{P}(X=k) \cdot \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)\right)$
Quote:

However I'm stuck with $\displaystyle \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)$, especially the (n-k) part
Actually, do you understand why $\displaystyle \mathbb{P}(Y=l|X=k)=\mathbb{P}(Z=l)$, where Z follows a binomial distribution (n-k,1/5) ?
Do it with words : P(Y=l|X=k) is the probability that there are l 2's, while there are k 1's, among n numbers. So it means that there already have k 1's, leaving us with n-k 'undefined' numbers.
But, there can't be any 1's left in these n-k, since they're included in the k numbers (X=k is the total of 1's among the n numbers). So there are 5 remaining possibilities : {2,3,4,5,6}
Thus, P(Y=l|X=k) is equal to P(Z=l), where Z follows a binomial distribution (n-k,1/5)

Does it look better this way ? (Worried)

Now the sum :
$\displaystyle \sum_{l=0}^{n-k} l \cdot \mathbb{P}(Z=l)=\mathbb{E}(Z)=\frac{n-k}{5}$

Then you're left with :
$\displaystyle \mathbb{E}(XY)=\sum_{k=0}^n k \cdot \mathbb{P}(X=k) \cdot \frac{n-k}{5}=\frac 15 \left(n \sum_{k=0}^n k \cdot \mathbb{P}(X=k)-\sum_{k=0}^n k^2 \cdot \mathbb{P}(X=k)\right)$

But $\displaystyle \sum_{k=0}^n k \cdot \mathbb{P}(X=k)=\mathbb{E}(X)=\frac n6$

And $\displaystyle \sum_{k=0}^n k^2 \cdot \mathbb{P}(X=k)=\mathbb{E}(X^2)=Var(X)+[\mathbb{E}(X)]^2=n \cdot \frac 16 \cdot \frac 56+\frac{n^2}{36}=\frac{n^2+5n}{36}$

Finally, $\displaystyle \mathbb{E}(XY)=\frac 15 \left(\frac{n^2}{6}-\frac{n^2+5n}{36}\right)=\frac 15 \cdot \frac{5n^2-5n}{36}=\frac{n^2-n}{36}$

And you get the desired result ;)