Pornrat Ruengrot
Posted on Thursday, 02 January, 2003 - 05:51 pm:

Suppose there is a coin with two face, "H" and "T", and I have to toss it consecutively.
The rule is I will finish once I first get "H".

What is an averge number of time untill I get "H"?

Personally, I think the number of time may be normal distribution with a certain mean.

My friend said the mean is somewhere around 6 and 7 times, is that true? I've got no idea of how to prove it, can anyone do?
Tom Close
Posted on Thursday, 02 January, 2003 - 09:16 pm:

The probability of getting a head first time is 0.5:

P( H1 )=1/2

The probability of a head second time is the probability of a tail then head:

P( H2 )=P(T,H)=1/4

In general:

P( Hn )=1/ 2n

I think this is called a geometric distribution.

The average (mean) number of times is the sum of the number of times weighted according to their probabilities, ie

av = n=1 n/ 2n

(We want the sum to infinity as it is possible to have to throw the coin any number of times before getting a head.)

To sum this:

n=1 n/ 2n =1/ 21 +2/ 22 +3/ 23 +...

=(1/ 21 +1/ 22 +1/ 23 +...)+(1/ 22 +2/ 23 +3/ 24 +...)

=(1+1/ 21 +1/ 22 +1/ 23 +...)(1/ 21 +1/ 22 +1/ 23 +...)

=2×1

=2

I'm not completely sure of the validity of what I have just done but the answer seems believable.

Andre Rzym
Posted on Thursday, 02 January, 2003 - 09:52 pm:

Tom, I agree with your computation. Nice way of summing the series as well.

Another way of summing it would be to say:

S=1/21 +2/22 +3/23 +...
=(1/21 +1/22 +1/23 +...)+(1/22 +2/23 +...)
=1+S/2

So S=2.

Andre
Colin Prue
Posted on Friday, 03 January, 2003 - 01:13 am:

I would have computed the sum in the same way as Andre. I cannot however, see how Tom made the step from the sum of two series to the product of two series.

Tom was correct, this is a geometric distribution, and as a general rule every geometric distribution has mean of 1/p, where p is the probability of success for an individual event (toss in this case)
Demetres Christofides
Posted on Friday, 03 January, 2003 - 08:56 am:

Another way of computing the mean M is the following:

M = 1/2*1 + 1/2(1+M)

If this does not make any sense then ask.

Demetres

Pornrat Ruengrot
Posted on Friday, 03 January, 2003 - 03:34 pm:

I don't quite understand what you wrote, Demetres.

" M = 1/2*1 + 1/2(1+M) "

Can you please explain it a bit more?
Andre Rzym
Posted on Friday, 03 January, 2003 - 08:14 pm:

Just to tie up a few loose ends:

Tom's series product can be derived as follows:

S=1/21 +2/22 +3/23 ...
=(1)(1/21 +1/22 +1/23 ...)+1/21 (1/21 +2/22 +3/23 ...)
=(1+1/21 )(1/21 +1/22 +1/23 ...)+1/21 (1/22 +2/23 +3/24 ...)
=(1+1/21 )(1/21 +1/22 +1/23 ...)+1/22 (1/21 +2/22 +3/23 ...)
=(1+1/21 +1/22 )(1/21 +1/22 +1/23 ...)+1/22 (1/22 +2/23 +3/24 ...)
and so on.

And just to expand on what Demetres wrote: If the first toss is H (prob 1/2) then it took exactly 1 toss. If the first toss is T (prob 1/2) then on average we need a further M tosses before we get a T, i.e. M+1 tosses in total. So the mean, M, is the probability weighted average of 1 and M+1, i.e.

M=(0.5)*(1) + (0.5)*(M+1)

Andre
Gale Greenlee
Posted on Friday, 03 January, 2003 - 08:53 pm:

Isn't there some kind of a general rule that the expected value of the number of trials required to achieve a single event is 1/p, where p equals the probability of the single event occurring? So for (H), 1/(.5)=2 . There is a posting over on "Please Explain" where Demetres helped me with the question for two heads together (HH) which answer is 6. Even though the probability for HH is 1/4. GALE
Andre Rzym
Posted on Friday, 03 January, 2003 - 10:51 pm:

Gale you are absolutely correct. Demetres' equation above gets modified to be:

M=p.1 + (1-p)(M+1)

so

M(1-1+p)=p+1-p
M.p=1
M=1/p

Andre
Colin Prue
Posted on Friday, 03 January, 2003 - 10:52 pm:

Gale, the two questions are slightly different. If you were talking about tossing two coins simultaneously and seeing what they were, E(HH)=4 as the above conversation predicts.

However, in the question you posted in 'please explain', we are tossing A SINGLE coin, and require CONSECUTIVE HH rather than simultaneous HH. Therefore you CANNOT possibly win first toss (as is required by the two coin simultaneous case) because you have not even tossed two coins yet
Colin Prue
Posted on Friday, 03 January, 2003 - 10:53 pm:

Oh and thanks Andre - that is not the sort of step i can handle in my head!
Gale Greenlee
Posted on Thursday, 09 January, 2003 - 04:17 pm:

The remainder of this thread was originally posted in another thread but referred to this one. Editor

To expand on this point; we know the expected value for the number of tosses required (on average) to achieve HH by repeated tosses of one fair coin is six (6). I'll repeat the math here just for reference.M= trying for HH; N= trying for HT; h=H occurred in the first toss; t=T occurred at the first. We can also have th for TH occured first, htt for HTT occured first etc.

For M -- the expected number of tosses to reach HH -- we have

M = (Mh + Mt)/2.

Now Mh = (Mhh + Mht)/2 = (2 + (1+Mt))/2 = (3+Mt)/2,
and Mt = (Mth + Mtt)/2 = ((1+Mh) +(1+Mt))/2 = (2 + Mh + Mt)/2.

Solving the two above equations gives Mh = 5 and Mt = 7, so M = 6.

Similarly, for N we have N = ((Nh + Nt)/2 with

Nh = (Nhh + Nht)/2 = ((1+Nh) + 2)/2, and Nt = (Nth + Ntt)/2 = ((1+Nh) + (1+Nt))/2.

Solving gives Nh = 3 and Nt = 5, so N = 4.

Here is my question. Could someone prepare a simultaion, perhaps on an excel worksheet, to show that six tosses are in fact required, on average, to achieve HH?

Gale
Andre Rzym
Posted on Thursday, 09 January, 2003 - 04:49 pm:

I hope this works for you.

If you get a warning on opening the spreadsheet about macros, click on "enable macros"

Open the spreadsheet (see next post), and run the macro "Macro1" [to do this click on tools -> macro -> macro and choose "macro1"]

When you run it, you will get a popup box giving a number around 6.

If you want to view the code, right click on the "sheet1" tab at the bottom, choose "view code", then on the left click on "module1".

Andre
Andre Rzym
Posted on Thursday, 09 January, 2003 - 04:56 pm:

Here's the file, sorry:

application/vnd.ms-excelgale.xls
gale.xls (24 k)


Andre
Gale Greenlee
Posted on Thursday, 09 January, 2003 - 05:53 pm:

To Andre: Thanks. Everything seems to work. I was able to read everything. Thanks again.

Gale