# How do you calculate the probability when you don't know how many trials will be held? [duplicate]

You toss a fair coin until you toss two consecutive heads. Find the probability that you have to toss the coins exactly 4 times.

## marked as duplicate by JMoravitz, lulu, N. F. Taussig, Em., ShaileshJan 20 '16 at 2:37

• Just to clarify, you want the probability of getting one of the following sequences of $4$ tosses: $TTHH,HTHH$. Right? (reading from left to right, just to be clear) – lulu Jan 20 '16 at 1:57
• Yes, exactly! I understand that there are two ways that that can happen, which you specified. But I don't know how to account for the probability that we flip the coin 4 times exactly. – Taylor Jan 20 '16 at 2:00
• If the statement ended at "exactly 4 times", it would be clearer. – leonbloy Jan 20 '16 at 2:04
• That's true. I will edit it. – Taylor Jan 20 '16 at 2:05
• I will point out that you asked essentially the same question yesterday and that the answer and method is the same. The fact that if we had not yet flipped two consecutive heads is irrelevant since the probability that we eventually flip two consecutive heads is $1$. The probability of arriving at the desired outcomes on turn 3 and 4 are exactly the same whether we stop early or not. – JMoravitz Jan 20 '16 at 2:08

Pictured below is a tree diagram of the scenario. We picture leaves on the tree diagram according to where we either win (have head-head on turn three-four) or know that a loss has already or will inevitably occur (head-head on earlier turns or length of sequence will run too long). The probability of arriving at a specific leaf is the product of the probabilities of traveling along each specific branch. Considering a fair coin, each branch will be traveled with probability $\frac{1}{2}$.

As a result, the probability of success is $(\frac{1}{2})^4+(\frac{1}{2})^4=\frac{2}{16}=\frac{1}{8}$

Alternatively, notice that success or failure is completely determined by the result of the first four coin-flips. Two of the sixteen possible ways of flipping four coins will result in a win, while the remaining fourteen result in either a preemptive loss or an inevitable loss.

You want the probability that the first four tosses will be $\rm HTH\underline H$ or $\rm TTH\underline H$.   Those are the only outcomes by which the target is met on the fouth toss.

If it is $\rm H\underline HTT, H\underline HTH, H\underline HHT, H\underline HHH, TH\underline HT, TH\underline HH$ you will have met the target before the fourth toss; on the second or third, as indicated.

If it is $\rm TTTT, TTTH, TTHT, THTT, THTH, HTTT, HTHT, HTTH$ then you will not meet the target until somewhen after the fourth toss.   You will certainly eventually met the target, so the exact number of tries required is not important.

Hence the probability of meeting the target on the fourth toss is: $2/16$