# Flip coins until you get two heads in total, what's the probability that the number of total coins you flipped so far is equal to 4? [closed]

You flip coins until you get two heads in total, what's the probability that the number of total coins you flipped so far is equal to $$4$$?

(It's an invalidated problem from a computer olympiad. And I don't know why it's invalidated.)

What I know:

So since you flip until you have a total of $$2$$ heads, your $$n$$'th flip should be a head, and in your first $$n - 1$$ flips you must have $$1$$ heads.

Then for $$n \geq 2$$

$$\frac{n - 1}{2^{n - 1}} \cdot \frac{1}{2}$$

That is $$\frac{n-1}{2^n}$$

I can see that $$\sum_{n = 2}^{\infty}\frac{n-1}{2^n} = 1$$. But I don't know how to continue.

• What does "flipped so far" mean? If $X$ denotes the random variable which counts the number of tosses until you have seen two heads, are you asking for $P(X=4)$ or $P(X≥4)$?
– lulu
May 14 at 11:16
• As I said, the question became invalidated. Maybe this is the reason for it. Also, I translated the question, from what I understand it asks the probability of the number of tosses being equal to 4, so say you have "THTTH" and "THTH", both are valid, but it asks for us to find the probability of having 4 tosses. So we can for example only count "THTH" as a case we want. May 14 at 12:28
• Please edit your post for clarity. Using the notation I proposed...Do you want $P(X=4)$ or do you want $P(X≥4)$? Both are valid questions, of course, but it is not clear (either to me or to the user who posted a solution below) which you are asking for.
– lulu
May 14 at 12:31
• I have no idea what you are asking, not sure you do either. It looks like you are just asking for $P(X=4)$, even though you insist you are not. If you can, please explain how your question differs from $P(X=4)$.
– lulu
May 14 at 12:51
• Then I suggest you go with $P(X=4)$.
– lulu
May 14 at 12:55

## 3 Answers

Letting $$N$$ be the count of coins flipped until you obtain the second head.

You have that $$\mathsf P(N=n)~=~\dfrac{n-1}{2^n}\mathbf 1_{n\in[[2..\infty)]}$$

So, if you seek the probability the the number of coins you flip until the second head equals $$4$$, that is: $$\mathsf P(N=4)$$

However, if you seek to find $$\mathsf P(N\geq 4)$$, the number of coins flipped so far is 4 (ie that you have not stopped earlier)...$$\mathsf P(N\geq 4)~=~1-\mathsf P(N<4)\\=~~~~~$$

• Wouldn't that be the probability of having flipped 4 or more coins? The question asks for it to be exactly 4. May 14 at 11:10
• @bedirhan What does "so far" mean to you? To me it means "you may not have stopped yet." May 14 at 11:20
• Please check my replies to lulu's comment. May 14 at 12:50

I agree to Graham Kemp that $$\mathsf P(N=n)~=~\dfrac{n-1}{2^n}\mathbf 1_{n\in[2, ..., \infty)}$$. But it asked for the probability that the number of total coins you flipped so far is $$\underline{\textrm{equal}}$$ to $$4$$. Therefore the required probability is

$$\mathsf P(N=4)~=~\dfrac{4-1}{2^4}=\frac3{16}$$

Another way of thinking about this is to just flip the coin exactly 4 times; we want the probability that the 4th of these 4 flips is the 2nd head. That is, the 4th flip should be heads and there should be exactly 1 head in the first 3 flips. There are 3 cases where this occurs, HTTH, THTH, and TTHH out of 16 possible sequences of four flips, so the answer is $$\frac{3}{16}.$$