Arrange at random $10$ students consisting of $2$ students from class A, $3$ students from class B, and $5$ students from class C into a horizontal line. What is the probability that no $2$ students from any class stand right next to each other?
There is no verified answer to this problem, but the following is my attempt. I hope to know if my solution is correct and if a better solution exists as my approach does not seem to generalize well when the numbers are large.
Originally, I thought about considering unfavorable outcomes occurring in each class, each pair of class, and in all classes. For each case, I would consider the students standing next to each other as one single student. I soon realized that arranging the other students can also cause those from the same class to be adjacent to each other, and the approach became untractable.
I eventually came up with this somewhat spontaneous solution:
Line up the students from class C first:
[C] [C] [C] [C] [C]
Then distribute students from class B into this line so that they would separate the students from class C in their ability and they themselves do not stand next to each other.
E.g. (We have two types of arrangement)
(1): [B] [C] [B] [C] [C] [B] [C] [C] $\to$ At least one [B] is outside of the original boundaries created by [C]'s.
(2): [C] [B] [C] [B] [C] [B] [C] [C] $\to$ All [B]'s are inside the original boundaries created by [C]'s.
Now distribute students from class A.
First, let's consider the case when [A] can stand next to [B]. This is not possible in arrangement (1) since as soon as we let one [A] stand next to a [B], we have only one [A] left, but there are still two "unfilled gaps" between [C]'s.
On the other hand, in arrangement (2), if we let one [A] stand next to [B], the other [A] must go to fill the remaining gap between [C]'s.
So for the case when [A] can stand next to [B], [B] must be inside the boundaries created by [C]'s, and only one [A] can stand next to [B], while the other [A] goes to fill the remaining gap between [C]'s. The number of ways this can happen:
- Arrange the 5 [C]'s and shuffle their positions: $5!$
- Select 3 gaps among 4 gaps between [C]'s to distribute 3 [B]'s: $\dbinom{4}{3}$
- Shuffle the 3 [C]'s: $3!$
- Select 1 among 3 [B]'s to let an [A] stand next to: $3$
- This [A] could stand either in front of or behind the [B]: $2$
- Shuffle the [A]'s together: $2!$
Total: $S_1 = 5! \cdot \dbinom{4}{3} \cdot 3! \cdot 3 \cdot 2 \cdot 2!$
Second, let's consider the case when no [A] and [B] stand next to each other. In arrangement (1), we have 2 gaps between [C]'s, so the 2 [A]'s must help fill these gaps. Thus, there is only one possible pair of places for the 2 [A]'s (before shuffling their positions).
In arrangement (2), we have only one "unfilled gap" between [C]'s, so we could distribute one [A] to this gap, and the other [A] could go to the very end of the line or the beginning. Thu, there is two possible pair of places for the 2 [A]'s.
$S_2 = 5! \cdot 3! \cdot 2! \cdot [2 \cdot \dbinom{4}{2} \cdot 1 + \dbinom{4}{3}\cdot 2]$
So the probability that no 2 students from any class stand right next to each other is:
$$P = \dfrac{S_1 + S_2}{10!} = \dfrac{11}{630}$$