[Math] Combinatorics – how many ways for 10 people to make a line with restrictions

combinatoricsprobability

I'm self-studying for a probability and statistics course and ran into a problem with this practice exercise:

Persons A and B make a random line with 8 other people. What is the probability that there are at most 2 people between A and B?

I tried to first calculate separately the probabilities for the cases of no-one between A and B, 1 person between A and B, and 2 people between A and B. However I must be doing something wrong with calculating the number of favorable cases because all I'm getting is astronomically low odds. Here's my attempt for the first two cases:

With no-one between A and B we can choose their places in $2*1+8*2 = 18$ ways, because if A is at either end of the line we only have 1 possible place for B. If A is not at an end of the line we have 8 possible places for A and 2 for B. Then the probability is $\frac{18}{10!} \approx 4.6*10^-6$. ($10!$ is the total amount of possible lines).

For the case with 1 person between A and B we can choose that person in 8 ways. We can choose the arrangement of A and B around this person in 2 ways. Then we can choose the position of this 3-person line in the 10-person line in 8 ways. So the probability is $\frac{8*2*8}{10!} \approx 3.5*10^-5$

Looking forward to your ideas and explanations.

Best Answer

(0) If there is nobody between A and B, so AB can be block (one person). And now we have to arrange 9 person to 9 places. So it is $9!\times2$, where to need times two because of block can be either AB or BA.

(1) If there is one person between. Then we need a block which consists of three persons. A_B, where the middle person can be chosen in exactly $8$ ways. So we have to place one block and 7 other people $\implies$ we need to place $8$ people. In the end $8!\times2\times8$ - the ways to arrange them, with one person between.

(2) If there are two persons between. Block consists of $4$ people: A_ _B. Middle persons can be chosen in $8\times7$ ways. So we need to place $7$ persons. $7!\times2\times8\times7=8!\times2\times7.$

Overall There are $10!$ ways to place 10 people.

So, the result is to sum $(0),(1), (2)$ and divide by $Overall$.

$$\frac{2\times9!+2\times8\times8!+8!\times2\times7}{10!}=\frac{24}{45}.$$

Related Question