There are 2 approaches to this kind of question (3 people with the same birthday...)
You either
1) just want the answer.
2) want the satisfaction and understanding that comes from figuring
it out from basic probability theory. (This can be a long hard road with no success guaranteed no matter how creative you are or how hard you work.)
If you just want the answer, the best way to get it is to write a little program that gets the answer by experiment. Using a random number generator
to provide the data, and repeating the experiment a large number of
times (for instance, 1,000,000 times) and seeing the result.
You can easily get the answer to the birthday problem for any number of
same birthdays (Sames), and also get answers to related questions- like,
On the average how many pairs (OneLesses) of people had the same birthday at the
time a new person had the same as one of the pairs making 3 with the same bday.
For this problem, Sames=3, OneLesses=number of pairs
the C code is below.
It was created and run in the Pelles C compiler for windows, a free program.
In the case of the 3 person birthday problem, the results for a million runs
the output of the program is-
" Avg # of tosses to get 3 Sames from 365 birthdays = 88.6971
Avg # of OneLesses, i.e. pairs, before 3 Sames from 365 birthdays = 10.1309"
So the average number of people in a room before there being 3 with the
same birthday is 88.7 and at the time that happened, there were, on the
average, 10 pairs of people with the same birthday already in the room.
C code->
Over=0;
while (!Over)
{
printf(" enter NumTrials, ");
scanf("%d",&NumTrials);
printf(" enter number of outcomes, ");
scanf("%d",&Outcomes);
printf(" enter number of Sames, ");
scanf("%d",&Sames);
TotalTosses=0;
TotalOneLesses=0;
MaxCount=0;
for (i=1; i <= NumTrials; i++)
{
// FOR NumTrials loop
// initialize
for(j=0; j<=Outcomes; j++) Results[j]=0;
Count=0;
OneLess=0;
Done=0;
while(!Done)
{
toss= rand () % (Cards) ;
Count++;
Results[toss]++;
if ( Results[toss]== (Sames-1) ) OneLess++;
if ( Results[toss]==Sames) Done=1;
} // End of While!Done
Tosses[Count]++;
TotalTosses+= Count;
TotalOneLesses+= OneLess;
}// for (NumTrials)
AvgTosses= (double)TotalTosses /NumTrials ;
printf( "Avg # of tosses to get %d Sames from %d Outcomes = %.4f \n ", Sames, Outcomes, AvgTosses);
AvgOneLesses= (double)TotalOneLesses /NumTrials ;
printf( "Avg # of OneLesses before %d Sames from %d Outcomes = %.4f \n ", Sames, Outcomes, AvgOneLesses);
} // END While (!Over)
//quit program