There are 2 approaches to this kind of question (3 people with the same birthday...)
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.
printf(" enter NumTrials, ");
printf(" enter number of outcomes, ");
printf(" enter number of Sames, ");
for (i=1; i <= NumTrials; i++)
// FOR NumTrials loop
for(j=0; j<=Outcomes; j++) Results[j]=0;
toss= rand () % (Cards) ;
if ( Results[toss]== (Sames-1) ) OneLess++;
if ( Results[toss]==Sames) Done=1;
} // End of While!Done
}// 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)