We toss symmetrical coin $10$ times. Calculate probability of tails appearing at least five times in a row.

I tried by dividing by cases (the row TTTTT I observe as one object); first case exactly $5$ tails, second exacty $6$ tails etc. For the first case I decided to separate cases when the tails appear from the first toss to the fifth toss and when they appear from $i$th toss to $(i+5)$th toss but each time I get stuck on that case.

  • $\begingroup$ You're going to want to use the binomial expansions $\endgroup$
    – Kendall
    Mar 17, 2019 at 9:27
  • 1
    $\begingroup$ Define $A_i$ to be the set of outcomes in which $5$ consecutive tails occur, beginning in position $i$, $1 \leq i \leq 6$, then use the Inclusion-Exclusion Principle. $\endgroup$ Mar 17, 2019 at 10:29

4 Answers 4


This is easier than it looks! There are six mutually exclusive cases:

  1. First five throws are Tails: probability = $\frac{1}{32}$
  2. First throw is a Head, and next five throws are Tails: probability = $\frac{1}{64}$
  3. Second throw is a Head, and next five throws are Tails: probability = $\frac{1}{64}$
  4. Third throw is a Head, and next five throws are Tails: probability = $\frac{1}{64}$
  5. Fourth throw is a Head, and next five throws are Tails: probability = $\frac{1}{64}$
  6. Fifth throw is a Head, and next five throws are Tails: probability = $\frac{1}{64}$

So the total probability is $\frac{7}{64} = 0.109375$.

Note that this method doesn't work if there are more than ten throws, because then you have to guard against double counting (e.g. T T T T T H T T T T T).


I recognize that this probably isn't the desired way of approaching this, but this will nonetheless give someone else a check of their work. This problem is identical. We have that, in general, with a sequence of $n$ Bernoulli trials each with probability of success being $p$, the probability of obtaining at least $m$ consecutive successes in the sequence is given by$$\mathbb{P}(\ell_n \geq m)=\sum_{j=1}^{\lfloor n/m\rfloor} (-1)^{j+1}\left(p+\left({n-jm+1\over j}\right)(1-p)\right){n-jm\choose j-1}p^{jm}(1-p)^{j-1}.$$

With $n=10$, $m=5$, and $p=0.5$ we get

$$\mathbb{P}(\ell_n \geq m)=0.109375$$

As a perhaps cumbersome way of simulating this using R statistical software:

coin <- c("H","T")
for(i in seq(1,10^6,1)){
  else if(u[2]=="T"&u[3]=="T"&u[4]=="T"&u[5]=="T"&u[6]=="T"){count=count+1}
  else if(u[3]=="T"&u[4]=="T"&u[5]=="T"&u[6]=="T"&u[7]=="T"){count=count+1}
  else if(u[4]=="T"&u[5]=="T"&u[6]=="T"&u[7]=="T"&u[8]=="T"){count=count+1}
  else if(u[5]=="T"&u[6]=="T"&u[7]=="T"&u[8]=="T"&u[9]=="T"){count=count+1}
  else if(u[6]=="T"&u[7]=="T"&u[8]=="T"&u[9]=="T"&u[10]=="T"){count=count+1}


> 0.109379

which is accurate up to $5$ decimal places.


It may be easier to find the probability that a sequence of five tails does not occur.

There are $2^{10}$ possible sequences of coin tosses, all of which we assume are equally likely. We would like to count the number of sequences which does not contain a sequence of five tails in a row.

One way to do this is with a set of recursive equations. Define $a_i(n)$ to be the number of sequences of $n$ coin tosses which do not contain a run of five tails and which end in $i$ tails, for $i=0,1,2,3,4$. Clearly $a_0(1) = a_1(1) = 1$ and $a_i(1) = 0$ for $i=2,3,4$. Any sequence of $n$ tosses followed by a head results in a sequence of $n+1$ tosses ending in zero tails; so $$a_0(n+1) = a_0(n) + a_1(n) + a_2(n) + a_3(n) + a_4(n) $$ for $n > 1$. The only way to get $n+1$ tosses ending in a sequence of $i$ tails for $i > 0$ is to start with a sequence of $n$ tosses ending in $i-1$ tails and then get a tail on the $(n+1)$th toss; so $$a_i(n+1) = a_{i-1}(n)$$ for $i=1,2,3,4$ and $n>1$.

Using these equations and the given initial conditions, we can calculate $a_i(n)$ for $0 \le i \le 4$ and $n$ as large as we want. (It's easy to do on a spreadsheet; see below.) The total number of sequences of length $n$ not containing any run of five tails is then $\sum_{i=0}^4 a_i(n)$, and the probability of such a sequence is $$\frac{\sum_{i=0}^4 a_i(n)}{2^n}$$ We are interested in the case $n=10$. By calculation, we find $\sum_{i=0}^4 a_i(10) = 912$, so the probability that a sequence of $10$ coin tosses does not include a sequence of five tails is $912/2^{10}$. The answer to the original question, the probability that a sequence of $10$ tosses contains at least one sequence of five tails, is $$\boxed{1-\frac{912}{2^{10}}}$$

In case it's not clear how to calculate the $a_i(n)$ values, here are the first few rows of my spreadsheet, containing $a_i(n)$ for $0 \le i \le 4$ and $1 \le n \le 5$, just to get you started. The first row is for $n=1$, the second for $n=2$, etc. Not shown are the spreadsheet formulas which perform the calculations. $$\begin{matrix} 1 &1 &0 &0 &0\\ 2 &1 &1 &0 &0\\ 4 &2 &1 &1 &0\\ 8 &4 &2 &1 &1\\ 16 &8 &4 &2 &1\\ \end{matrix}$$


To complement the other answers, you can do backtracking to at least know what the solution is going to be. It's been some time since I've programmed in C++, so I've found this problem a good excuse to remember how to do some things. The code is

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

typedef vector<int> VE;

VE c; 
int n, count;

void f(int i, int consec, bool b){
    if (i == 10) {
        if (consec == n) b = true;
        if (consec <= n and b){
            //for (int j = 0; j < 10; ++j) cout << c[j] << ' ';
            //cout << endl;
    if (consec > n) return;
    if (consec == n) b = true;
    c[i] = 1;
    f(i+1, consec+1, b);
    c[i] = 0;
    f(i+1, 0, b);

int main(){
    int total = 0;
    for (int i = 0; i <= 4; ++i){
        c = VE(10);
        n = i; count = 0;
        f(0,0, false);
        total += count;
    cout << 1 - total/pow(2,10) << endl;

The output is $0.109375$

The function finds how many sequences have $n$ tails appearing in a row (and no more).

In general, we find $1 - P$(a sequence of five or more tails does not occur), so we'll call the function for $n=1,2,3,4$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .