Micro Project for Foundations of Computer Science (221TCS002)
In a random group of 23 people, there is about a 50 percent chance that two people have the same birthday.
The probability of this occurring can be calculated using the following formula:
Here, P(n) is the probability that at least two people in a group of n people will have the same birthday, and 365 is the number of days in a year (assuming all birthdays are equally likely).
To understand this formula, it's helpful to think about the probability that no two people in a group of n have the same birthday. This probability can be calculated by taking the probability that the first person has a unique birthday (365/365) and multiplying it by the probability that the second person has a unique birthday (364/365), and so on, until you have multiplied the probability that the n-th person has a unique birthday (365-n+1/365).
The probability that at least two people in the group have the same birthday is then just 1 minus the probability that no two people in the group have the same birthday.
Run Code