The Probability of Runs of k Consecutive Heads in n Coin Tosses

Problem: What’s the probability that at least one run of k consecutive heads occurs in n coin tosses?


Method One:

Definitions:

Theorem:

P(A & B) + P(A & ~B) = P(A)

Analysis:

If n = k, R{k,n} occurs in exactly once case, so H(k,n) = 1.

If n < k, R{k,n} is impossible, so H(k,n) = 0.

Otherwise(n > k), H(k,n) permutations can be divided into two groups: (a) R{k,n-1}, and (b) ~R{k,n-1}.

  1. R{k,n-1}

    R{k,n} follows necessarily. There are 2H(k,n-1) permutations of this kind.

  2. ~R{k,n-1}

    R{k,n} occurs only if the last k-1 of the first n-1 toss are all heads and the nth toss is head. Then the kth last toss of the first n-1 tosses must be tail, otherwise the last k of the first n-1 tosses are all heads, which contradicts ~R{k,n-1}. Hence, the last k+1 tosses are fixed as [T,H,H,...,H].

    Definition:

    • S: the fact that the last k+1 tosses of n tosses are [T,H,H,...,H].

    The condition now turns out to be ~R{k,n-1} & S, which is equivalent to ~R{k,n-k-1} & S. Thus the permutation number is

    P(~R{k,n-k-1} & S) = P(S) – P(R{k,n-k-1} & S) = 2(n-k-1) – H(k,n-k-1).

Thus,


Method Two:

A cool method using probability distribution vector and probability distribution transition matrix. The original post is in Chinese. I am trying to translate it into English below. The author even proved the property used in Method Three along the line; however, this part is beyond my knowledge.

The states during the process of coin tossing is defined as follows:

Lemmas:

Definition:

Initially, d0 = [1;0;0;...;0]; di+1 = M ⋅ di, wherein M is the probability distribution transition matrix.

M can be reduced from lemmas above:

Thus, the last element of dn is the probability desired, denoted as P.

P = [0,0,...,0,1] ⋅ dn = [0,0,...,0,1] ⋅ Mn ⋅ d0.


Method Three:

Use the fact “the probability that no runs of k consecutive tails will occur in n coin tosses is given by F_(n+2)^((k))/2^n, where F_l^((k)) is a Fibonacci k-step number” from mathworld.wolfram.com/CoinTossing.html.


2 Comments

Since the probability is F_{n+2}^{(k)}/2^n. I have found that the formula for the k-step Fibonacci number is round((r-1)r^{n-1}/((k+1)r-2k)), where r is the k-anacci constant, or the real root of x^k(2-x)=1 which is more than 1.
This formula could be used to calculate the probability easily.

I worked this problem to death with the results posted here:

http://marknelson.us/2011/01/17/20-heads-in-a-row-what-are-the-odds/

I have one more post coming in which I’ll show a fairly economical way to calculate the probability. I used that method to determine how many tosses one would need to be “certain” of seeing 20 heads in a row.

I don’t think Zhaohi’s comment on the formula for the k-step Fibonacci number is correct.

Leave a Comment