# Why does probability of $n$ consecutive success equal the probability when the last is a failure given that the last $n - 1$ have at least one failure

I have been the question:

Independent trials, each resulting in a success with probability $$p$$ or a failure with probability $$q = 1 - p$$, are performed. We are interested in computing the probability that a run of $$n$$ consecutive successes occurs before a run of $$m$$ consecutive failures.

This is the given solution:

Let $$E$$ be the event that a run of $$n$$ consecutive successes occurs before a run of $$m$$ consecutive failures. To obtain $$P(E)$$, we start by conditioning on the outcome of the first trial. That is, letting $$H$$ denote the event that the first trial results in success, we obtain: $$P(E) = pP(E|H) + qP(E|H^c)$$

Now, given that the first trial was successful, one way we can get a run of $$n$$ successes before a run of $$m$$ failures would be to have the next $$n - 1$$ trials all result in successes. So, let us condition whether or not that occurs. That is, letting $$F$$ be the even that trials $$2$$ through $$n$$ all are successes, we obtain $$P(E|H) = P(E|FH)P(F|H) + P(E|F^cH)P(F^c|H)$$

On the one hand, clearly, $$P(E|FH) = 1$$; on the other hand, if the event $$F^cH$$ occurs, then the first trial would result in success, but there would be a failure some time during the next $$n - 1$$ trials. However, when this failure occurs, it would wipe out all of the previous success, and the situation would be exactly as if we started out with a failure. Hence, $$P(E|F^cH) = P(E|H^c)$$

Now I understand why the failure wipes out the entire work, but I don't get why the last equation holds. In particular, $$P(E|F^cH)$$ means the probability of success given that the last $$n - 1$$ trials have at least one failure. I don't see how that can reduce to just given the information that the last trial was a failure. For example, if the sequence ends with $$...FSSS$$, we also have the information that the last $$3$$ are successes.

Can someone please explain this? I know there is a solution here but I don't get it.

Thanks

When you say "the probability of success given that the last $$n-1$$ trials have at least one failure" I think this is an example of the confusion, because this isn't quite what you're conditioning on.

It's just saying "there is a failure that occurs when you are going for the next $$n-1$$ flips, and therefore we never made it through this entire event - we failed and are now in this other event space where we are starting over.

We're not "going through with the rest of the $$n-1$$ flips" because once we hit that failure we are restarting, so we're not talking about a situation where "the last three flips could have been successes" for example.

In other words, you are thinking of it like "We flip a coin $$n-1$$ times and see if there was a failure in there somewhere" when really it is more like "Flipping a coin repeatedly and not making it to $$n-1$$ flips because we failed at some point."

• I don't understand it: $F$ is the event that all the trials from $2$ to $n$ are successes. So, isn't $F^c$ the event that there is at least one failure among $2$ to $n$? In fact, the author agrees later in the text by assigning probabilities of $p^{n-1}$ and $1 - p^{n - 1}$ respectively. Commented Aug 11, 2023 at 17:21
• Yes, the probability that you make it through the full event of $n-1$ successful flips is $p^{n-1}$, and the probability that you don't make it through that event is going to be the complement of that, $1 - p^{n-1}$, which means "you failed at some point", either at flip $1$, $2$, $3$, etc. Note that $(1-p) + p(1-p) + p^2(1-p) + ... + p^{n-2}(1-p) = 1 - p^{n-1}$ (failing immediately, succeeding then failing, succeeding twice then failing, etc, all the way up through failing on the $n-1$th flip) Commented Aug 11, 2023 at 17:27
• The confusion lies in the phrasing of the sentence "the event that there is at least one failure among $2$ to $n$" because to me this paints the mental image of flipping a bunch of coins and looking among them for a failure. When really it's more like an iterative process of flipping one coin after another until you hit a failure, at which point you stop and are no longer 'in' that event. If I fail on flip $k$ I am not flipping the rest of the $n-k$ coins in that particular event - I am now flipping coins in some other event now where we conditioned on the previous flip being a failure. Commented Aug 11, 2023 at 17:32
• I get what you're saying, but then why does the author mention the probability of $F$ as $p^{n-1}$ and $F^c$ as $1 - p^{n - 1}$? This is the probability as if we are not stopping but flipping exactly $n - 1$ times. Commented Aug 11, 2023 at 17:41
• @MangoPizza $1 - p^{n-1}$ doesn't mean you flipped $n-1$ times. If $p^{n-1}$ is the probability that you succeeded at $n-1$ flips, all $1 - p^{n-1}$ means is "the probability that that didn't happen." The expansion above in my other comment shows that it's equivalent to summing up all the individual possible outcomes of failing on flip 1, failing on flip 2, on flip 3, etc - where you aren't necessarily flipping all $n-1$ coins - you're flipping some number of successes and then hitting a failure. Once you hit the failure, you're not flipping any more in that event. Commented Aug 11, 2023 at 18:24