# Maths - probability coin toss!?

2000 coin flips.

Odds of 10 or more heads or tails?

hhhhhhhhhh or tttttttttt

Odds of 10 or more alternating heads and tails?

hththththt or ththththth

Update:

I was thinking, it's 0.5x0.5x0.5x0.5x0.5x0.5x0.5x0.5x0.5x0.5 = 0.0009765 then 1 / 0.0009765 = 1024, so 2000/1024 = 1.95 of the 10 in a row.

Relevance

With 2000 coins, the number of possible sequences of heads or tails is 2^2000. You need to find the number of sequences which have the patterns that you are looking for to find the odds. This is reasonably complicated. The basic idea is to use recursion. Let

x(n) = number of sequences of length "n" with 10 or more heads or tails. Now:

x(n) = 0 for 0 ≤ n ≤ 9

x(n) = 2 for n = 10

In general:

x(n) = x(n-1)*2 + [2^(n-11) - x(n-11)]*2

The first term in the left hand side comes from taking an acceptable sequence of length n-1 and appending a head or a tail to it.

The only type of sequence we didn't count with the first term is a sequence where the only occurrence of 10 heads or tails occurs at the tail end and it is of length exactly 10. This gives the second term on the left hand side.

Let us substitute y(n) = x(n)/2^n in the above equation. We get:

y(n) = y(n-1) + 2^(-10)*[1 - y(n-11)]

You can use a computer program to calculate the y(n) which is the probability. My calculation gives 0.8599. Other interesting values:

x(100) = 0.0867

x(500) = 0.3846

x(1000) = 0.6242

For part (2) of the problem, you get the same recursion and the same initial conditions, so the probability should be the same. It is interesting to note that, for other cases such as ttthhhhhhh (3 tails, 7 heads) or hhhttttttt (3 heads, 7 tails), the probability will be different.

--

@Shtephen, In your problem you asked for 10 consecutive heads or tails i.e., out of all sequences of length 2000, how many sequences will have at least 10 heads (or tails) in a row. I am not sure I follow the logic in your argument -- you cannot just take a probability for a sequence of length 10 and then extrapolate it to larger sequence lengths. Here is a simulation code using Matlab which produced 0.854 as the answer after 1000 trials with 2000 length sequences:

p(1)=0;

for k=1:1000

rand('twister',sum(100*clock));

x=rand(1,2000)>0.5;

j = 1;

max=-1;

for i=2:2000

if x(i) == x(i-1)

j=j+1;

else

if max < j

max = j;

end

j = 1;

end

end

p(k)=max;

end

sum(p>=10)/1000

For the person(s) giving TD, if you have a better solution post it.

• SteveReno
Lv 4
4 years agoReport

i say something went wrong with your calculations
but this is very easy to do in Excel

"My calculation gives x(2000) = 0.8599"
the rounded value you show is for 2002 flips

x(100) = 0.0867
agree rounded

x(500) = 0.3846
what??

x(1000) = 0.6242
you show for 1001 flips