Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to calculate an appropriate timeout time for a real time simulator that I'm writing:

For p = probability of success, the time for a successful request = m, and the time for a failed attempt = f. What is the average time for 5 successful requests?

share|cite|improve this question
can you be more specific about the problem? when you say "time for a successful request=m" what does that mean? – jay-sun Oct 26 '12 at 23:40
up vote 0 down vote accepted

Assume requests are independent. Denote the number of unsuccessful requests until the $r$th success by $X$. Then $X$ has a negative binomial distribution, $P(X=k) = {k+r-1 \choose k} p^{r-1}(1-p)^kp $ because in the first $k+r-1$ attempts there are $k$ failures and $r-1$ successes, while the $(k+r)$-th attempt is successful.

$X$ has the same distribution as the sum of $r$ independent geometrically distributed random variables, thus its expectation is $\mathrm{E}X= r\cdot(1-p)/p$.

Now for the waiting time $Y$. Clearly $Y = rm + Xf$. Thus $\mathrm{E}Y = rm +\mathrm{E}Xf$. Plugging in $\mathrm{E}X$ gives $\mathrm{E}Y = rm + (r(1-p)/p)f$. Plug in $r=5$ to finish.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.