# Expected value using indicator variable

Suppose that $$8$$ white balls and $$2$$ black balls will be randomly ordered, from left to right (with all permutations of the $$10$$ balls equally likely), what is the expected value of the number of balls that will be between the two black balls ?

I gave it a shot and this is where I am stuck.

If $$E$$ denotes the event that at least one one white ball in between the two black balls, then

$$P(E) = 1- P(E^c)$$

$$P(E) = 1- \frac{(2) (9!)}{10!}$$

which gives $$P(E)$$ to be equal to $$0.8$$

I am not sure how to define the Indicator function with this information, that would lead me to answer the question.

Asociate an indicator variable ,$$X_i$$, to each white ball such that they take value $$1$$ if it lies between the two black balls. Then with this formulation, the number of balls between the two black balls will be equal to the sum of $$X_i$$.

Hence, to solve the problem, we just have to consider the probability that a white ball is between the two black balls. For each white ball, it has $$3$$ equally likely option. It can be on the left of both black balls, on the right of both black balls, or between the two black balls.

Hence, $$E\left[\sum_{i=1}^8X_i\right]=\sum_{i=1}^8P(X_i=1)=\frac83$$