4

Inspired by this I started to generalize it. Go out from independent events $E_{1},E_{2},\cdots$ that succeed or fail. This with $p$ as probability of succes, and $p+q=1$.

Event $A_{m,n}$ occurs if among the first $n$ events there is a consecutive row of at least $m$ successes. Letting $K$ denote the smallest index of a failing event, we have $P\left(K=k\right)=p^{k-1}q$.

Looking at $P\left(A_{m,n}\mid K=k\right)$ it is easy to find that this probability equals $1$ if $k>m$ and equals $P\left(A_{m,n-k}\right)$ otherwise. So for $m\leq n$ we find:

$P\left(A_{m,n}\right)=\sum_{k=1}^{\infty}P\left(A_{m,n}\mid K=k\right)P\left(K=k\right)=\sum_{k=1}^{m}P\left(A_{m,n-k}\right)p^{k-1}q+p^{m}$.

Here $P\left(A_{m,n-k}\right):=0$ if $m>n-k$.

I thought that this would lead to some unfriendly polynomial in $p$, but working this out for $n=m,m+1,m+2,m+3,...,2m$ a pattern showed up, and with induction I could prove:

$P\left(A_{m,n}\right)=p^{m}\left(1+\left(n-m\right)q\right)$ if $m\leq n\leq 2m$

The fact that this is a neat formula pleases me, but also bothers me. Quite often it indicates that there is a shorter route. Do you know one?

drhab
  • 151,093
  • 1
    A simpler recurrence is: $P_{m,n}=P_{m,n-1}+\left(1-P_{m,n-m-1}\right)qp^m$. The second term is the case where you don't get a run of length $m$ in the first $n-1$ trials but after the $n$th trial there is such a run. – Aravind Feb 24 '19 at 13:50
  • I think it doesn't make a sense of the sum for $k>n+1$ since the event ends at a finite number $n$. – Kumar Nov 03 '19 at 10:10
  • @Kumar The sequence of events $E_1,E_2,\dots$ ends nowhere and nothing is wrong with expressions like $P(A_{m,n}\mid K=k)$ and $P(K=k)$ for $k>n+1$. – drhab Nov 03 '19 at 13:44
  • The sequence of events $E_1, E_2,...$ is a finite sequence only. i.e. it has only $n$ elements. Moreover, to be slack, there is only one Event(independent), whose occurrences make a sequence. – Kumar Nov 03 '19 at 18:39
  • @Kumar Here I profoundly disagree. Nowhere in the question it is stated that $E_1,E_2,\dots$ is a finite sequence. It can at most be observed that the events $E_k$ where $k>n$ are irrelevant if it comes to the question whether events like $A_{m,n}$ occur or not occur. As author of the question I have the full right to state that the sequence is not finite. You can at most say things like: "I would have done that differently". In short: your "observation" that the sequence is finite is wrong. – drhab Nov 09 '19 at 08:59

1 Answers1

2

Hope this late solution helps after 10 years.

Let $m\le n\le 2m$. The sequence of $m$ successes can be started at $s=1, 2, \dots, n-m+1$. For $s= 2, \dots, n-m$, we need a failure at place $s-1$ to have disjoint cases. The events at places $1, \dots, s-2$ or $s+m, \dots, n$ can be failure or success. Hence, the desired probability is $$p^{m}+\left(n-m\right)qp^{m}.$$ This simply gives the formula you found using the recurrence formula and induction:

$$P\left(A_{m,n}\right)=p^{m}\left(1+\left(n-m\right)q\right)$$

The same method can be used to derive the following formula for any $n \ge m$:

$$P\left(A_{m,n}\right)=p^{m}+ qp^{m}\sum_{s=2}^{n-m+1}\left(1-P\left(A_{m,s-2}\right)\right).$$

This can be used to straightforwardly find the explicit expression of the probabilty for other values of $n$. For example, $P\left(A_{m,n}\right)$ for $2m\le n\le 3m$ becomes:

$$p^{m}\left(1+\left(n-m\right)q-p^{m}(n-2m)\left(1+\frac{n-2m-1}{2}q\right)\right).$$

Amir
  • 4,305
  • Excellent! Thank you. Some time ago I already found an answer myself (inspired by the comment of @Aravind ) but yours is even brighter. – drhab Jan 10 '24 at 18:40
  • 1
    @drhab You are very welcome! In the updated answer, I also discussed how the method can be used to find the probability explicitly for other values of $n$. – Amir Jan 10 '24 at 20:48