# Coin flipping probability?

If a coin is flipped 20 times, what's the chance that at some stage their will be 3 heads in a row?

Thanks

Relevance
• 9 years ago

UPDATE:

I figured out a way to count them, which I'll explain at the end of my answer.

There is saying, if you want to know something,

ask a bunch of people (who may or may not know anything about the question),

and take the average of their responses.

I thought I'd weigh in.

Gianlino: 0.88420963287353515625 (exactly).

If you take the average of those two, you get

(0.6884 + .8842 ) / 2 = .7863

So I wrote a program which counted how many 20-bit strings had a "111" in them.

It was 825529 / 1048576

and that works out to

0.787028

I guess that method of surveying really works !

- - - - - FIRST ADD-ON: - - - - -

Here is a breakdown by first occurrence of HHH:

flip # ... count

1 131072 = 2^17 (H H H (17 more flips))

2 65536 = 2^16 (T H H H (16 more))

3 65536 = 2^16 (x T H H H (15 more))

4 65536 = 2^16 (x x T H H H) (14 more)

5 57344 = 7 * 2^13 ( [not H H H] T H H H (13 more))

6 53248 = 13 * 2^12 but too messy to describe

7 49152 = 24 * 2^11

8 45056 = 44 * 2^10

9 41472 = 81 * 2^9

10 38144 = 149 * 2^8

11 35072 = 274 * 2^7

12 32256 = 504 * 2^6

13 29664 = 927 * 2^5

14 27280 = 1705 * 2^4

15 25088 = 3136 * 2^3

16 23072 = 5768 * 2^2

17 21218 = 10609 * 2^1

18 19513 = 19513 * 2^0

Total: 825259

Here is some data for smaller numbers of flips:

3 flips: 1/8 = 0.125

4 flips: 3/16 = 0.1875

5 flips: 8/32 = 0.25

6 flips: 20/64 = 0.3125

7 flips: 47/128 = 0.3671875

8 flips: 107/256 = 0.4179687

9 flips: 238/512 = 0.4648437

10 flips: 520/1024 = 0.5078125

11 flips: 1121/2048 = 0.5473632

12 flips: 2391/4096 = 0.5837402

13 flips: 5056/8192 = 0.6171875

14 flips: 10616/16384 = 0.6479492

15 flips: 22159/32768 = 0.6762390

16 flips: 46023/65536 = 0.7022552

17 flips: 95182/131072 = 0.7261810

18 flips: 196132/262144= 0.7481842

19 flips: 402873/524288= 0.7684192

- - - - - SECOND ADD-ON - - - - -

Let f(n) = number of sequences with HHH among n flips.

Let g(n) = the rest (those with no HHH)

f(n) + g(n) = 2^n

or g(n) = 2^n - f(n)

Consider the first n flips.

Either there is HHH or not among them.

The number with HHH = f(n).

We can add either a head or a tail to those, it doesn't matter since they already have HHH.

So those will provide 2 * f(n).

For those which don't have HHH,

some of them end in T H H.

If we add an H to those, we'll have an HHH.

How many are there ?

Well there is no HHH among the first n-3 flips,

so it is g(n - 3).

So we have

f(n+1) = 2 * f(n) + g(n-3) = 2 * f(n) + 2^(n-3) - f(n-3).

And from that we can generate the table shown above.

The numbers form sequence A050231 in O E I S:

http://oeis.org/A050231

• 9 years ago

Suppose that a head never appears more than twice in a row. That means that the sequence of 20 tosses consists in

a succession of T,HT, and HHT. So the question is to count the number of combinations of objects of size 1,2 and 3 that make up 20

and divide the result N by 2^20. Finally we'll have P = 1 - N/2^20.

Let x_n the number of possible decompositions that make up to n.

1, 2 = 1 + 1, 3 = 1 + 1 + 1 = 2 + 1 + 1 + 2

So x_1 = 1, x_2 = 2, x_3 = 4.

Beyond this we have the induction relation x_(n+1) = x_n + x_(n-1) + x_(n-2).

So x_n = a*t^n + b*u^n + cv^n, where t, u and v are the roots of

x^3 = 1 + x + x^2

and a,b,c are constants. Only the real root t matters.

Let t = 1.8392867552

Then x_n - a*t^n ---> 0.

We start with 1 2 4 7 13 24 44 and then multiply by t and round up.

We get x_10 = 274, x_15 = 5768 and x_20 = 121415.

Finally your probability is 1 - 121415 / 2^20 = 0.88420963287353515625 (exactly).

Edit: x_20 takes into account only those sequences ending with T; For those ending with TH and THH we must add x_19 and x_18. Total x_18 + x_19 +x_20 = x_21.

So just replace 121415 by the next term 223317 and you get

1 - 223317/2^20 = 0.78702831268310546875.

Same as Math TG: 223317 + 825259 = 2^20

• 9 years ago

You do flip number 1 separately from the other flips

Odds flip 1 is a head = 1/2

Odds that it will be followed by 2 heads = 1/4

Odds of 3 flips in a row beginning with 1 = 1/8

Now the odds for the next 16

Odds that the prior number a tail = 1/2

Odds that the number is a head = 1/2

Odds that that you will have at least 3 flips beginning with that number = 1/16

Next for the overall odds. You calculate that odds of no run of three heads and subtract from 1

Odds no 3heads = (1 - 1/8) (1- 1/16)^16

Odds no 3heads = 7/8 * (15/16)^16

= (14 + 15^16) / 16^17

= 0.3116....

Odds of 3 heads = 1 - (14 + 15^16) / 16^17

= 0.6884...

********* Edit1 *************

lol, I can't count. The odds per my method should be

P = 1 - (14 + 15^17) / 16^18 ≈ 0.70790 ...

However, I run of 30,000 on a spreadsheet and got 78.36%. So it appears that mathman is correct. Why? I don't know.

• 4 years ago

The probability is number of possible instances of an outcome divided by the number of outcomes. So the probability of a coin getting heads or tails is 1/2. Multiply the probability by 1/6 and the probability of getting 4 heads and 2 tails in 6 flips is 1/12.

• 4 years ago

this is so easy when one knows how

too much math, for me,

the others have shown and how many errors can happen?

thought so

so

for just an answer for at least 3 heads in a row in 20 flips

try

WolframAlpha

https://www.wolframalpha.com/input/?i=streak+of+3+...

there are at least 14 different ways to calculate streak probabilities

here is a simple way using a spreadsheet (recursion method)

here is the Google Sheet (have a look)

look at photo or worksheet

cell A1 to A2 = 0

cuz we can NOT get 3 in a row with 1 or 2 flips

cell A3 = p^3 or .5*.5*.5 = easy = prob of 3 in a row in 3 flips

cell A4 = q*p^3 (q=1-p) no head on first flip but 3 in a row

easy

now cell A5 =(1-A1)*q*p^3 + A4

(1-A1) is the probability looking back that the streak did not happen on the 1st flip, followed by a Tail(q) and then 3 Heads in a row

and so on

cell A5 gets filled down to how far you want)

this is simple next to a calculator

• None
Lv 7
9 years ago

Given one head, the probability that it will be followed by two others is 1/4. However, there is a remote possibility that no head will come up in the first 17 tries. Correcting for this, the chance of 3 heads in a row is between 0.2499981 and 0.25

• 9 years ago

This is a long question that will take a while to work out.

Ive just done probability in my class and this would take a while to do.

Find someone who can do it and get them to explain.

• 9 years ago

100% chance, but only if your name is Rosencrantz or Guildenstern.