Birthday Problem Simulation

Project
AP Statistics
An interactive Monte Carlo simulation built with Streamlit to visually demonstrate the counterintuitive probabilities of the birthday paradox.
Published

June 9, 2026

👉 Visit Live Demo

The Pedagogical Problem

In AP Statistics and probability courses, the Birthday Problem—the fact that it only takes a room of 23 people to reach a 50% chance of a shared birthday—is notoriously difficult for students to accept intuitively. Theoretical mathematical proofs often fail to overcome their inherent cognitive biases, leaving students skeptical of the math itself.

The Technical Solution

To bridge the gap between theoretical probability and empirical evidence, I built an interactive web application using Python and the Streamlit framework. The app performs real-time Monte Carlo simulations of the birthday paradox. Through an interactive dashboard, students can adjust parameters like sample size and number of trials via sliders. The app instantly visualizes how the probability curve converges toward the theoretical calculation as the sample size increases.

Classroom Impact

The interactive nature of this simulation creates a powerful “Aha!” moment in the classroom. Instead of passively memorizing a probability formula, students empirically test the paradox themselves. This hands-on visualization effectively dismantles their cognitive bias, leading to a much deeper, more intuitive grasp of probability theory, randomness, and the law of large numbers.