• 0

Birthday Probability

Question

Posted · Report post

At a movie theater, the manager announces that a free ticket will be given to the first person in line whose birthday is the same as someone in line who has already bought a ticket. You have the option of getting in line at any time. Assuming that you don't know anyone else's birthday, and that birthdays are uniformly distributed throughout a 365 day year, what position in line gives you the best chance of being the first duplicate birthday?

0

Share this post


Link to post
Share on other sites

7 answers to this question

  • 0

Posted · Report post

The 23rd person is the first person to have a 50% probability of getting a free ticket.

That may also be the point of greatest slope on the cumulative probability curve, which I think answers the question.

So I'll go with 23.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

gave me the highest probability (0.0323023349) at position 20.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Let n be your position in the line, there are n-1 people ahead of you. Let A be the event that the people ahead of you all have different birthdays, and let B be the event that you have the same birthday as someone ahead of you. You will win iff both A and B happens. So P(win) = P(A and B) = P(A)*P(B|A). We know that P(A) = 365*364*...*(365-n+2)/365

n-1, and it's easily seen that P(B|A) = (n-1)/365. So P(win) = 365*364*...*(365-n+2)*(n-1)/365n. Consider the function f(n) as being your probability of winning in position n. We seek the value for n which maximizes f(n).

If we compare f(n+1) to f(n), most factors will fortunately cancel out.

f(n+1)/f(n) = 365*364*...*(365-n+2)*(365-n+1)*n/365n+1/(365*364*...*(365-n+2)*(n-1)/365n) = (365-n+1)*n/(365(n-1)) = (365n-n2+n)/(365n-365)

As long as this is greater than 1, the function f(n) keeps growing. Solving:

1 < (365n-n2+n)/(365n-365)

365n-365 < 365n-n2+n

-365 < -n2+n

365 > n2-n

Since n can only be positive integers, the inequality holds exactly for 0 < n < 20. So f(n+1) > f(n) as long as n < 20, and f(n+1) < f(n) as long as n > 19. Hence n = 20 yields the maximum value for f(n), as hinted by superprismatic's simulation. Entering f(20) into the calculator on my computer yields ~0.0323198575490432954774, which is not far from what the simulation yielded.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Let n be your position in the line, there are n-1 people ahead of you. Let A be the event that the people ahead of you all have different birthdays, and let B be the event that you have the same birthday as someone ahead of you. You will win iff both A and B happens. So P(win) = P(A and B) = P(A)*P(B|A). We know that P(A) = 365*364*...*(365-n+2)/365

n-1, and it's easily seen that P(B|A) = (n-1)/365. So P(win) = 365*364*...*(365-n+2)*(n-1)/365n. Consider the function f(n) as being your probability of winning in position n. We seek the value for n which maximizes f(n).

If we compare f(n+1) to f(n), most factors will fortunately cancel out.

f(n+1)/f(n) = 365*364*...*(365-n+2)*(365-n+1)*n/365n+1/(365*364*...*(365-n+2)*(n-1)/365n) = (365-n+1)*n/(365(n-1)) = (365n-n2+n)/(365n-365)

As long as this is greater than 1, the function f(n) keeps growing. Solving:

1 < (365n-n2+n)/(365n-365)

365n-365 < 365n-n2+n

-365 < -n2+n

365 > n2-n

Since n can only be positive integers, the inequality holds exactly for 0 < n < 20. So f(n+1) > f(n) as long as n < 20, and f(n+1) < f(n) as long as n > 19. Hence n = 20 yields the maximum value for f(n), as hinted by superprismatic's simulation. Entering f(20) into the calculator on my computer yields ~0.0323198575490432954774, which is not far from what the simulation yielded.

Nice analysis! I wish I had thought of that.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Let n be your position in the line, there are n-1 people ahead of you. Let A be the event that the people ahead of you all have different birthdays, and let B be the event that you have the same birthday as someone ahead of you. You will win iff both A and B happens. So P(win) = P(A and B) = P(A)*P(B|A). We know that P(A) = 365*364*...*(365-n+2)/365

n-1, and it's easily seen that P(B|A) = (n-1)/365. So P(win) = 365*364*...*(365-n+2)*(n-1)/365n. Consider the function f(n) as being your probability of winning in position n. We seek the value for n which maximizes f(n).

If we compare f(n+1) to f(n), most factors will fortunately cancel out.

f(n+1)/f(n) = 365*364*...*(365-n+2)*(365-n+1)*n/365n+1/(365*364*...*(365-n+2)*(n-1)/365n) = (365-n+1)*n/(365(n-1)) = (365n-n2+n)/(365n-365)

As long as this is greater than 1, the function f(n) keeps growing. Solving:

1 < (365n-n2+n)/(365n-365)

365n-365 < 365n-n2+n

-365 < -n2+n

365 > n2-n

Since n can only be positive integers, the inequality holds exactly for 0 < n < 20. So f(n+1) > f(n) as long as n < 20, and f(n+1) < f(n) as long as n > 19. Hence n = 20 yields the maximum value for f(n), as hinted by superprismatic's simulation. Entering f(20) into the calculator on my computer yields ~0.0323198575490432954774, which is not far from what the simulation yielded.

Nice analysis! I wish I had thought of that.

This is what I alluded to by the point of maximum slope on the cumulative probability curve.

The analysis sounds like that concept, so I wonder whether differentiating its expression as a second approach.

I'm not sure it's precisely what Rainman has done, which is the correct approach.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Let n be your position in the line, there are n-1 people ahead of you. Let A be the event that the people ahead of you all have different birthdays, and let B be the event that you have the same birthday as someone ahead of you. You will win iff both A and B happens. So P(win) = P(A and B) = P(A)*P(B|A). We know that P(A) = 365*364*...*(365-n+2)/365

n-1, and it's easily seen that P(B|A) = (n-1)/365. So P(win) = 365*364*...*(365-n+2)*(n-1)/365n. Consider the function f(n) as being your probability of winning in position n. We seek the value for n which maximizes f(n).

If we compare f(n+1) to f(n), most factors will fortunately cancel out.

f(n+1)/f(n) = 365*364*...*(365-n+2)*(365-n+1)*n/365n+1/(365*364*...*(365-n+2)*(n-1)/365n) = (365-n+1)*n/(365(n-1)) = (365n-n2+n)/(365n-365)

As long as this is greater than 1, the function f(n) keeps growing. Solving:

1 < (365n-n2+n)/(365n-365)

365n-365 < 365n-n2+n

-365 < -n2+n

365 > n2-n

Since n can only be positive integers, the inequality holds exactly for 0 < n < 20. So f(n+1) > f(n) as long as n < 20, and f(n+1) < f(n) as long as n > 19. Hence n = 20 yields the maximum value for f(n), as hinted by superprismatic's simulation. Entering f(20) into the calculator on my computer yields ~0.0323198575490432954774, which is not far from what the simulation yielded.

Nice analysis! I wish I had thought of that.

This is what I alluded to by the point of maximum slope on the cumulative probability curve.

The analysis sounds like that concept, so I wonder whether differentiating its expression as a second approach.

I'm not sure it's precisely what Rainman has done, which is the correct approach.

The method I used is very similar to differentiation. Differentiation also compares f(x) to some nearby value f(x+h), in order to tell whether the function is growing or declining. However, this particular function is only defined for integers, so it's not differentiable unless we first extend it in some way.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Right ... it's "discrete" differentiation.

And that permits a (nice) direct calculation as opposed to simulation.

I simulated the average first-duplicate position and got the kind-of well-known 23.

I am modifying the program now to show the median value.

The distribution is skewed, so the mean is slightly larger.

And, I guess, the median must be the point of greatest slope of the cumulative probability.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.