📜 ⬆️ ⬇️

The paradox of birthdays for three people

Many people know the paradox of birthdays : in a group of 23 randomly selected people, the probability that at least two of them have a matching birthday exceeds 1/2.

The problem that I will consider is formulated as an exercise in the book Algorithms: construction and analysis :
“How many people need to take to meet with the same probability 1/2 at least three with a matching birthday.”


Immediately, we note that the birthdays of experience participants, as events, are considered jointly independent and equally probable.

We introduce some notation:
')
n = 365 (leap year is also omitted).
k - the number of participants. We assume k <= 2 n , otherwise triple coincidence will happen with probability 1.

A - an event consisting in the fact that in the group there are three or more people with the same birthday.
B = ( not A ) - an event consisting in the fact that no three participants have the same birthday.

Event B will be performed if and only if exactly two participants will fall on a certain number of m different days in a year, and on the other ( k - 2 m ) days there will be exactly one person:
Daysd 1d 2...d k - 2 md k - 2 m +1d k - 2 m +2...d k - md k - m + 1...d n
Number of personsoneone...one22...20...0
It is clear that m can vary depending on a specific group of people from 0 to [ k / 2].
We denote B m - an event consisting in the fact that there are exactly two participants for m different days in a year, and one for each other ( k - 2 m ) days.
The peculiarity of the set of events { B m , m = 0, ..., [ k / 2]} is that they are incompatible and

B = B 0B 1 ∪ ... ∪ B [ k / 2] .

This enables us to calculate the probability of an event B in terms of the probabilities of events B m :

P ( B ) = P ( B 0 ) + P ( B 1 ) +… + P ( B [ k / 2] ).

Next we will look for the probability of events B m .

Equiprobable elementary outcomes (events) will be sets of pairs: {( i , d i ); i = 1, ..., k }, each of which means that person number i has d i as a birthday.
The number of all elementary outcomes is determined based on the fact that each participant has n birthday options:
N B m = n k .

The number of elementary outcomes when the B m event is executed is considered somewhat more complicated:

B m = C n m C nm k -2 m k ! / 2 m .

Here we first determine the number of ways that m days for double matches can be selected. Then from the remaining days choose k - 2 m , which accounts for one person. On selected days, participants can accommodate k ! / 2 m ways. Divide by 2 m , because we don’t care about the order inside couples who have a common birthday.

therefore

P ( B m ) = N B m / N = C n m C nm k -2 m k ! / (2 m n k ).
P ( B ) = k ! (C n 0 C n -0 k -0 / 2 0 + C n 1 C n -1 k -2 / 2 1 + ... + C n m C nm k -2 m / 2 m + ... + C n [ k / 2] C n - [ k / 2] k -2 [ k / 2] / 2 [ k / 2] ) / n k .

The required probability will be equal to:

P ( A ) = 1 - P ( B ) = 1 - k ! (C n 0 C n -0 k -0 / 2 0 + C n 1 C n -1 k -2 / 2 1 + ... + C n m C nm k -2 m / 2 m + ... + C n [ k / 2] C n - [ k / 2] k -2 [ k / 2] / 2 [ k / 2] ) / n k .

My Java program produced the following values ​​of this probability depending on k :
kP ( A )
20
37.506E-6
five7.475E-5
ten8.877E-4
200.00824
400.0669
600.207
700.306
800.418
870.499
880.511
1000.646
1100.746
1200.828
1500.965
2000.999512
2500.999999460
So, you need at least 88 people so that the probability of triple coincidence exceeds 1/2.

Source: https://habr.com/ru/post/256301/


All Articles