# A coin is tossed k times. Find the probability that heads or tails show twice in a row.

Toss a coin $k$ times until either heads or tails appear twice in a row. Let each throw be independent. Let $X$ be the number of throws until heads or tails appear twice in a row. Define $X={2,3,4,...}$. Find the probability of $P(X=k)$, where $k={2,3,4,...}$.

What I know: All throws $x_k$ are independent. Each throw has a probability of $0.5$. This means $P(X_1 \cap X_2) = P(X_1) P(X_2) = 0.25$.

I have an idea, but I am uncertain if it's true and I am not certain how to argue properly for it. Let $k=1,2,...,n$, with n being the last throw as two of the same kind appear. Then i will simply minus the sum of the multiple of $P(X_{k_{1}})$ with $P(X_{k_{2}})$ all the way up to $P(X_{k_{n}})$ with 1. For example, if two heads appear on the 5'th try i will get $$1-(0.5^5)=0.96$$

But this formula does not add up for $k=2$.

Any help is appreciated.

If you get two heads in a row for the first time on the $k^{th}$ toss, there is only one sequence of $k$ coin flips that could have led to that result $(...THTHTHH)$.

Similarly, if you get two tails in a row for the first time on the $k^{th}$ toss, there is only one sequence of $k$ coin flips that could have led to that result $(...HTHTHTT)$.

So there are only 2 sequences of $k$ coin flips that could lead to the desired result. There are $2^k$ possible sequences of $k$ coin flips, each one equally likely. This means $P(X=k) = \frac{2}{2^k}$

• I understand that the total outcome (sample space) is $2^k$. So what you mention with the sequences is the total amount of elements that gives us the desired result from the total outcome? If so I'm not certain I understand why. Would it be 4 in the numerator if it were only tails twice in a row? – Sirmimer Sep 13 '17 at 16:14
• If you're just looking for 2 tails in a row then there is only one sequence of coin flips that could lead to it (the third last would have to be heads, the fourth last would have to be tails, alternating like this until the first flip). This means 1 would be in the numerator. The probability is the number of desired flips / the total number of possible flips. This is because each individual flip has a probability 1 / total number of possible flips. – FullofDill Sep 13 '17 at 16:17
• So i have $(1/2^k)+(1/2^k)=(2/2^k)$. Which looks correct if i plug the first few numbers. And I can do this, because they are disjoint (cannot occur at the same time)? – Sirmimer Sep 13 '17 at 16:30
• Yeah you got it perfectly. All unique sequences of tosses are disjoint (i.e. you can't toss both THH and HTT) – FullofDill Sep 13 '17 at 17:10

$n$ throw can have $2^n$ outcome.

Thus, the probability that you get one of these outcomes is $\frac{2}{2^n} = \frac{1}{2^{n-1}}$.