[Math] Discrete random variable. Tossing a coin.

random variables

Two coins are simultaneously tossed until one of them comes up a head
and the other a tail. The first coin comes up a head with probability $p$ and the second with probability $q$. All tosses are assumed independent.

(a) Find the PMF, the expected value, and the variance of the number of tosses.

$$P(X=k) = (1-p(1-q) – q(1-p))^{k-1}(p(1 − q) + q(1 − p)), \ \ k=1,2…$$
And the above is clear for me.
Now, we would like determine expected value:
$$E[X] = \sum_{k>0} kP(X=k)$$
and from solution:
$$E[X] = \frac{1}{p(1-q)+q(1-p) }$$
And I don't understand this. Please explain me.

Best Answer

Hint. One may recall the useful evaluation: $$ 1+r+r^2+\cdots+r^n+...=\frac{1}{1-r}, \quad |r|<1, \tag1 $$ giving by differentiation and multiplication by $r$:

$$ \sum_{k>0} k\: r^k=r+2r^2+3r^3+\cdots+nr^{n}+\cdots=\frac{r}{(1-r)^2}, \quad |r|<1\tag2 $$ and now put $$ r:=1-p(1-q) - q(1-p) $$ in $(2)$.