In a classroom of 17 people, 4 types of tests are distributed randomly among all students. What is the probability that two students have the same test?
I can't calculate the probability analytically. I tried to do a simulation in R.
pro=function(k,l,N){
n=0
for(i in 1:N){
asig <- sample(x = c("a","b","c","e"),17,replace = TRUE,prob =rep(0.25,4) )
# print(asig)
if(asig[k]==asig[l]){
n=n+1
}
}
print(n/N)
}
pro(1,6,100000)
[1] 0.25041
How can I find the probability analytically?
The total number of students are irrelevant.
Once you gave student $k$ his paper, there is a probability of $\frac14$ to get the same paper for student $l$.
Remark: I am interpreting the question as two particular student has the same paper, i.e. your simulation. Rather than there exists two students having the same paper.