2

There are 9 boys and 7 girls sitting around a table. If a boy sits next to a girl we call it a switch. Example: with BBBBBGGGBBGBGGG we have 6 switches. What is the expectation of the number of switches?

As far as I understand, the solution is equivalent to the sum of $G_i$, where $G_i$ is the expected number of girls to sit next to boy number $i$.

$E\left[G_1\right]$ is easy to calculate: the prob. of 2 boys to sit next to him is $\frac{8}{15}\cdot\frac{7}{14}=\frac{4}{15}$, prob. of 2 girls sit next to him is $3/15$, and prob. of 1 girl 1 boy next to him is $8/15$.

Therefore $E\left[G_1\right] = 0\cdot \frac{4}{15} + 2\cdot \frac{3}{15} + 1\cdot \frac{8}{15} = \frac{42}{5}$

If for some reason we can say that $E\left[G_i\right] = E\left[G_1\right]$ then $\sum_i{E\left[G_i\right]} = 9E\left[G_1\right]$ and the problem is solved, but can we indeed assume it? If we can't assume it and $E\left[G_i\right] \neq E\left[G_1\right]$, how can we solve it?

Roee
  • 117
  • 1
    I can't count $6$ switches in the example you have given, only $4; or ;5$ depending on the interpretation, will you clarify ? – true blue anil Jun 02 '22 at 08:28
  • 1
    I believe it's 6 because the table is round, i.e., the string is "cyclic" – Itay Jun 02 '22 at 08:42
  • Just as @Itay said, it's due to the roundness of the table. For boys #1, #5, #6 and #7 you have 1 girl and for the last boy you have 2 girls, so we have a total of 6. – Roee Jun 02 '22 at 09:09
  • The computation for $\mathbf{E}[G_i]$ is precisely the same as what you did for $\mathbf{E}[G_1]$ (which makes sense because there is nothing special about boy #1) , so we have $$\mathbf{E}[G_i]=\mathbf{E}[G_1]=\frac{42}{5}.$$ – Sangchul Lee Jun 04 '22 at 02:14

1 Answers1

1

I'll solve the problem combinatorically. First of all, notice that you have

$$ \frac{1}{16}\frac{16!}{9!7!} = \frac{15!}{9!7!} = 715 $$ possible arrangements. The number of arrangements is equal to the number of $(9, 7)$ necklaces using the notation from this question: How many necklaces are there with a known number of beads of each color?. As $\gcd(9, 7) = 1$, we don't really have to worry about the circularity of the table, because each linear arrangement corresponds to exactly $16$ arrangements around the table. So, let us assume a linear arrangement. Let us call a subsequence consisting only of boys or a subsequence consisting only of girls a "clump". For example, an arrangement $$ BBBBGGBGGGBBBBGG $$ contains exactly $6$ clumps: $BBBB, GG, B, GGG, BBBB, GG$. I will calculate the expected value of switches using clumps. Specifically, I want to calculate the number of sequences containing exactly $k$ clumps for each possible $k$.

We need to consider four cases:

  • the sequence starts with a boy and ends with a boy - we have $m+1$ boy clumps and $m$ girl clumps (for some value of $m$),
  • the sequence starts with a boy and ends with a girl - we have $m$ boy clumps and $m$ girl clumps,
  • the sequence starts with a girl and ends with a boy - we have $m$ girl clumps and $m$ boy clumps,
  • the sequence starts with a girl and ends with a girl - we have $m+1$ girl clumps and $m$ boy clumps.

Notice that the number of switches depends only on the number of clumps - we have $2m$ switches in all of the cases.

Given a case and $m$, we can count the number of arrangments using stars-and-bars constrained to positive values. That is, the number of positive integer solutions to the equation $$ x_1 + x_2 + \dots x_m = n $$ is equal to $\binom{n-1}{m-1}$. Therefore, for example, if we consider the first case and $m$ equal to $3$, we count the cases such as: $$BBBGGGBBGGBBGGBB,$$ that is when we have four clumps of boys and three clumps of girls. Applying stars-and-bars and counting the total number of cases, we get: $$ \sum_{i=0}^6 \binom{6}{i}\Big(\binom{8}{i}+\binom{8}{i+1}\Big) + \binom{8}{i}\Big(\binom{6}{i+1}+\binom{6}{i}\Big) = 11440 = 16\cdot 715, $$ which confirms that we properly divided all the situations into cases. We sum up to $6$, because $7$ is the maximal number of girl clumps, and therefore the maximal value of $m$, and then we have $m-1 = 6$. Finally, to calculate the expected value, we need to calculate: $$ \frac{\sum_{i=0}^6 2(i+1)\Big(\binom{6}{i}\Big(\binom{8}{i}+\binom{8}{i+1}\Big) + \binom{8}{i}\Big(\binom{6}{i+1}+\binom{6}{i}\Big)\Big)}{11440}, $$

To calculate the numerator, we may use the general formulas involving the binomial coefficients: $$ \sum_{i=0}^n (i+1)\binom{n}{i}\binom{m}{i} = \frac{(mn+m+n)(m+n-1)!}{m!n!} $$ $$ \sum_{i=0}^n (i+1)\binom{n}{i}\binom{m}{i+1} = \frac{m(m+n-1)!}{(m-1)!n!} $$ $$ \sum_{i=0}^n (i+1)\binom{n}{i+1}\binom{m}{i} = \frac{n(m+n-1)!}{m!(n-1)!} $$ From this, we get that the numerator is equal to: $$ 2\cdot \Big(8\cdot \frac{13!}{7!6!} + 2\cdot 62 \cdot \frac{13!}{8!6!} + 6\cdot \frac{13!}{8! 5!}\Big) = 96096 $$ This gives us the expected value of the number of switches equal to: $$ \frac{96096}{11440} = \frac{42}{5} $$