Indicator linearity

FreeCombinatoricsEasyJane StreetCitadelSIG

A class contains 15 boys and 10 girls. The students line up in a row uniformly at random. What is the expected number of adjacent boy-girl pairs? For example, the lineup BGBBGGGBGGBBBBGBGBBGBBGBBBGBBGGGBGGBBBBGBGBBGBBGBB has 14 such adjacent pairs.

Solution

We have 15 boys and 10 girls, totaling 25 students. The students line up uniformly at random. We want the expected number of adjacent positions where one is a boy and the other is a girl (order BG or GB).

Let XX be the number of adjacent boy-girl pairs. For each adjacent pair of positions (i,i+1)(i, i+1) with i=1,,24i = 1,\dots,24, define an indicator IiI_i that the two students at those positions are of opposite sexes. Then X=i=124IiX = \sum_{i=1}^{24} I_i, and by linearity of expectation,

E[X]=i=124E[Ii]=i=124Pr(positions i and i+1 are opposite sexes).\mathbb{E}[X] = \sum_{i=1}^{24} \mathbb{E}[I_i] = \sum_{i=1}^{24} \Pr(\text{positions } i \text{ and } i+1 \text{ are opposite sexes}).

By symmetry, the probability is the same for every adjacent pair; denote it by pp. Hence E[X]=24p\mathbb{E}[X] = 24 \cdot p.

Now compute pp. There are 25×2425 \times 24 equally likely ordered assignments of two distinct students to the two positions. Favorable cases are (boy, girl) and (girl, boy). There are 15×10=15015 \times 10 = 150 ways to choose a boy then a girl, and 10×15=15010 \times 15 = 150 ways to choose a girl then a boy, for a total of 300300 favorable ordered pairs. Thus

p=30025×24=300600=12.p = \frac{300}{25 \times 24} = \frac{300}{600} = \frac{1}{2}.

Alternatively, Pr(boy then girl)=15251024=14\Pr(\text{boy then girl}) = \frac{15}{25} \cdot \frac{10}{24} = \frac{1}{4}, and Pr(girl then boy)=10251524=14\Pr(\text{girl then boy}) = \frac{10}{25} \cdot \frac{15}{24} = \frac{1}{4}, so p=14+14=12p = \frac{1}{4} + \frac{1}{4} = \frac{1}{2}.

Therefore,

E[X]=2412=12.\mathbb{E}[X] = 24 \cdot \frac{1}{2} = 12.

Related problems