[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
Here's a short Delphi program that lists the probability that at least two people share a
common birthday in a room containing N people.
We multiply these probabilities because of the rule of conditional probabilities, the probability of A and B both being true is the the probability that A is true times the probability that B is true, given the condition that A is true. This is usually written as P(A,B)=P(A)*P(B|A). In our birthday case, the probability that there are no shared birthdays among 4 people is the probability that there are no shared birthdays among the first 3 times the probability that the 4th doesn't match any of the others, once we know that they all have different birthdays. We need this last condition to ensure that we have only 362 choices for that 4th guy's birthday.
And again, remember that the probability of some shared birthdays is 1 - probability
of no shared birthdays. That's it.
Addendum Sept 2, 2003: The above discussion ignores the possibility that someone in the room may have a birthday on February 29 during a leap year. I have had the code including that possibility for several months, but I had a difficult time explaining the revised calculation. I finally tackled the write-up this weekend and posted it on a separate Shared Birthdays Leap year page. The downloadable programs below have been revised and now report statistics with and without leap year considerations.
Running/Exploring the Program
Done Sept 2, 2003:
Copyright © 2000-2017, Gary Darby All rights reserved.