# probability of passing an exam (continued)

Following my previous question, which can be found here: probability of passing an exam, I found out that the probability of passing an exam at the nth try is $p(1-p)^{n-1}$.

If I now assume that taking an exam takes me one hour of work, how many hours on average will I have worked if the maximum number of retries is N (regardless of whether I end up passing the exam or not) ?

-
Mild ambiguity. Does max number of retries is $4$ mean (a) max of tries is $4$ or (b) max number of tries is $5$? Technically, it should be (b), the first time is not a retry, but in casual language it can mean (a). –  André Nicolas Jun 12 '12 at 18:41
You're right I should have used 'tries' instead of 'retries' in my question to make it less confusing, sorry. However I can easily adapt from (a) to (b) so that's not really an issue. If I'm not mistaken, the answer below assumes it to be (a), right? –  TimZEI Jun 12 '12 at 19:54
Right. ${}{}{}{}{}{}{}{}{}$ –  André Nicolas Jun 12 '12 at 20:15

The probability of taking the exam $n$ times is then $p(1-p)^{n-1}$ except for the last, which has probability $(1-p)^{N-1}$ as you stop in any case. The average or expected number of hours is then $$\sum_{i=1}^N P(i)i=\sum_{i=1}^{N-1} ip(1-p)^{i-1}+(1-p)^{N-1}N$$ To sum the series, let $q=1-p$. Then $$\sum_{i=1}^{N-1} ip(1-p)^{i-1}=p\sum_{i=1}^{N-1} iq^{i-1}=p\sum_{i=1}^{N-1} \frac d{dq} q^i=p \frac d{dq} \frac {q-q^N}{1-q}$$
@TimZEI: I thought you would have worked the hour to get ready for the Nth try whether or not you pass. The probability that you take it the Nth time is just the chance you didn't pass before that, $(1-p)^{N-1}$. In the previous problem we were interested in the chance you pass on the Nth time, which is $p$ times this. –  Ross Millikan Jun 12 '12 at 22:01
@TimZEI: That is the sum of the geometric series. In the form $\sum (1-p)^k$ it is the chance that you have not passed after $k$ tries. The fact that this goes to zero as $k$ goes to infinity says you will eventually pass if you keep trying. These geometric series come up frequently. en.wikipedia.org/wiki/Geometric_series has an introduction. I don't see an easy application of $\sum p^k$ in this problem. –  Ross Millikan Jun 12 '12 at 23:56
@TimZEI: The term $(1-p)^k$, which is the probability that you have still not passed after $k$ tries, is what goes to zero. The sum from 1 to k goes to 1, the probability that you have passed after k tries. –  Ross Millikan Jun 13 '12 at 0:35
@TimZEI: I didn't see a full solution from you, but I think the difference is the factor $i$ in my sum. This represents the fact that if you have to take the test 3 times, you will have spent 3 hours preparing. Without the sum you are calculating the average number of tries of the test. Without the maximum N, this should be $\frac 1p$, which is the limit of your expression as $N \to \infty$ –  Ross Millikan Jun 13 '12 at 0:41