# Probability of consecutive events

This question refers to the formula by @leonbloy {Occurrence of 5 consecutive tails before occurrence of 2 consecutive heads}

Why is the formula asymmetric, i.e. the order of head/tail as arguments matters (e.g. 5 head + 2 tails vs. 5 tails + 2 heads), while $p_h$ (probability of head) is equal to $p_t$ (probability of tail) given the implicit assumption of a fair coin ?

Also what would it be if $p_t ≠ p_h$ ?

• Why should it be symmetric? Try $2$ consecutive heads before $1$ tail. The only way to do that is to start $HH$, so $\frac 14$. So the order matters! – lulu Jan 10 '18 at 17:17
• As stated in the comments of the other answer, that formula is of that specific case "t tails before h heads". If you just wanted a formula for "h heads before t tails", you could simple interchange both variables ($t$ and $h$) in the formula. – user3141592 Jan 10 '18 at 17:50

It might be better to say:

The probability of getting $a$ runs of one particular side of the coin before getting $b$ runs of the other side of the coin is $$P(E) = \frac{2^b-1}{2^a + 2^b - 2}$$

The situation is symmetric in the sense that it doesn't matter what sides of the coin you're talking about --- heads or tails. But it does matter that the runs of $a$ come before the runs of $b$.

Intuitively, $a$ and $b$ are not symmetric because if you increase $a$ (the number of runs you have to get first), you expect the likelihood of success to go down. If you increase $b$ (the number of runs you have to avoid getting before succeeding at $a$), you expect the likelihood of success to go up:

It is rather likely to get a run of 2 before your first run of 1000. It is rather unlikely to get a run of 1000 before your first run of 2. This is true regardless of whether you're talking about heads/tails or tails/heads.

Let's generalize to weighted coins. Suppose you want to know the probability of getting $a$ runs of one side of the coin before getting $b$ runs of the other. Suppose the one side of the coin comes up with probability $\alpha$, and the other side of the coin comes up with probability $\beta = 1-\alpha$.

Then, following that post:

\begin{align*} P(E) &= P(E|T)P(T) + P(E|T^C)P(T^C)\\ & = \frac{p_1}{1-q_1q_2}\alpha + \frac{p_1q_2}{1-q_1q_2}(1-\alpha)\\ & = [q_2 + (1-q_2)\alpha] \frac{p_1}{1-q_1q_2} \end{align*}

and here $p_1$ and $q_1$ are the probability of succesfully/unsuccessfully getting a run of $a$, and similarly for $p_2, q_2$.

We have $p_1 = \alpha^{a-1}$, $p_2 = (1-\alpha)^{b-1}$, $q_1 = 1-p_1$, $q_2 = 1-p_2$.

\begin{align*} P(E) & = [q_2 + (1-q_2)\alpha] \frac{p_1}{1-q_1q_2} \\ &= [1-(1-\alpha)^{b-1} + (1-\alpha)^{b-1}\alpha] \frac{p_1}{1-q_1q_2}\\ &= [1 + (\alpha-1)(1-\alpha)^{b-1}] \frac{p_1}{1-q_1q_2}\\ &= [1 - (1-\alpha)^{b}]\frac{\alpha^{a-1}}{1-(1-\alpha^{a-1})(1-(1-\alpha)^{b-1})} \end{align*}

• To usr326210 (nick removed if i spell correctly!): I haven't done the math yet to fully appreciate (not allowed to say thx in comments !?) but quick note to say i'd have voted ++, not -1 (not sure who/why), for your patience (with newbies) and generous explanation. – tngn Jan 12 '18 at 12:40
• Similar studies of consecutive events are detailed at [mathworld.wolfram.com/CoinTossing.html], and [mathworld.wolfram.com/Fibonaccin-StepNumber.html], giving a formula: P(~E) = prob. of NO run of k consecutive head/tail in n tosses = F_(n+2)^((k))/2^n, where F_l^((k)) is a Fibonacci k-step number. In the cases in question, using this Wolfram formula with n=5, the probability of at least 1 run of 5 tails (regardless of how many subsequent heads) is: P(E) = 1-P(~E) = 0.75 while using the formula provided above with a=5, b=1 gives 0.03125 (more plausible). Any thought? – tngn Jan 13 '18 at 10:02