# Combinatorics: boy-girl pairs

It is the last problem of the AHSME competition 1988-1989 (question 30)

"Suppose that $7$ boys and $13$ girls line up in a row. Let $S$ be the number of places in the row where a boy and a girl are standing next to each other. For example, for the row $\text{GBBGGGBGBGGGBGBGGBGG}$ we have that $S=12$. The average value of $S$ (if all possible orders of these $20$ people are considered) is closest to

$\text{(A)}\ 9\qquad\text{(B)}\ 10\qquad\text{(C)}\ 11\qquad\text{(D)}\ 12\qquad\text{(E)}\ 13$

(see this link for the source: http://www.artofproblemsolving.com/Wiki/index.php/1989_AHSME_Problems/Problem_30)

I can't find an exact solution, but i know the answer must be A:9 (after having programmed it the exact solution is 91/10)

I'm in the sixth year of secondary school if that gives an idea of my mathematics level. (and i've completed all the AHSME questions from 1985-1986 to 1994-1995 unless this one)

-

Given a fixed $n\in\{1,2,3,...,19\}$, what is the probability that the kids in position $n$ and $n+1$ are different sex?

That is easily computed as $\frac{7\cdot 13+13\cdot7}{20\cdot 19}$.

So the expected number of "boy/girl" or "girl/boy" pairs in position $n$ is $\frac{91}{10\cdot 19}$.

But the expected number of boy/girl pairs across the whole line is just the sum over each $n$. Since there are $19$ values of $n$, it is $19\cdot\frac{91}{10\cdot19}=\frac{91}{10}$.

That you can do this sort of summing of expected values is a bit confusing when the value in each location is not independent. But you can.

-
It's indeed confusing. Can I find somewhere an explanation why we can do this? – wnvl Oct 1 '12 at 21:15
At it's most basic, it is because the expected value of the sum of two random variables is the sum of the expected values. This does not require the variables to be independent, and can be pretty much directly worked out from the definition. – Thomas Andrews Oct 1 '12 at 21:20
What are those two random variables in your reasonning? – wnvl Oct 1 '12 at 21:26
Well, in this case, it generalizes by induction to multiple random variables. In this case, the $X_n$ is $1$ if there is a boy/girl combination in the $n,n+1$ slot and $0$ otherwise. The the expected value, $E(\sum X_n) = \sum E(X_n)$ – Thomas Andrews Oct 1 '12 at 21:28
Thanks, that clarifies the solution. – wnvl Oct 1 '12 at 21:32