variance of sum of non-independent indicator variables

620 Views Asked by At

$n$ red balls and $n$ black balls are mixed uniformly in a row. Let $Y_n$ be the number of times there are two balls of different color right next to each other (so for example in the sequence Red-Black-Red there are 2, and in RRB there is only 1). Compute Expectation and Variance of $Y_n$. What I've done is denote $X_1,\ldots,X_{2n-1}$ as indicator variables that the $i$-th ball is of different color from the $i+1$ ball. Then $E[X_i]= 2\cdot \frac{n}{2n}\cdot \frac{n}{2n-1}= \frac{n}{2n-1}$, and since $Y_n=\sum\limits_{i=1}^{2n-1}X_i$ we get that $E[Y]=n$. This results also "makes sense". I've tried $Var[Y_n] = \sum\limits_{i=1}^{2n-1}\text{Var}[X_i] + 2\cdot\sum\limits_{1\leq i<j\leq 2n-1} \text{Cov}(X_i,X_j)$. This gets complicated because $\text{Cov}(Y_i,Y_{i+1}) \neq \text{Cov}(Y_i,Y_{i+j})$ for $j > 1$. This question was asked in an exam, by a professor who really likes "tricks" and symmetry and such. I highly doubt he expected us to dig into all those details. Is there a simpler way to solve this?