My goal is to calculate $\operatorname{Cov}(X,Y)$, but I'm struggling to calculate $E[XY]$

71 Views Asked by At

Regarding the following problem:

A fair coin is tossed 5 times. Let $X$ be the number of heads in all $5$ tosses, and $Y$ be the number of heads in the first $4$ tosses. What is $\operatorname{Cov}(X,Y)$?

My attempt:

I know that I should calculate the following: $$ \operatorname{Cov}(X,Y) = E[XY]-E[X]E[Y]$$

Well, the right flank is pretty easy: $E[X]=2.5, E[Y]=2 $

But what about $E[XY]$?

I searched online and saw that:

$$ E[XY]=\sum_{x}\sum_{y}xyP(X=x, Y=y) $$

But any attempt to imply that in the problem only led me for further more confusion.

Thanks in advance.

2

There are 2 best solutions below

2
On BEST ANSWER

Here's a way to do it without messy arithmetic. Let $T_i$ be the result of the $i$'th toss ($0$ if tails, $1$ if heads). These are independent, with $X = T_1 + \ldots + T_5$ and $Y = T_1 + \ldots + T_4$. Then $$\text{Cov}(X,Y) = \text{Cov}(Y+T_5, Y) = \text{Cov}(Y,Y) + \text{Cov}(T_5,Y) = \text{Cov}(Y,Y) = \text{Var}(Y)$$ Now since $T_1, \ldots, T_4$ are independent, $$\text{Var}(Y) = \text{Var}(T_1) + \ldots + \text{Var}(T_4) = 4 \text{Var}(T_1)$$ and $\text{Var}(T_1)$ is easy to find...

5
On

$X$ can assume the values $0,1,2,3,4,5$ and $Y$ can assume the values $0,1,2,3,4$. One of the terms in the sum, for example, is $$5\cdot 4\cdot P(X=5,Y=4)=5\cdot 4\cdot \frac{1}{2^{5}} $$

The rest of the terms are computed similarly. Note that you'll want to use $$P(X=x,Y=y)=P(Y=y)\cdot P(X=x|Y=y)$$ A helpful observation: $P(X=x,Y=y)=0$ if $x<y$ (since we cannot have more heads in the first $4$ tosses than in all $5$), so many of the terms in the sum are $0$.