[Math] How many flips to get at least one heads and at least one tails

conditional probabilityexpectationprobability

A coin having probability $p$ of coming up heads is continually flipped until both heads and tails have appeared. Find the expected number of flips.

Here's my guess: $$E[\text{at least one head and at least one tails]}=E[\text{number of flips until first heads, given the first flip is a tails}]*P(\text{first flip is tails})+E[\text{number of flips until first tails, given the first flip is a heads}]*P(\text{first flip is heads})=\left({1+\frac{1}{p}}\right)(1-p)+\left({1+\frac{1}{1-p}}\right)p$$

Does this look right? If so, can you help me understand why it's right? I mainly came up with this on intuition. If it's wrong, where did I go wrong?

Thanks

Best Answer

Your logic is correct and I think well explained. I don't know why you don't like it.

Related Question