# probability of passing an exam (last thoughts)

So we have seen before (here: probability of passing an exam (continued)) that the average number of hours I would have worked for an exam, assuming I work one hour for an exam that I can pass with a probability p, and assuming I can try to pass it at most N times, is $\sum_{k=0}^{N-1}q^k$. (q=1-p)

I know have one last question. What if this exam is actually composed of r tests, which follow the rules described above (so all tests can be taken at most N times), and the test i can only be passed if i-1 is taken (so if I reach N once, the whole exam is stopped, and thus my number of hours spent into this exam stops growing).

What would then be the average number of hours spent into the exam ?

If the question is unclear please state so and I'll try to reformulate.

edit: maybe a little more explanation is needed as to why the exam requires on average $\sum_{k=0}^{N-1}q^k$ hours of work: $E(X)=\sum_{i=1}^{N-1}iP(X=i)+P(X=N)$, and $P(X=N)=pq^N$. The sum can be calculated by noticing that it's a sum of derivative, and it comes $E(X)=\frac{p}{(1-q)^2} \left( (N-1)q^{N}-Nq^{N-1}+1 \right)$+$pq^N$=(1-q^N)/(1-q)

My question has still not been answered.

-

Well if $X$ is the random variable modelling the number of hours spent into the exam then $$E[X] = \sum_{i=1}^N P(X=i)i$$ $$E[X] = \sum_{i=1}^N q^{i-1}p i = p \frac{\partial}{\partial q}\left( \sum_{i=0}^N q^i \right) = \frac{p}{(1-q)^2} \left( Nq^{N+1}-(N+1)q^N+1 \right)$$
That's very good, thank you. I had actually already found that before, sorry I didn't add the link. I will do so now. Also, there's a slight mistake in your calculus, because the last try has a special treatment. In the end, you end up with a solution very much similar to yours, but which simplify to $(1-q^{N-1})/(1-q)$. So I'm actually more interested in the second part of the question. Please consider for the second part that $E[X]=\sum_{k=0}^{N-1} q^k$. – TimZEI Jun 13 '12 at 8:41