Variance of the number of balls between two specified balls Question:
Assume we have 100 different balls numbered from 1 to 100, distributed in 100 different bins, each bin has 1 ball in it.
What is the variance of the number of balls in between ball #1 and ball #2?
What I did:
I defined $X_i$ as an indicator for ball $i$ - "Is it in between balls 1 and 2?" Also I thought of the question as this problem: "We have actually just 3 places to put the 98 remaining balls: before, after and between balls #1,2, so for each ball there is a probability of 1/3 to be in between. So by this we have $E[X_i]= $$1 \over 3$ . Now $X=\sum _{i=1} ^{98} X_i$. Since $X_i$ is a Bernoulli RV then: $V(X_i)=p(1-p)=$$2 \over 9$.
But I know that the correct answer is 549 $8 \over 9$. I know that I should somehow use the formula to the sum of variances, but somehow I don't get to the correct answer.

Denote the number of balls and the the number of bins by $b$. Suppose the first ball lands in bin $X_1$ and second ball lands in the bin $X_2$. The number of balls that will land in between them equals $Z = |X_2 -X_1| - 1$. Clearly
$$
   \Pr\left( X_1 = m_1, X_2 = m_2 \right) = \frac{1}{b\cdot (b-1)} [ m_1 \not= m_2 ]
$$
Thus:
$$\begin{eqnarray}
   \Pr\left(Z = n\right)&=&\sum_{m_1}^b \sum_{m_2=1}^b \frac{1}{b(b-1)} [ m_1 \not=m_2, |m_1-m_2|=n+1] \\ &=& \sum_{m_1}^b \sum_{m_2=1}^b \frac{2}{b(b-1)} [ m_1  > m_2, m_1=n+1+m_2] \\
 &=& \frac{b-n-1}{\binom{b}{2}} [ 0 \leqslant n < b-1 ]
\end{eqnarray}
$$
With this it is straightforward to find:
$$
   \mathbb{E}\left(Z\right) = \sum_{n=0}^{b-2} n \frac{b-n-1}{\binom{b}{2}} = \frac{b-2}{3}
$$
$$
   \mathbb{E}\left(Z^2\right) = \sum_{n=0}^{b-2} n^2 \frac{b-n-1}{\binom{b}{2}} = \frac{(b-2)(b-1)}{6}
$$
Thus the variance reads:
$$
   \mathbb{Var}(Z) =\mathbb{E}(Z^2) - \mathbb{E}(Z)^2 = \frac{(b+1)(b-2)}{18} = 549 \frac{8}{9}
$$
