Expected number of trials until $k$ failures or number of trials reach $n$

363 Views Asked by At

I am trying to find the expected number of trails until the $k$-th failure or until the number of trials hit $n$, whichever comes first. The success probability of the trial is $p$.

My calculation gave me the below result. $$ \sum_{i=0}^{k-1} i{{n}\choose{i}} p^{n-i}(1-p)^{i} + \sum_{i=k}^n i { k-1+i \choose i} p^{i}(1-p)^k $$

But it seems the result is $$ \sum_{i=0}^{k-1} i{{n}\choose{i}} p^{n-i}(1-p)^{i} + \sum_{i=k}^n i { i-1 \choose k-1} p^{i-k}(1-p)^k $$

I don't know what is wrong with my result and how I can get the correct result.

2

There are 2 best solutions below

4
On BEST ANSWER

Both expressions are wrong. The correct one is $$ \sum_{i=0}^{k-1} \color {red}n{{n}\choose{i}} p^{n-i}(1-p)^{i} + \sum_{i=k}^n i { i-1 \choose k-1} p^{i-k}(1-p)^k.\tag1 $$ Here the first term accounts for the events with the number of failures ($i $) in $n $ trials being less than $k $, and the second term accounts for the events with $k $ failures (the $k $-th failure being achieved in $i $-th trial).

The equation (1) can be written also in a more symmetric form: $$ n\sum_{i=0}^{k-1}{{n}\choose{i}} p^{n-i}(1-p)^{i} + k\sum_{i=k}^n { i\choose k} p^{i-k}(1-p)^k.\tag2 $$

5
On

Let $T$ denote the number of trials until the $k$-th failure. The distribution of $T$ is given by $$ \mathsf{P}(T=i)=\binom{i-1}{k-1}(1-p)^kp^{i-k},\quad i\ge k. $$ Then (assuming that $n\ge k$) the expectation of $T\wedge n$ is $$ \mathsf{E}[T\wedge n]=\sum_{i=k}^\infty (i\wedge n)\cdot \mathsf{P}(T=i)=\sum_{i=k}^n i\cdot \mathsf{P}(T=i)+n\cdot \mathsf{P}(T>n), $$ and $$ \mathsf{P}(T>n)=\sum_{i=0}^{k-1}\binom{n}{i}(1-p)^ip^{n-i}, $$ i.e., it is the probability that the number of failures in the first $n$ trials is less than $k$. Alternatively, $$ \mathsf{P}(T>n)=1-\sum_{i=k}^{n}\binom{i-1}{k-1}(1-p)^kp^{i-k}, $$