# Probability question

Suppose there is a bottle of pills, if a whole pill is drawn, it is bitten in half then one of the halves is placed back in the bottle. If a half is drawn, then it is taken and it disappears from the bottle. And every pill, half or whole, is equally likely to be picked.

How could I make a function P(n) that tells me the probability of drawing a half after n trials?

Thanks
LVL 25
###### Who is Participating?

Commented:
I have a better and more accurate albeit numerical solution to the Pills Problem.

Let   W(n=0) = N     and    H(n=0) = 0

If you know W(n), you can find:         H(n)  =  2*(N - W(n)) - n

So                                        W(n) + H(n)  =  2*N  - W(n)  - n

You can write a difference equation for the expected value of W(n+1) in terms of W(n)

W(n+1)  =  W(n)  -  (Prob of pulling a whole pill on trial n)

W(n+1)  =  W(n)  -  W(n)/( 2*N - W(n) - n)

You can integrate this eqaution from W(0)=N to solve the problem

=========================================================

Here is my latest Monte Carlo Model:    http://www.geocities.com/d_glitch/Pills3.xls

For W(0) = 1000,  it finds W(1999) = -0.01   and    H(1999) = 1.01     <== Excelent precision

The probability of pulling a half pill after 1999 trials PH(1999) approaches 1 as it should.

The top chart is W(n)  and H(n)   observed and calculated
The second chart is  PH(n) observed and calculated.                           <== This fit is much better than before.

0

Commented:
Hi,

Assume there are N pills

Probability of drawing a half pill "after" 0 trials = 0 (since all are whole pills)

Probability of drawing a half pill "after" 1 trials = 1/N (only one is half pill and others are whole pills)

Now, if half pill was drawn in the second trial,
Probability of drawing a half pill "after" 2 trials = 0
or, if a full pill was drawn in the second trial,
Probability of drawing a half pill "after" 2 trials = 2/N
So, In general,
Probability of drawing a half pill "after" 2 trials = 1/N*0 + (1-1/N)*2/N = 2(N-1)/N²

Continuing with this is somewhat difficult...

---
Harish
0

Author Commented:
Hmm, I see what you mean.

Perhaps there's some sort of recursive algorithm which could be used?
..As it doesn't actually *have* to be a math function; an algorithm is fine..

:\

Any ideas?

Cheers
0

Commented:
Have a look at example 14 in the following link:

http://www.stat.yale.edu/~pollard/stat241/notes2005/all2000notes.pdf
0

Commented:
Rob, not related to probability, but it gives the states which are traversed..

This is an Excel Macro..

Sub States()
Sheets(1).Activate
Sheets(1).Cells.Clear
N = InputBox("Enter N")
Dim i As Double, j As Double, k As Double
For i = N To 0 Step -0.5
m = 0
For j = Int(i) To 0 Step -1
For k = 0 To 2 * i
If ((j + k * 0.5 = i) And (j + k <= N)) Then
m = m + 1
Cells((N - i) * 2 + 1, m) = j & " " & k
End If
Next
Next
Next
End Sub
0

Commented:
err unless you've assume that the 1/2 bitten pill was placed back in the bottle in a random manner (placed back and the bottle was shaken); it can fairly be assumed that the pill will be on top or close to the top of the bottle.

This implies that the 1/2 bitten pill has a better chance of being picked than the normal 1 in N chances.  The pills towards the top of the bottle has a better chance of being pick by the pill popping community than the ones in the bottom of the bottle.

Unless someone has a hand small enough to reach in to the bottle to permit the equal choosing of all pills per the length of the bottle. Or the pills are placed in a big enough bottle where all the pills have an equal chance of being picked....

Regards,

0

Commented:
This is a discrete problem that would probably benefit from an analog solution.

Note that the system will tend to regulate itself so that the number of whole pills and half pills is the same.
If there are more whole pills, they are more likely to get chosen and broken.
if there are more half pills, they are more likely to get chosen and removed.

So I would expect something like

1  -  exp(-kn/N)
P(n)  =   ------------------
2

I would recommend a few simulations to find the value of k.  And I wouldn't be surprised if  k=1  for N > n >> 0.
0

Commented:
And it is to be noted that the probability of picking half pill in the last stage is 1, and the last stage is 2N

So, we know..

P(1) = 0
P(2) = 1/N
P(3) = 2(N-1)/N
...???...
P(2N) = 1
0

Commented:
Sorry.. P(3) = 2(N-1)/N²
0

Commented:
Here is my Excel simulation.  You can change the starting conditions (1000, 0) and k.

http://www.geocities.com/d_glitch/Pills.xls

So I see k=2.  Still trying to understand why it doesn't regulate to 0.5 later though.

1  -  exp(-2n/N)
P(n)  =   ------------------           for N >> n >> 0
2

0

Commented:
This isn't true:
>>   Note that the system will tend to regulate itself so that the number of whole pills and half pills is the same.

If you start off with  W = N whole pills and  H = 0 half pills and run the experiment to the end,
you are guaranteed to pull out N whole and N half pills in 2N trials.

So the average probabilities for whole and half pills in 0.5.

The probability for pulling half pills starts at 0, and grows.  It has to be more than 0.5 at the end of the experiment.

When the number of whole and half pills is equal, the effects of pulling one or the other are not symetric.
=====================================================================

I do believe my mini Monte Carlo model is correct.

N *( exp( -n/N) - exp(-2))
I estimate     W(n)  =  --------------------------------       but it still needs a tweak or two
1-EXP(-2)

H(n)  =  2*(N - W(n)) - n

PH(n) = H(n)/(W(n)+H(n))       ==>            probability of pulling a half pill after n trials

According to the latest model it fits pretty well:

http://www.geocities.com/d_glitch/Pills2.xls

The top chart is W(n)  H(n)    and    W(n)+ H(n)

The second chart is  PH(n) observed and calculated.
0

Author Commented:
Thanks all.

I can actually somewhat understand the logic behind your solution d-glitch :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.