Coin Flip Covariance

393 Views Asked by At

You flip a coin 2n times. The probability the coin shows heads is $p$, where $0<p<1$. Let $X$ be the number of times you see heads in the first $n$ flips, and let $Y$ be the number of times you see heads in flips $2,3,4,....n,n+1$. Compute $Cov(X,Y)$.

So I attached the solution but there is one part that is confusing me. How did we get from the second line to the $(n-1)(n-2)...$ line to the last line. The first few steps make sense to me but after that I don't understand what happened.enter image description here

1

There are 1 best solutions below

0
On

I agree with the first line of the solution, and the final result. The intermediate steps are messed up.

The double summation $\sum_{i=2}^{n+1}\sum_{j=1}^{n}$ has one set of indices running from $1$ to $n$ and the other set running from $2$ to $n+1$, making a total of $n^2$ pairs of $(i,j)$. Plot the $(i,j)$ pairs as points in the plane. Here's how it looks for $n=4$ (I've plotted $j$ on the horizontal axis, and $i$ on the vertical).

You'll see that $n-1$ points lie on the diagonal $i=j$ (colored red in the diagram) and the remaining $n^2-(n-1)$ lie off the diagonal. You should break up the double sum according to whether $i=j$ or not, because $\operatorname{Cov}(X_i,X_j)=\operatorname{Var}(X_i)$ when $i=j$. Since all pairs $(X_i,X_j)$ have the same distribution as $(X_1,X_2)$, the double sum can be written $$[n^2-(n-1)]\operatorname{Cov}(X_1,X_2)+ (n-1)\operatorname{Var}(X_1). $$ Now substitute $\operatorname{Cov}(X_1,X_2)=0$ (by independence) and $\operatorname{Var}(X_1)=p-p^2$. The final result is $(n-1)p(1-p)$.