Probability Question + Code

In how many ways can 4 men and 4 women be arranged around a table if all the men are in pairs separated by two pairs of women?

Assuming we have a circular table, where positions don’t matter, then we can see that we must have two pairs of men and two pairs of women.  Let’s fix the position of one of the women, Amy.

There are 3! ways of arranging the women around Amy, and 4! ways of arranging the men.  But Amy could be to the left or the right of a woman.  That means the number of ways is 2 × 3! × 4! = 288.

Now, to prove this, we can run a simple experiment.  First, note that if we shuffle 4 men and 4 women around a circular table, we have 7! ways of arranging the people (we fix Amy leaving 7 others to arrange).  Therefore, the theoretical probability of randomly achieving our scenario is 288 ÷ 7! = 2/35.

Now we can randomly shuffle our people a few thousand times, and see if the experimental probability matches our theoretical: