Computing mean waiting time I have some problems with an exercise I'm doing right now (especially question b). 

There is an unemployed person looking for a job. $N$ is the random variable "number of months until a successful job offer occurs" with the understanding that $N=1$ if a succesful offer occurs in the first month. 
  Let $q$ be the probability that NO successful job offer occurs. 
  Denote $P(N=j)$ the probability that $N=j$ periods. Thus we have that $$P(N=1)=1-q, \,\,\,\,\, P(N=2)=q(1-q)$$

Now the two questions:


*

*a) Compute $P(N=i)$: I think this should be: $q^{(i-1)}(1-q)$ right?

*b) What is the mean waiting time?


Hint: If $S(x) = \sum x^n$ is the geometric series, consider the derivative of $S(x)$ with respect to $x$.
Thanks for your help!
 A: The mean waiting time is given by the expected value of the random variable $N$:
$$E[N] = \sum_{i=1}^{\infty} i \cdot P[N = i] = \sum_{i=1}^{\infty} i \cdot q^{i-1}(1-q)$$
The first equality follows from the definition of expected value. The last equality follows from substituting the expression you found for $P[N = i]$ in part a) of the question. Notice that $\sum_{i=1}^{\infty} i \cdot q^{i-1} = \frac{d}{dq} \sum_{i=1}^{\infty} q^i$. In addition, we know that $\sum_{i=1}^{\infty} q^i = \frac{1}{1-q} - 1$. This is where the hint comes in handy:
$$\begin{align*}
\sum_{i=1}^{\infty} i \cdot q^{i-1} &= \frac{d}{dx} \sum_{i=1}^{\infty} q^i \\
&= \frac{d}{dx} \left (\frac{1}{1-q} - 1 \right) \\
&= \frac{1}{(1-q)^2}
\end{align*}$$
We can substitute this new finding back into our expression for $E[N]$:
$$E[N] = \sum_{i=1}^{\infty} i \cdot q^{i-1}(1-q) = (1-q) \cdot \left (\frac{1}{(1-q)^2} \right) = \frac{1}{1-q}$$
In the second step, we were able to take $1-q$ out of the summation because it does not change with $i$.
