Expected number of failures until $k$ failures or number of trials reach $n$ for bnomial RV

33 Views Asked by At

This is a follow up question on question. That question gives the expected number of trials until $k^{th}$ failure or until the number of trials hit $n$, whichever comes first. Arguing in the same way, I can see that the expected number of failures until $k^{th}$ failure or until the number of trials hit $n$, whichever comes first, will be

$$ \sum_{i=0}^{k-1} i{{n}\choose{i}} p^{n-i}(1-p)^{i} + \sum_{i=k}^n k { i-1 \choose k-1} p^{i-k}(1-p)^k $$

Is that correct ? If not what is wrong with the argument? I saw a recursive formulation for the same which is given below

$$ g(n,k) = \sum_{i=0}^{k-1} i{{n}\choose{i}} p^{n-i}(1-p)^{i} + \sum_{i=k}^n [k +g(n-i,k)] { i-1 \choose k-1} p^{i-k}(1-p)^k $$ I couldn't understand the recursive formulation. Can anyone explain me the difference and what exactly is wrong with non-recursive equation.