# Probability of Multiple Events In A Row

**URL:** <https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576>\
**Category:** Factual Questions\
**Created:** [April 1, 2010, 2:40pm UTC](https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576 "2010-04-01T14:40:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricksummon](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ricksummon/32/3333_2.png) [@ricksummon](https://boards.straightdope.com/u/ricksummon)\
**Post date:** [April 1, 2010, 2:40pm UTC](https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576/1 "2010-04-01T14:40:19Z")

</div>

If the probability of success for a single event (such as a dice roll) is **p** , and you need to roll **n** successes in a row to win the game, then the probability of doing so if you only roll **n** times is **p^n.**

But what if you roll more than **n** times? For a number of rolls **N \> n,** how can you calculate the probability of winning? Alternatively, if you want a specific probability of winning (say, 95%), how can you calculate the number of rolls required to get this probability?

---

<div class="post-metadata">

**Author:** ![md2000](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@md2000](https://boards.straightdope.com/u/md2000)\
**Post date:** [April 1, 2010, 3:44pm UTC](https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576/2 "2010-04-01T15:44:42Z")

</div>

A major assumption is of course, as with dice, that each event is independent of the previous or following events.

The probability of the event is p. As you point out, for n events, the probability of all being the desired result of probability p is p^n.

The usual way to evaluate a complex probability is to enumerate all possibilites and their odds, and add up the different probabilities… I.e. in craps, the odds I’ll 6 or less is odds throw a 2 plus the odds I’ll throw a 3, plus…

So let’s say we have n results in m tries. The odds that we’ll have n results p followed by n results not-p is (p^n) \* ((1-p)^(m-n)). The odds of throwing p n-1 times, followed by m-n of not-p and then 1 of p is the same number.

So really, it’s the odds times the number of combinations of p and not-p we can make up…  
i.e. 2 P and 2 anti-P (call it “A”)  
PPAA  
PAPA  
APPA  
PAAP  
APAP  
AAPP

The simple formula for permutations is m!/(n!(m-n)!) where ! is factorial.  
In our example, this is 4!/2!2! or 24/2\*2=6.  
So the result is (P^n)(A^m-n) m!/(n!(m-n)!) if I can still do math.

For lotto 6/49 for example, pick any 6 numbers from 49, every number equally likely - it’s (49!)/(6!)(43!) which IIRC works out to odds of 13.9 Million to 1.  
Which is logical, because it is 49_48_47_46_45\*44/6! Or pick any number of the 49 then any from the remaining 48, etc. Then divide by all possible permutations of that result (6!), because a result where we picked, say, 1,7, 10 is the same winning ticket as 7,10,1… and 1, 10, 7…

For n or greater p in m, you need to sum:

SUM (i=n to i=m; (P^i)(A^m-i) m!/(i!(m-i)!)

Of course, math was never my strong suite and I probably missed something here…

---

<div class="post-metadata">

**Author:** ![nivlac](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@nivlac](https://boards.straightdope.com/u/nivlac)\
**Post date:** [April 1, 2010, 4:15pm UTC](https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576/3 "2010-04-01T16:15:50Z")

</div>

> [@ricksummon](#):
>
> … But what if you roll more than **n** times? For a number of rolls **N \> n,** how can you calculate the probability of winning? Alternatively, if you want a specific probability of winning (say, 95%), how can you calculate the number of rolls required to get this probability?

If by “win” you mean getting n successes out of N trials, then you should read up on the binomial distribution. The key assumptions are that p stays the same for each trial and that the trials are independent. Usually the probabilities can be found in a table, so no complicated calculations are required.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [April 1, 2010, 5:30pm UTC](https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576/4 "2010-04-01T17:30:15Z")

</div>

> [@nivlac](#):
>
> If by “win” you mean getting n successes out of N trials, then you should read up on the binomial distribution. The key assumptions are that p stays the same for each trial and that the trials are independent. Usually the probabilities can be found in a table, so no complicated calculations are required.

If you just need to get a certain number of successes, this is what you want.

The probability of getting X successes out of N trials, where p is the probability of success on each trial, is [sub]N[/sub]C[sub]X[/sub] p[sup]X[/sup] (1–p)sup[/sup].

There are also tables for this sort of thing, and functions built in to graphing calculators and statistics software. See the chapter on “binomial probability” or “the binomial distribution” or “Bernoulli trials” in any basic book on probability and statistics.  
If, on the other hand, you need to get a certain number of successes **in a row** , it becomes more complicated. I don’t know if there’s an easy answer; I’d have to think about that for awhile.

---

<div class="post-metadata">

**Author:** ![OldGuy](https://avatars.discourse-cdn.com/v4/letter/o/3bc359/32.png) [@OldGuy](https://boards.straightdope.com/u/OldGuy)\
**Post date:** [April 1, 2010, 6:11pm UTC](https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576/5 "2010-04-01T18:11:32Z")

</div>

> [@Thudlow\_Boink](#):
>
> The probability of getting X successes out of N trials, where p is the probability of success on each trial, is [sub]N[/sub]C[sub]X[/sub] p[sup]X[/sup] (1–p)sup[/sup].

Note that this is the probability of exactly X successes in N trials. AS pointed out previously, to win you could get X, X+1, … N successes out of N trials so you’d want to sum formula from X to N.

You’d probably not actually toss the die again once you’d gotten X successes in fewer than N trials, but this is still the correct formula.

To determine how big an N you need to get a specific probability of winning, just try different N’s until you read the required level. The win probability will be increasing in N so there will be a smallest value that meets your criterion.

---

<div class="post-metadata">

**Author:** ![Omphaloskeptic](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@Omphaloskeptic](https://boards.straightdope.com/u/Omphaloskeptic)\
**Post date:** [April 1, 2010, 6:39pm UTC](https://boards.straightdope.com/t/probability-of-multiple-events-in-a-row/534576/6 "2010-04-01T18:39:50Z")

</div>

One way to figure out the probability of getting n successes in a row, anywhere in N tries, is to keep track of the probabilities that you’ve had m successes in a row for m=0,…,n. You can write down a system of recursion relations for these probabilities, and then solve the system.

This sounds complicated but it’s not actually very hard. For example, take n=3. Let P(m,k) be the probability that the last m tries were successes, after k tries… except that P(n,k) will be the probability that we’ve had n successes somewhere in these k tries (not just in the last n of them). We keep track of the probability for each of four states: P(0,k) (the last try was a failure), P(1,k) (the last try was a success, but the penultimate one was not), P(2,k) (the last two were successful, but the antepenultimate was not), and P(3,k) (we’ve had three in a row somewhere in the last k tries). It’s easy to write down the values for P(m,k+1) in terms of P(m,k):

> [@](#):
>
> P(0,k+1) = (1-p)_[P(0,k)+P(1,k)+P(2,k)] … failure after 0, 1, or 2 successes knocks us back down to 0-in-a-row  
> P(1,k+1) = p_P(0,k) … we have 1-in-a-row now if we succeeded after 0-in-a-row  
> P(2,k+1) = p_P(1,k) … ditto  
> P(3,k+1) = P(3,k) + p_P(2,k) … success somewhere in the series now if either we had success earlier or we succeeded after 2-in-a-row

A straightforward way to solve this is to write it as a matrix update equation:

```auto

[P(0,k+1)] [1-p 1-p 1-p 0] [P(0,k)]
[P(1,k+1)] = [p 0 0 0] * [P(1,k)]
[P(2,k+1)] [0 p 0 0] [P(2,k)]
[P(3,k+1)] [0 0 p 1] [P(3,k)]

```

Now just take powers of this matrix to compute the probability of three successes in a row after N tries:

```auto

[P(0,N)] [1-p 1-p 1-p 0]^N [1]
[P(1,N)] = [p 0 0 0] * [0]
[P(2,N)] [0 p 0 0] [0]
[P(3,N)] [0 0 p 1] [0]

```

For p=0.5, this gives P(3,3)=0.125 (obvious), P(3,4)=0.1875, … P(3,10)=0.5078, …, P(3,30)=0.9078.

For larger values of n than 3, you just use a larger matrix. Note that all of the recursion formulas except for P(0,k+1) and P(n,k+1) look basically the same, so you just follow the pattern for any desired n.
