Number of repeated results in a series of coin tosses

159 Views Asked by At

When I execute a series of $n$ coin tosses, with probability of heads being $0.5$, what is the probability distribution for the number of repetitions of heads over the series?

Clarification:$\;$

Two consecutive heads counts as one repetition. For example:

  • The $10$-term sequence TT-HHHH-T-HHH has $5$ repetitions ($3$ from the block HHHH, and $2$ from the block HHH).$\\[4pt]$
  • The $5$-term sequence H-T-H-TT has $0$ repetitions.

Equivalently, when I list all possible $n$-term sequences of heads and tails, I get a list of length $2^n$. For a given integer $r$, with $0\le r\le n-1$, how can I calculate how many times this list contains results with $r$ repetitions.

Edit:$\;$I think I found the answer, with it being simply a binomial distribution with probability $p^r$, where $r$ is the number of repetitions. This is described on the Wikipedia page

https://en.wikipedia.org/wiki/Binomial_distribution#Conditional_binomials

for the binomial distribution, under "conditional binomial".

1

There are 1 best solutions below

0
On

If $n$ is a positive integer, and $r$ is a nonnegative integer, let $f(n,r)$ be the number of $n$-term sequences yielding a rep count of $r$.

Here are two different methods for computing $f(n,r)$ . . .

Method $(1)$:$\;$Using recursion . . .

Let $g(n,r)$ be the number of $n$-term sequences yielding a rep count of $r$, assuming a prior toss of heads.

Then for $f$, we get $$ f(n,r)= \begin{cases} \text{if}\;r > n-1,\;\text{then}\\[5pt] \qquad 0\\[5pt] \text{else if}\;n=1,\;\text{then}\\[5pt] \qquad 2\\[5pt] \text{else}\\[5pt] \qquad g(n-1,r)+f(n-1,r)\\[20pt] \end{cases} \;\;\;\;\; $$ and for $g$, we get $$ g(n,r)= \begin{cases} \text{if}\;r > n,\;\text{then}\\[5pt] \qquad 0\\[5pt] \text{else if}\;n=1,\;\text{then}\\[5pt] \qquad 1\\[5pt] \text{else if}\;r=0,\;\text{then}\\[5pt] \qquad f(n-1,r)\\[5pt] \text{else}\\[5pt] \qquad g(n-1,r-1)+f(n-1,r)\\ \end{cases} $$ As a sample, for $n=10$, the above recursion yields the following results . . . $$ \begin{array} {|c|c|c|c|c|c|c|c|c|c|c|} \hline r&0&1&2&3&4&5&6&7&8&9\\ \hline f(10,r)&144&235&241&187&116&62&25&11&2&1\\ \hline \end{array} $$ Method $(2)$:$\;$Expressed as a summation . . .

Then for $f$, we get $$ f(n,r) = \sum_{h=r}^{\left\lfloor{\large{\frac{n+r+1}{2}}}\right\rfloor} {\small{\binom{h-1}{h-r-1}}}{\small{\binom{n-h+1}{h-r}}} $$ which yields results matching those obtained from the recursion.