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.
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...