[Math] On the number of consecutive tails when flipping a biased coin

probability

Say we flip a biased coin such that the probability of getting the same outcome in a row (head-head or tail-tail) is $p$.

What is the probability of getting three or more tails consecutively out of $n$ flips (and alternatively out of infinite number of flips).

For example: TTT-H-TTT-HH-TTTT…

I am looking for:

  1. The fraction of tails that are in sections of size three or more.
  2. The expected size of sections with tails.

Best Answer

I’ll consider the case of an infinite string of coin tosses, as it’s easier.

Start with anon’s suggestion. Let $q$ be the probability that the coin comes up tails. Then the probability of getting two tails in a row must be $q^2$, and the probability of getting two heads in a row must be $(1-q)^2$, so you know that $p=q^2+(1-q)^2=2q^2-2q+1$, and therefore $$q=\frac14\left(2\pm\sqrt{4-8(1-p)}\right)=\frac12\left(1\pm\sqrt{2p-1}\right)\;.$$ One of the solutions is $q$; the other is $1-q$, the probability that the coin comes up heads. There’s no way to decide which is which without further information.

At any stage in the process the probability of a run of $n$ tails is $q^n(1-q)$, so the expected length of a run of tails is $\sum_{n\ge 0}nq^n(1-q)$. However, this includes runs of length $0$, which you don’t want to count, so an adjustment is needed. The probability of a run of length $0$ is $1-q\,$, so the probability of a run of positive length is $q$, and for $n>0$ the probability of a run of length $n$ given that the run has positive length is therefore $$\frac{q^n(1-q)}q=q^{n-1}(1-q)\;.$$ Thus, the expected length of a non-zero run of tails is $$\sum_{n\ge 1}nq^{n-1}(1-q)=(1-q)\sum_{n\ge 1}nq^{n-1}=\frac{1-q}{(1-q)^2}=\frac1{1-q}\;.$$

This is a fairly standard summation, but if you’re not familiar with it, just differentiate $$\sum_{n\ge 0}x^n=\frac1{1-x}\;.$$

For $k=1,\dots,n$ the probability that a given tail is the $k$-th of a run of $n$ tails is $q^{n-1}(1-q)^2$ (since we may ignore edge the effects at the beginning of the infinite string of tosses), so the probability that it belongs to a run of $n$ tails is $nq^{n-1}(1-q)^2$, and the probability that it belongs to a run of at least three tosses is $$\begin{align*}\sum_{n\ge 3}nq^{n-1}(1-q)^2&=(1-q)^2\sum_{n\ge 3}nq^{n-1}\\ &=(1-q)^2\left(\frac1{(1-q)^2}-(1+2q)\right)\\ &=q^2(3-2q)\;; \end{align*}$$

this is the fraction of tails belonging to runs of three or more.

Related Question