POV-Ray : Newsgroups : povray.off-topic : Problem of the day Server Time
5 Nov 2024 14:20:43 EST (-0500)
  Problem of the day (Message 1 to 10 of 34)  
Goto Latest 10 Messages Next 10 Messages >>>
From: scott
Subject: Problem of the day
Date: 17 Dec 2008 08:49:39
Message: <49490373$1@news.povray.org>
If you have a box with N balls numbered 1 to N, and you repeatedly pull one 
out at random (replacing it each time), on average how many times would you 
expect to pull out a ball until you have seen all the balls 1 to N?


Post a reply to this message

From: Invisible
Subject: Re: Problem of the day
Date: 17 Dec 2008 09:01:49
Message: <4949064d$1@news.povray.org>
scott wrote:
> If you have a box with N balls numbered 1 to N, and you repeatedly pull 
> one out at random (replacing it each time), on average how many times 
> would you expect to pull out a ball until you have seen all the balls 1 
> to N?

N is trivially the lower bound.

Each ball appears with probability 1/N, so the probability for all balls 
to appear (given that these events are clearly independent) in N trials 
would be (1/N)^N, which is 1/(N^N).

Hmm, but wait! This does not count for ordering. There are N! 
permutations of N events, so taking *that* into account, we now actually 
have N! / N^N.

Now, if we perform K trails, the probability of seeing all the balls is 
(N! + (K-N)!) / N^N. (Assuming K >= N.)

Assuming that by "on average" you mean "with probability > 50%", it is 
now a matter of choosing K such that the above formula comes out to more 
than 0.5.


Post a reply to this message

From: scott
Subject: Re: Problem of the day
Date: 17 Dec 2008 09:14:30
Message: <49490946$1@news.povray.org>
> Now, if we perform K trails, the probability of seeing all the balls is 
> (N! + (K-N)!) / N^N. (Assuming K >= N.)

Can you explain how you got that formula?


Post a reply to this message

From: Invisible
Subject: Re: Problem of the day
Date: 17 Dec 2008 09:18:33
Message: <49490a39@news.povray.org>
scott wrote:
>> Now, if we perform K trails, the probability of seeing all the balls 
>> is (N! + (K-N)!) / N^N. (Assuming K >= N.)
> 
> Can you explain how you got that formula?

Intuitively, assuming N trials the formula is just N! / N^N, so if we 
add (K-N) extra trails, you get the formula above.

On reflection, I'm not sure that's actually correct...


Post a reply to this message

From: scott
Subject: Re: Problem of the day
Date: 17 Dec 2008 09:29:22
Message: <49490cc2$1@news.povray.org>
>>> Now, if we perform K trails, the probability of seeing all the balls is 
>>> (N! + (K-N)!) / N^N. (Assuming K >= N.)
>>
>> Can you explain how you got that formula?
>
> Intuitively, assuming N trials the formula is just N! / N^N, so if we add 
> (K-N) extra trails, you get the formula above.
>
> On reflection, I'm not sure that's actually correct...

What if K=5 and N=2? I think the answer should be a 30/32 chance of seeing 
both balls, but your formula gives 8/4 !


Post a reply to this message

From: Invisible
Subject: Re: Problem of the day
Date: 17 Dec 2008 09:41:27
Message: <49490f97$1@news.povray.org>
Invisible wrote:

> N is trivially the lower bound.
> 
> Each ball appears with probability 1/N, so the probability for all balls 
> to appear (given that these events are clearly independent) in N trials 
> would be (1/N)^N, which is 1/(N^N).
> 
> Hmm, but wait! This does not count for ordering. There are N! 
> permutations of N events, so taking *that* into account, we now actually 
> have N! / N^N.
> 
> Now, if we perform K trails...

Let's try that again...

If we select one ball, the probability of it being ball #1 is 1/N.

If we select K balls, the probability of ball #1 appearing becomes 1/N + 
1/N + 1/N + 1/N + ... K times over, minus the probability of ball #1 
appearing more than once.

In other words, we have K/N - E, and I can't figure out how to compute E.

(Presumably combinatorics provides a trivial way to solve this. Too bad 
I don't know combinatorics, eh?)


Post a reply to this message

From: scott
Subject: Re: Problem of the day
Date: 17 Dec 2008 09:52:31
Message: <4949122f$1@news.povray.org>
> If we select K balls, the probability of ball #1 appearing becomes 1/N + 
> 1/N + 1/N + 1/N + ... K times over, minus the probability of ball #1 
> appearing more than once.
>
> In other words, we have K/N - E, and I can't figure out how to compute E.

You can think of it the other way round, ie the probability of ball #1 
appearing after K tries is 1 minus the probability of ball #1 not occurring 
after K tries.  That is 1-((N-1)/N)^K.


Post a reply to this message

From: Invisible
Subject: Re: Problem of the day
Date: 17 Dec 2008 10:18:38
Message: <4949184e@news.povray.org>
scott wrote:
>> If we select K balls, the probability of ball #1 appearing becomes 1/N 
>> + 1/N + 1/N + 1/N + ... K times over, minus the probability of ball #1 
>> appearing more than once.
>>
>> In other words, we have K/N - E, and I can't figure out how to compute E.
> 
> You can think of it the other way round, ie the probability of ball #1 
> appearing after K tries is 1 minus the probability of ball #1 not 
> occurring after K tries.

Ah. So instead of a chain of non-exclusive OR events, you construct a 
chain of independent AND events? Ingenius...


Post a reply to this message

From: Mike Raiford
Subject: Re: Problem of the day
Date: 17 Dec 2008 10:48:18
Message: <49491f42$1@news.povray.org>
scott wrote:
> If you have a box with N balls numbered 1 to N, and you repeatedly pull 
> one out at random (replacing it each time), on average how many times 
> would you expect to pull out a ball until you have seen all the balls 1 
> to N?

I'm sure the answer is in the back of a textbook somewhere ... :)



-- 
~Mike


Post a reply to this message

From: Phil Cook v2
Subject: Re: Problem of the day
Date: 17 Dec 2008 12:08:41
Message: <op.umbgj7wlmn4jds@phils.mshome.net>
And lo On Wed, 17 Dec 2008 13:49:38 -0000, scott <sco### [at] scottcom> did  
spake thusly:

> If you have a box with N balls numbered 1 to N, and you repeatedly pull  
> one out at random (replacing it each time), on average how many times  
> would you expect to pull out a ball until you have seen all the balls 1  
> to N?

Do a search for Coupon Collector's Problem. For equal random drawings it's  
roughly nHn that is n * Sum k=1-n of 1/k multiplied by n

-- 
Phil Cook

--
I once tried to be apathetic, but I just couldn't be bothered
http://flipc.blogspot.com


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.