The Birthday Problem.

In class, we learned how to compute the probability that two students in a group of r would have the same birthday. We start by computing the probability that all r have different birthdays. If the birthdays are arranged in order as ((Subscript[d, 1]),...., (Subscript[d, r])), the number of sequence where they are all different are given by

	365×364×363× ... × (365-r +1)

because the first day (Subscript[d, 1]) can be any day in the year, but the second day can’t be the same as the first, so there are only 364 options left to choose from, and so forth.

Mathematica has

Pochhammer[n,7]

for these kinds of products. In our case:

DifferentBirthdaySequenceCount[r_] := Pochhammer[365-r+1,r]

We can check that this is the product we want by doing a couple of examples:

DifferentBirthdaySequenceCount[1]

The total number of sequences of r birthdays is clearly (365^r). So we can compute

DifferentBirthdaySequenceProbability[r_] := ((DifferentBirthdaySequenceCount[r])/(365^r))

The probability of getting the same birthday twice is then

SameBirthdaySequenceProbability[r_] := 1 - DifferentBirthdaySequenceProbability[r]

We can then collect some data:

ListPlot[Table[SameBirthdaySequenceProbability[r],{r,1,50}]]