Interesting probability algorithm--Birthday paradox

Source: Internet
Author: User

In the algorithm introduction book see a more interesting probability algorithm, here add their own understanding to share under:

The last time I just saw the friends of the circle said:" two people in the same dormitory, and the same year, the same day, this fate is really drunk ", I was drunk, looked at the algorithm after the discovery, the house has a person, then you can The probability of 50% birthday is the same.

It is proved that:

first of all, suppose there's a room K Individuals, respectively, numbered them with 1,2,3....K number . Regardless of the case of leap years, then a year will have n=365 days, the first thing is to assume that the birthday is evenly distributed in the N days of the year (like in spring born in spring, this is not uniform), And then assume that the two birthdays are separate (what twins have to count),

then two people on the same day (the exact date) birthday of the probability of 1/n2 ( the probability of a birthday is 1/n, two people the same birthday of course multiplied ~), then two people the same birthday (365 The probability of a day is 1/n (n 1/n2 added )

That is, if there are two people in the house, then the probability of their birthday on the same day is 1/365, the question now to be solved is, how many people in the house to make this probability rise to 1/2?

use the opposite of the event to ask for, suppose the event p={ House At least two people birthday },q={ House Everyone birthday is different}, then p=1-q

so know Q probability will be able to know the probability of P, set BK for the first K personal birthdays have the same,Ai for the former I and the former i-1 A person's birthday is different, then you can get a recursive formula

Bk=bk-1^Ak

It is equivalent in the form of

p{bk}=p{bk-1}p{Ak | BK-1}

applying recursion can get P{BK}=P{B1} p{A2 | B1} p{A3 | B2} ... p{Ak-1 | Bk-2} p{Ak | BK-1}

=1* (n-1/n) (n-2/n) ... (n-k+1/n) (B1 is prescribed for 1 , then p{A2 | B1} is 365 one day has been given to B1 , then the remaining n-1 days, so the probability is (n-1/n))

P{bk}=1* (1-1/n) (1-2/n) ... (1-k-1/n)

then known 1+x<=ex ( two are monotonically increasing function, take 0 is equal, after the ex Big, high school's Hey )

Then there are 1* () () ... () <= (e-1/n) (e-2/n) ... (e (k-1/n)) = (E-k (k-1)/2n)) <=1/2

when n=365 , there must be k>=23, so the conclusion is that at least one person in a room, then at least two people birthday the same probability is at least the same.

Interesting probability algorithm--Birthday paradox

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.