The birthday paradox
How many people do you need in a room before two of them probably share a birthday? Most people guess around 180. The answer is only 23: then the chance is 50.7%, and with 57 people it is already 99%. It feels wrong because we think of our own birthday, while the paradox is about every pair in the room.
How it works
- Click the stage for a new group of 23 people. They join one by one, and a line appears for every new pair.
- Watch the calendar: a day with two birthdays lights up, and the message names the shared birthday.
- Press Test automatically for 1,000 groups, or Test every group size to see the chance rise from 2 to 100 people.
Why our intuition fails
In a room we unconsciously reason from ourselves: what is the chance that someone shares my birthday? With 365 days that chance is small, about 6% with 22 others. But the paradox asks whether any two people share a birthday: A and B, B and C, A and C, and so on.
Twenty-three people make \(23\times 22/2=253\) pairs, and every one of them is a chance for a match. The number of pairs grows with the square of the group, so the chance shoots up.
The calculation
It is easiest to work out the chance that nobody shares a birthday, and subtract it from 100%. The first person takes any day. The second has a chance of 364/365 of a different day, the third a chance of 363/365 of avoiding the first two, and so on.
For 23 people:
\[\frac{365}{365}\times \frac{364}{365}\times \frac{363}{365}\times \dots \times \frac{343}{365}\approx 49.3\%\,.\]
The chance of at least one shared birthday is then \(100\%-49.3\%=50.7\%\).
Someone with your birthday
The chance that someone in the group shares your own birthday grows much more slowly: \(1-(364/365)^{n-1}\), because only \(n-1\) of the pairs include you. With 23 people it is 5.9%, and you need 253 others to pass 50%. Switch the question to Someone shares your birthday to compare both curves.
Birthday attacks in cryptography
The paradox is more than a party trick. In computer security it is the basis of the birthday attack: to find two inputs with the same hash, a collision, an attacker needs far fewer tries than you would expect.
For a hash with N possible values, a collision becomes likely after roughly \(\sqrt{N}\) tries rather than N. That is why hashes and digital signatures need outputs long enough that even \(\sqrt{N}\) tries are out of reach: for a 128-bit hash a collision takes about \(2^{64}\) tries.
Using the app
In a group of only 23 people, the chance that two of them share a birthday is 50.7%. That sounds far too high, because we think of our own birthday: the chance that someone shares yours is only 6%. But 23 people make 253 pairs, and each pair could share a birthday.
Click for a new group and watch the pairs pile up, add people one by one, or test 1,000 groups and every group size to see the curve rise.
Frequently asked questions
How many people do you need for a 50% chance of a shared birthday?
23. Then the chance is 50.7%. With 30 people it is 70.6%, with 41 people 90.3%, with 57 people 99.0%, and with 70 people 99.9%.
Why is it called a paradox?
It is not a contradiction, only a surprise: the answer goes against intuition. Most people guess that you need about half of 365, around 180 people, because they compare everybody with themselves instead of with each other.
What about 29 February and real birth dates?
The app, like the classic problem, takes 365 equally likely days. Real birthdays are not spread quite evenly over the year, and an uneven spread makes a shared birthday slightly more likely, not less.
When is a shared birthday certain?
With 366 people: there are only 365 days, so by the pigeonhole principle at least two of 366 people must share one. Long before that it is practically certain: with 100 people the chance is 99.99997%.
What are the odds that someone shares my birthday?
Much lower than for any two people: 1 − (364/365) to the power of the number of others. With 22 others, a group of 23, it is only 5.9%, and you need 253 others to pass 50%. Set Question to Someone shares your birthday to compare both curves.
生日悖論: how do I record a video?
Press the red Record button in the playback bar: it films what the stage shows. Press it again to stop, and the video is saved to your device.Recording is free; you only need to sign in. Without a subscription the video carries a small PictorX logo in a corner.The button beside Record opens the video options: the shape (as shown, square, story 9:16 or wide 16:9), the length (until you stop, or 5, 10, 15 or 30 seconds for social media) and the file: MP4, WebM or an animated GIF.You can add one of three music tracks: calm, bright or beat.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
前往編輯器