[Math] Probability of an event occuring at the nth time

probability

There is a dime, which lands on heads Q percent of the time, and lands on tails 1-Q percent of the time.

We flip this dime until we get a mirror-sequence (same forward as back, 1-long sequences don't count)

That is we flip it until we get something like HEADS-TAILS-HEADS or HEADS-HEADS-HEADS or whatever.

What is the probability of stopping at the N-th flip?

In my mind you have to first seperate this problem: If n is even, or if n is odd.

There are four possibilities:

The probability of throwing N number of heads = Q^N let's call this P(A).
The probability of throwing N number of tails = (1-Q)^N let's call this P(B).
The probability of throwing a sequence starting with heads and ending with heads = (Q^(N-1))x((1-Q)^(N-2)) let's call this P(C)
The probability of throwing a sequences starting with tails and ending with tails = (Q^(N-2))x((1-Q)^(N-1)) let's call this P(D)

The last two cases only apply if the sequence is ODD number long. So we seperate the answer.

Case of N being even => the probability of getting a satisfying sequence is = P(A) + P(B) since order doesn't matter as they are either all heads or all tails.

Case of N being odd => the probability of getting a satisfying sequence is = P(A) + P(B) + P(C) + P(D)

The problem with this is that I don't think I accounted for the "order" of the heads or tails in parts C and D and I don't know how to do that.

edit: i made the mistake of thinking that H-T-H-T-H and longer mirror sequences are viable… I forgot that it would stop as soon as it would arrive at H-T-H immediately so the answer is correct. Thanks

Best Answer

Answer: $q^2(1-q)^{n-2}+q^{n-2}(1-q)^2$

You cannot stop on the first flip. You stop on the 2nd flip if you get HH or TT. For n>2 you stop the second time you switch from getting H to T (or vice versa). Eg for n=5 you stop at HTTTH or THHHT. Note that the two switches must occur on your second throw and your last throw.

Related Question