# Probability that any two people have the same birthday?

In Blitzstein's Introduction to Probability, it is stated that the probability that any two people have the same birthday is 1/365. However, isn't this the conditional probability that the second person has the same birthday as the first person, given the birthday of the first person?

Couldn't I prove this by simply generalizing the formula that no n people have the same birthday:

$$\ P = 1 - (364 / 365)^n$$

And simply call n = 2, so that I can interpret the probability of having at least 2 people with the same birthday as the probability that 2 people have the same birthday? This would not be 1/365.

Is my reasoning flawed?

• This question leads into several others, including the famous birthday problem about the probability of at least one birthday match in a room with $n$ people. (If $n > 23,$ chances are better than 50:50.// In solving these problems, it is customary to assume (a) the people are chosen at random (not from a twin's convention or a meeting of the Sagittarian Society), (b) Feb 29 does not exist, (c) the remaining 365 days of the year are equally likely for birthdays. ... Oct 12 '19 at 4:53
• ... As always with such simplifying assumptions one (1) hopes that they are true or (2) knows they're not true but hopes they are mathematically harmless.// In the US equal likelihood for the 365 days is false but almost harmless. // Probability 2 randomly chosen people have same birthday is $1/365.$ Choose first person at random, note birthday; choose 2nd person at random, there is 1 chance in 365 2nd birthday will match first. Oct 12 '19 at 4:57

Unfortunately, yes, there is flaw. According to your purported formula, the probabilty of having two people with the same birthday, when you only have $$n=1$$ person, is:

$$P_1 = 1 - \Big( \frac{364}{365} \Big)^1 = 1 - \frac{364}{365} = \frac{1}{365} \neq 0.$$

So, you are ascribing a non-zero probability to an impossible event. Have a think about whether that is the correct formula, and what kind of change you might make to it.

One way to find the probability of no birthday match in a room with $$n=25$$ people is shown in the Wikipedia link of my first Comment. Here is a slightly different way to write it:

$$P(\text{No Match}) = \frac{{}_{365}P_{25}}{365^{25}} = \prod_{i=0}^{24}\left(1 - \frac{i}{365}\right) = 0.4313.$$

In R, this can be evaluated as follows. [In R, 0:24 is a list of the integers from 0 through 24; similarly for other uses of :.]

prod((365:(365-24))/365)
 0.4313003
prod(1 - (0:24)/365)
 0.4313003
prod(365:341)/365^25
 0.4313003


So $$P(\text{At least one match}) = 1 - 0.4313 = 0.5687.$$

You can use R to make the first figure in the Wikipedia article as shown below. The green line shows that for 23 people or more the probability of at least one birthday match exceeds $$1/2.$$

n = 1:60
p = numeric(60)
for (i in n) {
q = prod(1 - (0:(i-1))/365)
p[i] = 1 - q
}

plot(n, p)
lines(c(0,23,23), c(.5,.5,0), col="green2") Some people are surprised that matches occur with such high probability. Maybe they are thinking at it would take 366 people in a room to be sure of a match. But the graph shows that probability does not increase linearly with room size. So it is "nearly sure" (probability 0.9941) to get a match in a room of only 60 people. And the probability of at least one match is above 1/2 in a room of 23 people.

Here is a table of some of these 60 probabilities (truncated at 30):

cbind(n, p)
n           p
[1,]  1 0.000000000
[2,]  2 0.002739726
[3,]  3 0.008204166
[4,]  4 0.016355912
[5,]  5 0.027135574
[6,]  6 0.040462484
[7,]  7 0.056235703
[8,]  8 0.074335292
[9,]  9 0.094623834
[10,] 10 0.116948178
[11,] 11 0.141141378
[12,] 12 0.167024789
[13,] 13 0.194410275
[14,] 14 0.223102512
[15,] 15 0.252901320
[16,] 16 0.283604005
[17,] 17 0.315007665
[18,] 18 0.346911418
[19,] 19 0.379118526
[20,] 20 0.411438384
[21,] 21 0.443688335
[22,] 22 0.475695308
[23,] 23 0.507297234  # first to exceed 1/2
[24,] 24 0.538344258
[25,] 25 0.568699704
[26,] 26 0.598240820
[27,] 27 0.626859282
[28,] 28 0.654461472
[29,] 29 0.680968537
[30,] 30 0.706316243
...
[60,] 60 0.994122661


Notes: I agree with @Ben (+1) that your equation doesn't work to get the probability of a match between two randomly chosen people. however, suppose you're among the 25 people in a room, then with probability $$1 -\left(\frac{364}{365}\right)^{24} = 0.0637$$ at least one other person in the room will match your birthday.

Thus, another wrong 'intuitive' approach to the main birthday problem above is to confuse the probability someone will match your birthday with the larger probability that some two (or more) people will have matching birthdays. (Among 25 people there are $${25 \choose 2} = 300$$ pairs of people who may have matching birthdays.)

Finally, this Q&A shows a method of simulating the probability of a birthday match. With a slight modification, that method can also be used to find the expected number of matches.