1. What is the probability that at least two people in a group of 30 have the same birthday?

  2. How large would the group have to be for the odds to be about even?

This classic puzle requires a little knowledge of probability math and a good calculator to do.

Solutions to Birthdays puzzle

  1. About 70.63%
  2. 23 people

The solution uses an indirect approach: The probability P that at least two in a class of 30 have the same birthday will be 1 minus the probability that no two have the same birthday. So first you need to determine the probability that no two will have the same birthday in a group of 30:

The probability that both people in a group of just two will have the same birthday is 1/365 because there are 365 possible birthdays (disregarding leap years). Therefore the probability that both won't have the same birthday is 1 minus 1/365 or 364/365. In other words, if one person has a birthday on a certain day, that leaves 364 chances out of 365 that the second person's birthday will be different.

If you add a third person to the group, two days are already used up by the first two, which leaves 363 possible birthdays. So the probability that the first two don't have the same birthday and that the third person has a birthday different from both can be found by using the multiplication rule, and the probability of none of the three having the same birthday is

(364/365) (363/365).

The same logic continues on for however many people are added to the group. For a group of 30, if no two have the same birthday, then all 30 have different birthdays. The probability of this occurring is

(365/365) (364/365) (363/365) (362/365) . . . (336/365)

Therefore the probability P of this not occurring — that is, of at least two people having the same birthday — is 1 minus that amount or

  1. P = 1 - (365/365) (364/365) (363/365) (362/365) . . . (336/365)
  2. which simplifies to P = 1 - (365!/335!)/(36530)
  3. which further simplifies to P = 365!/(335!*36530)

This is fine, but actually calculating such a number is a problem, since 365! (and even 335!) are truly huge numbers and well beyond the computing capability of the usual calculator, or even of the typical home computer not having special software installed.

But the calculations can be set up in such a way that each division operation can be done as it occurs, rather than trying to compute 365! all at once. In other words, use the formula in line (1) above rather than the one in line (3).

The following program can be entered on a TI-83+ calculator and run.

			:While 1
			:Input "NUMBER IN GROUP ",N	
			:While F>365-N        
			:Disp 1-P

Using this program, a table of probabilities for two or more people in groups of 1 to 60 having the same birthday can be created, as below. (Those for 23 and 30 people are marked in red.)


Which can be graphed:

Recursive method

You can get the same results using a recursive function.

Again, start with the indirect algorithm above:

 P = 1 - (364/365)*(363/365)*(362/365)*(361/365)*. . . *(336/365)

In the sequential mode on the TI=83+ Graphing Calculator, enter


where n is the group size, which starts at 1. The starting value u(n) is also 1.

Then simultaneously define v(n)

    v(n)=1- u(n -1)((366- n)/365)

and have it start at 1 also. (Using simply v(n)=1-u(n) gives a domain error, so you have to write it out.)

In WINDOW, set the domain from 1 to whatever maximum group size you want, e.g., 60. Set the range from 0 to 1.

This will plot both graphs, u(n) and v(n), where u(n) is the probability that no two people in a group of n people have the same birthday, and v(n) is the probability that at least two people in a group do have the same birthday. The graphs cross at n =23, which is the break even point. All the numbers are correct.

It has to be done with two separate functions because the "1 -" part must not be recursed.

Also, you need to have "366- n " rather than "365- n " in both function definitions in order to make the resulting probability figures correspond to the appropriate group size.

Note: You can, if you want, de-activate the u(n) graph and show only the v(n) graph by placing the cursor on the first u(n) highlighted equal sign and pressing ENTER. This will make the highlighting for u(n) go away and cause only the v(n) graph to be displayed, which is the same as the graph pictured above.