How likely is it to find two people with the same birthday in a group of partygoers? If the group only has 2 or 3 people, it is probably not likely. So how many people do you need to have at a party so that there is a better-than-even chance that at least two of them will share the same birthday? This is a classical problem in probability called the Birthday Problem.

To be sure, if the gathering of people is huge, say a stadium or sport arena with tens of thousands of people, it is certain and it is clear that there are many people sharing the same birthday. The reasoning is called the pigeon hole principle. For example, if a mailman has 25 pieces of mails to be delivered into 20 mailboxes, then at least one of the mailboxes will have more than one piece of mails. So if there are more than 365 people in a group of people, then there is a 100% chance that at least two of the people will share the same birthday.

It turns out that the size of the party for better-than-even chance for a matching birthday is much less than 365 people. You do not need 200 people. You do not even need 50. In fact, you just need 23. In any random sample of 23 people, there is a better than 50% chance (50.73% to be more exact) that there is at least one pair of people sharing the same birthday. However, in a random sample of 22 people, the chance of a matching birthday is under 50% (47.57% to be more exact), making 23 the smallest answer to the Birthday Problem.

For simplicity we ignore leap years and assume that there are only 365 possible birthdays. Furthermore, we assume that the 365 possible birthdays are equally likely. Though there is evidence that the birth distribution is not uniform across the months of the year (at least in North America), the assumption helps make the calculation more tractable.

Here’s the calculation. To compute the exact probability of finding two people with the same birthday in a given group of people, it turns out to be easier to ask the opposite question: what is the probability that no two will share a birthday, i.e., that they will all have different birthdays?

If there are just two people, the probability that they have different birthdays is , or about 0.9926. The reasoning is that the birthday of the second person can be any one of the 364 possible birthdays different from the first person.

If we add a third person, the probability of the three people having different birthdays is , or about 0.991796, the reason being that the birthday of the second person can be any one of 364 choices and the birthday of the third person can be any one of the remaining 363 choices. With a fourth person, the probability of different birthdays is , or about 0.983644. And so on.

As more and more people are in the group, the results of the multiplication get smaller and smaller. When there are 23 people in the group, the multiplication dips below 0.50 for the first time. The following is the multiplication that results in the probability of having different birthdays in a random group of 23 people.

Thus the probability that, in a random group of 23 people, at least two people sharing the same birthday is , which is greater than one-half.

Most people think that the answer to the Birthday Problem is more than 23 people. Perhaps they are thinking of a different question: How many people do you need to have at a room so that there is a better-than-even chance that one of the birthdays will be a particular one (says yours)? In order to have better-than-even chance of a match that is a specific date, you will need many people than 23 people (in fact the expected number of people in order to have such a match is 183, half of 365). For the Birthday Problem discussed here, the match does not have to be of a specific date; two people only have to share the same birthday and the common birthday does not have to be any specific date.

There are 43 men who had served as the president of the United States. Indeed, there is a common birthday among this group of men – James Knox Polk (November 2, 1795) and Warren Gamaliel Harding (November 2, 1865). This is the only matching birthday among the US presidents. For a random group of 43 people, the probability that there is no matching birthday is 0.076077 (according to a similar calculation as described above). Thus there is a 0.923923 probability that there is a common birthday in a random group of 43 people.

With respect to the US presidents, a more interesting group size is 28. When Warren Harding became the president of the United States in 1921, the matching birthday with James Polk became a reality. Warren Harding is the 28th men to join the rank of the US presidents. For a random group of 28 people, there is a 0.345539 probability that there is no matching birthday, hence 0.654461 probability that there is a matching birthday.

As of the writing of this post, there are 15 presidents of the United States succeeding Warren Harding, from Calvin Coolidge to Barack Obama. There is no matching birthday among this group of 15 men. For a random group of 15 people, there is a 0.747099 probability that there is no matching birthday, meaning there is only about a 25% chance of a matching birthday in such a group size. An equally interesting question is that how many more United States presidents do we need to have for another matching birthday to become a reality?

The following table shows the probabilities of no matching birthday and the probabilities of matching birthday for various group sizes. The group sizes of 15, 23, 28, and 43 have been discussed above (in conjunction with the United States presidents except for the group size of 23). Note that for the group size of 57, there is an over 99% chance for a matching birthday. For the group size of 100, there is a virtual certainty of a match! Probabilistically speaking, you do not need to have any where near the group size of 366 to find a matching birthday.