Monthly Archives: February 2023

The Birthday Problem

By Chandrahas M. Halai

There are 15 persons in a group. What is the probability that at least two persons will share their birthdays?

In general, we can ask, if there are ‘n’ persons in a group, then what is the probability that at least two of them will share their birthdays?

How many persons are required to be in a group so that the probability of at least two persons sharing their birthdays crosses 50%?

To solve this problem let us begin with a group having two persons. Now these two will either share their birthdays or they won’t.

The two persons share their birthdays:

To share their birthdays, the second person has to have his birthday on the same day as the first person. This can be done in only one way. Hence, the probability of this case is 1/365.

The two persons don’t share their birthdays:

In this case, the second should not have his birthday on the same day as the first person. Stating it differently, the second person can have his birthday on any of the remaining 364 days of the year. Hence, the probability of this case is 364/365.

Let P(n) represent the probability that at least two persons in a group of n persons share their birthdays. Then it’s complement P(n)’ is the probability that no two persons from a group of n persons share their birthdays.

We have,

P(n) = 1 – P(n)’

In the above case we have,

P(2) = 1/365 = 1 – 364/365 = 1 – P(2)’

Rule for calculating Conditional Probability

Let A and B be two events in a sample space. The probability of event B given that event A has already occurred, P(B|A) is given by


Thus, we have


This is also called the multiplication rule of probability.

Now, let us bring a third person into the group.

The first two persons are not sharing their birthdays. Now, let us say that the third person is also not sharing his birthday with the existing two persons. The third person can have his birthday on any of the remaining 363 days of the year. Therefore, the probability of this event is 363/365.

The probability, P(3)’ is given by


Now, let us bring a fourth person into the group.

The first three persons are not sharing their birthdays. Now, let us say that the fourth person is also not sharing his birthday with the existing three persons. The fourth person can have his birthday on any of the remaining 362 days of the year. Therefore, the probability of this event is 362/365.

The probability, P(4)’ is given by


In the same way, we can have



In general, we can say that


We have,


When, P(n)’ becomes less than 50% then P(n) becomes greater than 50%.

We can write a program in Python to do these calculations and give us an answer. I present here the Python program:

c = 1.0

n = 0

while (c > 0.5):

n = n + 1

c = c * ((365 – n + 1)/365)

print(“for n = “, n, “probability of complement = “, c)

print(“When there are n =”, n, ” persons in a group, P =”, 1 – c)

When we run this program we get the output:

for n = 1 probability of complement = 1.0

for n = 2 probability of complement = 0.9972602739726028

for n = 3 probability of complement = 0.9917958341152187

for n = 4 probability of complement = 0.9836440875334498

for n = 5 probability of complement = 0.9728644263002065

for n = 6 probability of complement = 0.9595375163508886

for n = 7 probability of complement = 0.9437642969040246

for n = 8 probability of complement = 0.925664707648331

for n = 9 probability of complement = 0.9053761661108333

for n = 10 probability of complement = 0.8830518222889223

for n = 11 probability of complement = 0.8588586216782669

for n = 12 probability of complement = 0.8329752111619355

for n = 13 probability of complement = 0.8055897247675705

for n = 14 probability of complement = 0.7768974879950269

for n = 15 probability of complement = 0.7470986802363135

for n = 16 probability of complement = 0.7163959947471499

for n = 17 probability of complement = 0.6849923347034391

for n = 18 probability of complement = 0.6530885821282104

for n = 19 probability of complement = 0.620881473968463

for n = 20 probability of complement = 0.5885616164194197

for n = 21 probability of complement = 0.556311664834794

for n = 22 probability of complement = 0.5243046923374497

for n = 23 probability of complement = 0.4927027656760144

When there are n = 23 persons in a group, P = 0.5072972343239857

Thus, we can say that if there are 23 persons in a group the probability that at least two persons share their birthdays crosses 50%.