Indicator linearity
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 has 14 such adjacent pairs.
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 be the number of adjacent boy-girl pairs. For each adjacent pair of positions with , define an indicator that the two students at those positions are of opposite sexes. Then , and by linearity of expectation,
By symmetry, the probability is the same for every adjacent pair; denote it by . Hence .
Now compute . There are equally likely ordered assignments of two distinct students to the two positions. Favorable cases are (boy, girl) and (girl, boy). There are ways to choose a boy then a girl, and ways to choose a girl then a boy, for a total of favorable ordered pairs. Thus
Alternatively, , and , so .
Therefore,