I'd like to find an answer for calculating the following recurring events:
You have $X$ opportunities of picking a ball from a sack. Every time after a ball is picked, the ball is returned to the sack. The probability of picking ball A is $Y$. Every time you pick ball A from the sack awards you another $X$ opportunities of picking.
Let $Z$ be the average number of opportunities: (my calculation, may be wrong)
$Z = X\times (1-Y)^X + 2X\times (1-Y)^{2X-1}\times Y + 3X\times (1-Y)^{3X-2}\times Y^2 \\ \quad + 4X\times (1-Y)^{4X-3}\times Y^3 + ... + nX\times (1-Y)^{nX-n+1}\times Y^{n-1}$
Is there a formula to determine the exact value of $Z$?
Thanks!
Same as before: if $n$ opportunities are left before the next pick, after the pick there may be $n+X-1$ or $n-1$ left and these occur with probabilities $Y$ and $1-Y$ respectively. Thus the average number of opportunities $Z_n$ starting from $n$ opportunities left is such that $$Z_n=1+YZ_{n+X-1}+(1-Y)Z_{n-1}.$$ Since $Z_n=nZ_1$, this yields $Z_n=n/(1-YX)$, assuming that $YX\lt1$. In particular, $$Z_X=X/(1-YX).$$ If $YX\gt1$, one never goes broke with positive probability hence $Z_n=+\infty$ for every $n\geqslant1$. If $YX=1$, one goes broke with full probability but the time it takes has infinite average.