# Independent Coin Flips

I am having a problem with part c of a three part problem. The problem is as follows.

Independent flips of a coin that lands on heads with probability $p$ are made. What is the probability that the first four outcomes are

a) $H,H,H,H$?

b) $T,H,H,H$?

c) What is the probability that the pattern $T,H,H,H$ occurs before the pattern $H,H,H,H$?

Hint for part (c): How can the pattern $H,H,H,H$ occur first?

Solution for (a): Since these events are independent we have $P(HHHH)=pppp=p^4$.

Solution for (b): Likewise, $P(THHH)=(1-p)p^3$.

Thoughts/confusion for (c): I am confused what they mean by "before." I am also confused at what is mean by the question "how the pattern $H,H,H,H$ can come first" I mean it seems to me it can only come first if I do not flip a tails on my first flip, hence it would just be the same exact solution to (b), but I don't think it is asking the same question. If it is asking the same question I do not see how they are equivalent. Could someone help clarify please?

• The idea in (c) is that you keep flipping until you get one or the other of the two sequences on 4 consecutive flips. You have the right idea, almost-- the only way for HHHH to precede THHH is to get HHHH on the first four flips (think about it). So... – Ned Sep 25 '15 at 20:15
• Either sequentially or in time, but you are making a single string of flips which has a beginning and ends only when either HHHH or THHH has occurred on consecutive flips. – Ned Sep 25 '15 at 20:36
• Wow.... I feel so dumb now... That's frustrating. I feel like I didn't understand what they were asking whatsoever... I understand the way better now thanks to you and zesty though. Thank you. – Valentino Sep 25 '15 at 20:39
• Glad we can help! I think this was one of those nice little 'tricks' that now you've seen you'll be able to use yourself :) – Zestylemonzi Sep 25 '15 at 20:41

There's a nice observation you can make here. Notice if H H H H appears first (say at flip k) then the flip before the initial H (flip k-1) must also be a head otherwise we arrive at a contradiction, that T H H H appears first. Continuing this we deduce that all previous flips must be heads. Therefore H H H H appears first if and only if the initial 4 flips are H H H H. Therefore the proability you are looking for is actually the compliment to part a) which is $1-p^4$.
It looks like they mean, given an infinite sequence of coin flips $X_1, X_2, X_3, \dots$ (where $X_i$ takes values in $\{H,T\}$), what is the probability you'll see one pattern before the other?
For example, if you get $H, T, H, H, H, H$, you have both patterns in there, but $THHH$ happened first.