Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > General Gambling > Probability
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2007, 07:20 PM
muckyouraces muckyouraces is offline
Member
 
Join Date: May 2005
Posts: 83
Default coin flip probability problem

if you flipped a coin 100 times, what would be the odds that at least once during those 100 coin flips, it landed on heads 10 times in a row. what about 1000 coin flips?
Reply With Quote
  #2  
Old 10-07-2007, 07:49 PM
pzhon pzhon is offline
Senior Member
 
Join Date: Mar 2004
Posts: 4,515
Default Re: coin flip probability problem

100 flips: 4.41372%
1000 flips: 38.545%

Mathematica Code:
<ul type="square">
m1 = Transpose[Table[If[i == j - 1, 1/2, 0], {i, 1, 11}, {j, 1, 11}]]
m2 = Table[If[i == 1 &amp;&amp; j &amp;#8800; 11, 1/2, 0], {i, 11}, {j, 11}]
m3 = Table[If[i == 11 &amp;&amp; j == 11, 1, 0], {i, 11}, {j, 11}]
transmat = m1 + m2 + m3
streak[n_] := N[MatrixPower[transmat, n]].{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

streak[100]
{0.478166, 0.2392, 0.119659, 0.0598588, 0.0299441, 0.0149794, 0.00749338, 0.00374853, 0.00187518, 0.000938052, 0.0441372}

streak[1000]
{0.307426, 0.153788, 0.076932, 0.0384849, 0.0192519, 0.00963067, 0.0048177, 0.00241003, 0.00120561, 0.0006031, 0.38545}[/list]The ith position of streak[n] is the probability that the current streak is i-1 heads, except that the 11th position is the probability that you have ever had 10 or more heads.
Reply With Quote
  #3  
Old 10-07-2007, 07:57 PM
gaming_mouse gaming_mouse is offline
Senior Member
 
Join Date: Oct 2004
Location: I call.
Posts: 5,584
Default Re: coin flip probability problem

pzhon,

can you explain the methodology a bit more? sorry i'm not familiar with mathematica code....
Reply With Quote
  #4  
Old 10-07-2007, 08:19 PM
pzhon pzhon is offline
Senior Member
 
Join Date: Mar 2004
Posts: 4,515
Default Re: coin flip probability problem

I used a transfer matrix.

State 0: No streak of 10 heads yet, and the current streak is 0.
...
State 9: No streak of 10 heads yet, and the current streak is 9.
State 10: There has been a streak of length 10 or more.

We can summarize the results after n tosses by a probability distribution on these 11 states, which is supposed to be returned by streak[n].

For all n,

streak[n]
= transmat . streak[n-1]
= transmat^n . {1,0,0,0,0,0,0,0,0,0,0}

where transmat is a transfer matrix which says the probability of moving from one state to the next.

m1 said that if you have a streak of length n, there is a 1/2 probability that it gets longer by 1.
m2 said that if you have a streak of length less than 10, there is a 1/2 chance that it ends, and so you return to state 0.
m3 said that if you are in state 10, you stay in state 10 with probability 1.
The transfer matrix was built from these.
Reply With Quote
  #5  
Old 10-07-2007, 08:35 PM
gaming_mouse gaming_mouse is offline
Senior Member
 
Join Date: Oct 2004
Location: I call.
Posts: 5,584
Default Re: coin flip probability problem

Very cool, thanks.
Reply With Quote
  #6  
Old 10-07-2007, 09:29 PM
BruceZ BruceZ is offline
Senior Member
 
Join Date: Sep 2002
Posts: 4,078
Default Re: coin flip probability problem

[ QUOTE ]
if you flipped a coin 100 times, what would be the odds that at least once during those 100 coin flips, it landed on heads 10 times in a row. what about 1000 coin flips?

[/ QUOTE ]

This post contains a simple Perl script that I wrote awhile back to compute the exact answer to these types of problems, and it links to a post describing how to do the same calculation in Excel. The following is the output of the Perl script for your questions. It agrees exactly with Pzhon's.

<font class="small">Code:</font><hr /><pre>
Probability of 10 events of probability 0.5 in a row in 100 trials = 0.0441372286404217 or 21.6566105485876 to 1

Probability of 10 events of probability 0.5 in a row in 1000 trials = 0.385449752412481 or 1.59437188308236 to 1
</pre><hr />
Reply With Quote
  #7  
Old 10-08-2007, 04:21 PM
R Gibert R Gibert is offline
Member
 
Join Date: Jan 2006
Posts: 53
Default Re: coin flip probability problem

For 10 heads occurring at least once in 100 tosses:

The probability is exactly: 6993823047305143749226306585/158456325028528675187087900672

The odds are exactly:
151462501981223531437861594087 to 6993823047305143749226306585

This assumes fair tosses of a fair coin.

I haven't tried it, but python may not be able to do an exact solution to the 1000 toss case. At least not in the same straight forward way I used.

The method of solution "looks" pretty simple, but isn't really, but it can be found here:

http://mathworld.wolfram.com/Fibonaccin-StepNumber.html
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.