Login
📚 Online Statistics Education
Chapters ▾
⇩ Download ▾

5.6 Birthday Demo

This section is an interactive demonstration. The live simulation runs on the original site: open the demonstration at onlinestatbook.com.

Learning Objectives

  1. Become familiar with the properties of the birthday problem.

Instructions
Most people's intuition about the probability of two people in a group sharing a birthday is way off. This simulation allows you to approach this problem concretely.

When you click the "Draw Birthday" button, a birthday is randomly drawn from the dates listed. The date drawn is listed on the left in red and shown in the list of dates in red. As you push the button, more dates will be shown. If a date is a duplicate, it will be shown in blue on the left. The "Show Duplicates" button shows allow duplicate dates drawn.

Illustrated Instructions
The screenshot below shows opening state of the birthday problem demonstration. Each time you click the "Draw Birthday" button a random date is drawn from the calendar and displayed under the button. Any duplicates are highlighted in blue and you can click the "Show Duplication Info" button to see summary data of all duplicates.
Screenshot of the birthday-problem simulation before any draw: a full year calendar listing every date of all twelve months in plain type, with Draw Birthday, Show Duplication Info, and Start Over buttons at the left and no birthdays yet selected.
Below is an example of 30 drawn dates with one duplicate "10/18". The summary that appears when the "Show Duplication Info" button is clicked is also shown.
Screenshot of the same simulation after 25 birthdays have been drawn. The drawn dates are listed at the left (10/23, 03/26, 11/17, 02/06, 07/05, 10/04, 12/11, 08/04, 05/02, 01/23, 07/28, 12/01, 01/28, 10/18, 02/27, 08/15, 03/01, 10/18, 08/16, 12/09, 04/28, 06/18, 04/06, 09/28, 01/16) and highlighted on the calendar; the one date drawn twice, 10/18, is shown in blue rather than red. The Show Duplication Info panel below reports People selected: 25, Duplicated birthdays: 1, and a table giving birthday 10/18 first hit on trial 14 and second hit on trial 18.

We recommend you answer the question even if you have to guess.

If there are 25 people in a room, what is the probability that at least two of them share the same birthday. If your first thought is that it is 25/365 = 0.068, you will be surprised to learn it is much higher than that. This problem requires the application of the sections on P(A and B) and conditional probability. This problem is best approached by asking what is the probability that no two people have the same birthday. Once we know this probability, we can simply subtract it from 1 to find the probability that two people share a birthday.

If we choose two people at random, what is the probability that they do not share a birthday? Of the 365 days on which the second person could have a birthday, 364 of them are different from the first person's birthday. Therefore the probability is 364/365. Let's define P2 as the probability that the second person drawn does not share a birthday with the person drawn previously. P2 is therfore 364/365. Now define P3 as the probability that the third person drawn does not share a birthday with anyone drawn previously given that there are no previous birthday matches. P3 is therefore a conditional probability. If there are no previous birthday matches, then two of the 365 days have been "used up," leaving 363 non-matching days. Therefore P3 = 363/365. In like manner, P4 = 362/365, P5 = 361/365, and so on up to P25 = 341/365.

In order for there to be no matches, the second person must not match any previous person and the third person must not match any previous person, and the fourth person must not match any previous person, etc. Since P(A and B) = P(A)P(B), all we have to do is multiply P2, P3, P4...P25 together. The result is 0.431. Therefore the probability of at least one match is 0.569.

Each time the "Draw Birthday" button is clicked a random birth date is selected and displayed. Duplicate dates are marked in blue.

Adapted from Online Statistics Education: A Multimedia Course of Study (onlinestatbook.com), Project Leader: David M. Lane, Rice University. Developed with NSF support. The original work is in the public domain; it is cited here at the authors' request. Changes were made: reformatted as an accessible XYZ web edition with native MathML. License: Public-Domain.