Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

You repeatedly evaluate a certain discrete R.V. (e.g., discrete triangular) $X_i$ (i.i.d. from one another). What's the probability that two consecutive $a$'s appear before a $b$ appears ($a$ and $b$ are particular realizations that $X_i$ can take).

If it were immediately before a $b$, I assume it would be simply $P(X_i=a)^2$, but I am not restricting it to strictly immediately before $b$.

Would it be correct to use the binomial distribution with $$n= 1/P(X_i = b) - 2$$ The geometric mean. Subtract 2 because I ignore the slot when $b$ occurs and am looking at two consecutive slots to fill, so the first slot doesn't count) and

$$p = P(X_i=a)^2$$ ?

I've seen a much simpler way for this type of question that appears to use some sort of version of the law of total probability (including a recursion term, i.e., the probability being asked for itself), but I wasn't able to see the rationale behind it.

share|cite|improve this question
up vote 0 down vote accepted

Let $p_a$ be the probability of an $a$ and $p_b$ be the probability of a $b$.

There are various possibilities for what happens initially:

  • $X_1=b$ with probability $p_b$
  • $X_1=a$ and $X_2=b$ with probability $p_a p_b$
  • $X_1=a$ and $X_2=a$ with probability $p_a^2$
  • $X_1=a$ and $X_2=$ something else with probability $p_a(1-p_a-p_b)$
  • $X_1=$ something else with probability $1-p_a-p_b$

In the first and second case $b$ appears first, while in the third two consecutive $a$s appear first, and in the fourth and fifth you have effectively to repeat the process and carry on.

So overall, two consecutive $a$s appear earlier than any $b$ with probability $$\frac{p_a^2}{p_a^2+ p_a p_b +p_b}.$$

share|cite|improve this answer
Thanks for your answer, but I don't quite get the fraction. Is this obtained via the definition of conditional probability? Also, why is $p_aP_b$ included: Doesn't the same logic of " effectively to repeat the process" apply? – Wuschelbeutel Kartoffelhuhn Oct 5 '12 at 18:08
@Wuschelbeutel Kartoffelhuhn The probability is that two consecutive $a$s (the numerator) appear given that either two consecutive $a$s or one $b$ appears (the denominator, including the probability of one $a$ followed by one $b$, which is a win for $b$). You could instead calculate a rather more complicated infinite series but you would get the same answer. – Henry Oct 5 '12 at 20:09
Thanks for the follow-up. I guess the denominator represents the "stopping conditions" after which the whole process is renewed. I was just confused at first that one can use the first two trials as a representation for the entire process, but it makes more sense now. – Wuschelbeutel Kartoffelhuhn Oct 6 '12 at 8:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.