Suppose you draw repeatedly at random with replacement from a population in which a proportion $p$ of the individuals are in Class $A$ and the remaining proportion $q = 1-p$ in Class $B$. Let $D$ be the number of draws till both classes have appeared. Find $E(D)$ by using the tail sum formula.
EDIT: I am having difficulties approaching this problem. I am trying to frame it as the number of coin tosses until heads appear considering tails will have appeared before (assuming the first toss wasn't a success). Any help would be greatly appreciated.
Hint:
$D$ is a random variable taking values in $\mathbb N$ and applying the tail sum formula we find: $$\mathbb ED=\sum_{n=0}^{\infty}P(D> n)\tag1$$
Here event $\{D> n\}$ can be recognized as the event that the first chosen $n$ individuals are all of the same class.
So calculate the probability on these events, substitute in $(1)$ and calculate.