variance of sum of non-independent indicator variables

$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?

• You have spot the key and the situation is not too bad if you try. For consecutive indicators, they have a overlapping ball so it is different from other case. Note $Cov[X_i, X_j] = E[X_iX_j] - E[X_i]E[X_j]$. So the remaining task is to compute the cross moment. For overlapping case, you only need to consider probability of having the sequence $RBR$ and $BRB$ in the $3$ balls-position (which is the only two cases that $X_iX_{i+1} = 1$). For other case, you put $BR$ in one place and put another $BR$ in other position, order is not important. – BGM Mar 9 '18 at 17:22