# Birthday Problem: Hypothetically Not Using the Complement

My Professor said that the probability that at least 2 of $$k$$ people have the same birthday if we didn’t use the complement is the sum of the probabilities that exactly 2 have the same birthday, plus the probability 3 have the same birthday, and so on…

However, I wanted to verify this and believe I thought of a case where this is not true: the case where exactly 3 and exactly 4 have the same birthday. I.e. the event that exactly 2 and exactly 3 people have the same birthday are not disjoint. therefore, we need a different method to calculate the probability not using the complement. Is this valid?

• Please tell us what "use the complement" means. The answer to this question likely hinges on how you interpret the events in question: e.g. "exactly 2 share a birthday" is ambiguous: does it mean there is one birthday shared by just two people, or at least one birthday shared by just two people? (Regardless, your professor might have been a little hasty ;-).)
– whuber
Jan 27 at 21:11
• You can make sense of this if you let X be the total number of birthday matches. Two people born on August 6 and three born on May 10 (with no other matches) would be a total of five matches. // I'm not saying this is the way toward a nice combinatorial solution, but it is a way to frame your professor's statement. // This is the way toward a simple simulation in R. Jan 27 at 21:52
• Thank you very much, that was what I was looking for! @BruceET Jan 28 at 4:01

Comment continued: Suppose there are 365 equally likely birthdates in a year (ignoring instances of Feb. 29) and that 23 people have randomly chosen birthdays.

n =23;  m = 10^6
set.seed(2022)
x = replicate(m,
n-length(unique(sample(1:365, n, rep=T))))
mean(x == 0)
[1] 0.492107     # aprx P(No Match)
2*sd(x == 0)/1000
[1] 0.0009998759 # aprx 95% margin of sim error


So the simulated probability of no matches is $$0.4921 \pm 0.0010.$$ The exact probability is $$0.4927.$$ [An advantage of simulation is that one can easily get the probability of no matches based on data for the relevant country of the actual probabilities of different birthdates (often slightly higher in summer than in winter).]

prod(1-(0:22)/365)
[1] c028    # exact P(No Match)


Here is a histogram of the simulated distribution of the number of matches among 23 people.

cutp = (-1:max(x))+.5
hist(x, prob=T, br=cutp, col="skyblue2")


n =23;  m = 10^6
set.seed(2022)
x = replicate(m,
sum(duplicated(sample(1:365, n, rep=T))))
mean(x == 0)
[1] 0.492107

– whuber
Jan 27 at 22:49
• I intended for the simulation to show an approach that gives probabilities of multiple matches. Maybe the simulation using duplicated in my Addendum comes closer to that. However, I don't see that either simulation gives clues to additional combinatorial approaches. Jan 27 at 23:09

If you have a random variable $$X$$ (e.g., the maximum number of people in the sample that share a birthday) that can only take on values $$0,1,2,...,k$$ then it is certainly true that:

$$\{ X \geqslant 2 \} = \bigcup_{x=2}^k \{ X = x \}.$$

Consequently, you then have:

$$\mathbb{P}(X \geqslant 2) = \sum_{x=2}^k \mathbb{P}(X = x).$$

Presumaby this is what your professor is talking about in this case. Your misgivings seem to arise from ambiguity about the event whose probability you are computing. If you can clarify that with your professor then this might become clearer.

• What should we take $X$ to be in this application, where it appears there are as many random variables as there are people in the sample?
– whuber
Jan 28 at 0:01
• Here it would be the maximum number of people in the sample that share a birthday.
– Ben
Jan 28 at 0:35
• Do you mean the largest count of people associated with any date, or the total number of people who do not have a unique birthdate? Regardless, isn't this detail crucial to your explanation?
– whuber
Jan 28 at 14:10
• I mean the former.
– Ben
Jan 28 at 15:17