Log in

No account? Create an account
A-level probability question, to bring joy to children at Christmas:… - Sally's Journal — LiveJournal
November 19th, 2013
12:01 pm


Previous Entry Share Next Entry

(33 comments | Leave a comment)

[User Picture]
Date:November 19th, 2013 12:13 pm (UTC)
There was a similar question on facebook a while ago:

I wonder how many facebook friends you need so that you are more like than not to have a friend with a birthday on every single day of the year?

This was solved neatly by Ben:

Under (presumably) the same assumptions as above (uniform distribution of birthdays, ignoring leap years):

Define P(N,D) to be the probability that N people have exactly D different birthdays. Then we want to find the smallest N* such that P(N*,365)>0.5.

I'm thinking induction is the way to go. Suppose we have P(N-1,d) for all d, i.e. we know the chance of N-1 people having exactly d birthdays (for d = 1, 2, ... N-1).

Then to get P(N,D) there are two ways:
1) The N-1 people had D-1 different birthdays and the Nth person has a different birthday. The chance of this is (365-(D-1))/365 = (366-D)/365.
2) The N-1 people had D different birthdays and the Nth person has the same birthday as one of them. The chance of this is D/365.

So the recursion is
P(N,D) = [ P(N-1,D) * D + P(N-1,D-1)*(366-D) ]/365
with initial conditions P(1,1) = 1 and P(1,D) = 0 for D>1.

You can probably solve this with generating functions, but to be honest I don't care that much! A simple bit of code gives N* = 2287. This is pretty close to Vincent's answer. I wonder what happens if Vincent computes the median, and not the mean? Of course, since I said the code was simple, it's also quite possible that I made a mistake!


I think this is probably the solution for this... define P (N,X) as the probability after buying N Octonauts you have X Octonauts that you want? (I did this as P(N,O) with O for Octonaut initially, but it's _awful_ notation, because O looks like 0) Then we could have the recursion as P (N,X) = P(N-1,X) * P(didn't get an octonaut you want, given you already have X) + P (N-1,X-1)* P (did get an octonaut you want, given you already have X-1)

P(didn't get an octonaut you want, given you already have X) is easy, it's (X+3)/8 (so as soon as you have all 5, you never get an octonaut you want). Likewise P (did get an octonaut you want, given you already have X-1) is (6-X)/8

But I don't know how to actually do the recursion and calculate the answer...

Edited at 2013-11-19 12:16 pm (UTC)
[User Picture]
Date:November 19th, 2013 12:17 pm (UTC)
Presumably if I could calculation the answer, the answer is to find the smallest N such that P(N,5) > 0.9 ...
[User Picture]
Date:November 19th, 2013 12:22 pm (UTC)
Also, what is P(10,5)? 'Hmm, get about 10, that'll probably do' seems to be most people's intuition...
[User Picture]
Date:November 19th, 2013 01:44 pm (UTC)
OK, it turns out you can do this in an excel spreadsheet (you just calculate P(1,0) and P(1,1) and then stick in the formula for the recursion.

P(10,5) is a miserable 16% (although you'll have a 44% chance of having that oh-so-frustrating 4)

To actually get P(N,5) > 0.90, you need to order 30 Octonauts.

On the other hand, a pile of 30 Octonauts would be great :-)
[User Picture]
Date:November 19th, 2013 02:45 pm (UTC)
I guess it depends what happens to the surplus. Do they just get returned to the warehouse? Or do they assemble into one giant robot Octonaut that saves the planet!?
Date:November 19th, 2013 02:51 pm (UTC)
You are fabulous! (and I'm quite pleased that this turned out to be a not trivially easy problem, rather than just that my brain has turned to complete mush after having children, though I was never very good at thinking in the right way for probability questions)

I couldn't quite bring myself to order in 30 sets of figures, so have ordered 10 and will report back on Thursday when I pick them up about what I ended up with. My disappointment at the dismal success rate predicted is improved slightly by the thought that once I've bought the figures at offer price, I can then order more in if needed and exchange even after the offer has finished. I'm sure all this would be easier if any of the Tescos in a 20 mile radius actually stocked the darned things.
[User Picture]
Date:November 19th, 2013 02:58 pm (UTC)
On the bright side, if you do get the five you want, you can feel very smug about not only have the five you want, but also about knowing how lucky you were to manage it! :-)

We have a big tescos with lots of toys that is our local, so if you do end up trying to hunt down Just One, let me know... I haven't specifically looked for Octonauts though.
[User Picture]
Date:November 19th, 2013 01:50 pm (UTC)
Can't you have a stab at this with expected values?

When you've bought 0 Octonauts, the expected number that you've got that you want is 3.

When you've bought 1, it's 3 + 5/8

When you've bought 2, it's 3 + 5/8 + (4 3/8)/8

When you've bought 3 ... and then your criterion for stopping is something like an expectation value of 7.2. Maybe.
Powered by LiveJournal.com