Probability of match in three elements choosing from a group

55 Views Asked by At

One of my teachers asked all 26 ($t$) of the students in our class to randomly choose 5 ($k$) exercises from a website from a set of 20 ($n$). He then said that no two students in the class should have 3 ($s$) or more of the same exercises solved. I want to know the probability of two students in the class having 3 ($s$) of the same exercises solved. I know if $s$ was equal to $k$, it would be the same as the birthday problem with ($n$ choose $k$) days and a room of $t$, but what about the other case of $s<k$?

1

There are 1 best solutions below

2
On

Too long for a comment:

Looking at this again, I am now convinced that the probability of satisfying the teacher's conditions is extremely small, and might even be $0$.

A simulation of $10^5$ cases found no examples (the closest had $7$ pairs of students with $3$ or more matches) and the variance of the number of students with too many matches was smaller than the mean, so the distribution looks tighter than a Poisson distribution: the chart below gives shows the results from the simulation, plus a Poisson distribution with the same mean in shown as a grey line

pairshared <- function(t,k,n,s){
  pair <- cbind(rep(1:t, each=t), rep(1:t, times=t))
  pair <- pair[pair[,1] < pair[,2],] 
  selections <- replicate(t, sample(n,k))
  shared <- numeric(nrow(pair))
  for (i in 1:nrow(pair)){
    shared[i] <- sum(selections[,pair[i,1]] %in% selections[,pair[i,2]])
    } 
  table(factor(shared, levels = 0:k))
  }

set.seed(2021)
matdat <- replicate(10^5, pairshared(t=26, k=5, n=20, s=3)) 
pairstoomany <- colSums(matdat[(s+1):(k+1),])
mean(pairstoomany == 0)
# 0
min(pairstoomany)
# 7
mean(pairstoomany)
# 23.61912 
var(pairstoomany)
# 21.82561

plot(table(pairstoomany)) 
minp2m <-  min(pairstoomany)
maxp2m <-  max(pairstoomany)
points(minp2m:maxp2m, 10^5*dpois(minp2m:maxp2m, mean(pairstoomany)), 
       col="grey", type="l") 

enter image description here