Have you ever walked into a room and thought, "How many of these people share my birthday?"
Maybe you're at a party, and you secretly hope you're the only one whose birthday is on the 29th of February so you can hog all the attention and bask in the glory of solo birthday fame.
But wait—what's this? You find out Ten other people share the same birthday😨❗
You realize you're not special at all—at least, not in the birthday department🤣
Welcome to the amazing world of "The Birthday Paradox" 🎂🎈
In this project, we’ll use Monte Carlo simulations to uncover how likely it is for people to share the same birthday in a crowd. Spoiler alert: it’s more common than you think. So grab a slice of cake (or maybe two—you might have to share😉😋) and join me as we explore this mind-boggling phenomenon. Let’s find out how many people are stealing your birthday thunder!
⚠️BE WARNED because the probability is about to crash your exclusive birthday bash!
In this Google Colab page, we delve into the Monte Carlo simulation method to estimate probabilities. The chosen experiment involves determining the probability that at least two people in a group of 23 share the same birthday.
https://colab.research.google.com/drive/15xipRHMK5RAfmgLqQKQ7yw-eFutEFX_L#scrollTo=vjRXiz2SbuRn
no: A variable to store the number of times the event (at least two people having the same birthday) occurs.
n: The number of people in the group is 23.
trials: The number of simulations to run=1000
The formula to calculate the probability that at least two people in a group of n people share the same birthday is :
⭑・゚・*:༅。.。༅:*゚༅。.。༅:*・゚゚・⭑・゚゚・*:༅。.。༅::*:༅。.。༅:*・゚゚・⭑・゚・*:༅。.。༅:*゚:*:✼✿ 🎂 ✿✼:*:༅。.。༅:*・゚゚・⭑・゚゚・*:༅。.。༅:*゚:༅。.。༅:*・゚゚・⭑・゚゚・*:༅。.。༅:*゚:༅。.。༅:*・゚゚・⭑
⭑・゚・*:༅。.。༅:*゚༅。.。༅:*・゚゚・⭑・゚゚・*:༅。.。༅::*:༅。.。༅:*・゚゚・⭑・゚・*:༅。.。༅:*゚:*:✼✿ 🎂 ✿✼:*:༅。.。༅:*・゚゚・⭑・゚゚・*:༅。.。༅:*゚:༅。.。༅:*・゚゚・⭑・゚゚・*:༅。.。༅:*゚:༅。.。༅:*・゚゚・⭑
Histogram Bars: Each bar represents a range of estimated probabilities. The height of each bar indicates how frequently that particular estimated probability occurred across the 1000 simulations.
Vertical Red Dashed Line: This line marks the mean estimated probability across all simulations. It provides a visual reference for the average likelihood of the Birthday Paradox occurring based on the simulations.
X-axis: Represents the estimated probability values ranging from 0 to 1. Higher values indicate a higher likelihood that at least two people share the same birthday in a group of 23.
Y-axis: Displays the frequency of each estimated probability value occurring among the simulations.
The distribution shows how the estimated probability varies across multiple simulations, providing
insights into the variability and expected likelihood of encountering the Birthday Paradox with 23 people. The spread of the histogram bars indicates the range of probabilities observed, while the mean line offers a central tendency measure for these estimates.
This visualization helps in understanding the stochastic nature of the Birthday Paradox and the reliability of Monte Carlo methods in estimating its probability.
We conducted a Monte Carlo simulation to estimate this probability and compared it with the manual calculation
● Using the Monte Carlo simulation, we obtained a probability of approximately 0.507297
● Using the manual calculation based on the formula, we obtained a probability of approximately 0.52
This activity highlights the effectiveness of Monte Carlo simulations in handling complex probability scenarios, such as the Birthday Paradox, where analytical solutions may be challenging or computationally intensive. By generating random samples and aggregating results, Monte Carlo simulations offer a practical and reliable method to estimate probabilities and serve as a powerful tool in providing valuable insights into real-world scenarios where precise analytical solutions may be impractical or infeasible.