Three teams from the English premier league have reached the last season’s (2021-22) champions league last eight. But strangely, they avoided each other in the knockouts. The draw for the quarter-final is determined by picking names, at random, in a bowl containing all eight. The first plays with the second, third with the fourth etc. So, how likely are the three EPL teams to avoid each other in the lot?
The simplest way is to run the lot a million times and estimate the average time it happened. Let’s do that in R.
team <- c("E1", "E2", "E3", "R4", "R5", "R6", "R7", "R8")
itr <- 1000000
draw <- replicate(itr, {
dr <- sample(team, 8, replace = FALSE)
dr1 <- paste(dr[1], dr[2])
dr2 <- paste(dr[3], dr[4])
dr3 <- paste(dr[5], dr[6])
dr4 <- paste(dr[7], dr[8])
dr_all <- c(str_count(dr1, "E"), str_count(dr2, "E"), str_count(dr3, "E"), str_count(dr4, "E"))
if(any(dr_all == 2)){
counter <- 1
}else{
counter <- 0
}
})
P_avoid <- 1 - mean(draw)
P_avoid
The answer turned out to be around 57%.
The next step is to solve this problem analytically. The number of ways to form the first pair is estimated using combinations formula 8C2. For the second group, it is 6C2, the third is 4C2, and the last is 2C2 or 1. This gives a total number = 8C2.x 6C2 x 4C2, of which 4! are the same, as the order of arrangement doesn’t matter. So, after correcting, it becomes 8C2.x 6C2 x 4C2 / 4! = 105
choose(8,2)* choose(6 ,2)*choose(4,2)/ factorial(4)
Now, calculate the number of ways the three English can pair with the other five. For the first team, it’s 5 ways; for the second team, it’s 4; for the third, it’s 3. So total = 5 x 4 x 3 = 60. The probability to avoid = 60/105 = 0.57 or 57%.