# Trials Until First Success

21 Jul 2015

On the average, how many times must a die be thrown until one gets a 6?

## Approach A: Analytical

Let $p =~^1/_6$ as the probability of getting a 6, and $q = 1 - p$ of not getting one. Then:

case | throws | probability |
---|---|---|

6 | 1 | $p$ |

x6 | 2 | $pq$ |

xx6 | 3 | $pq^2$ |

xxx6 | 4 | $pq^3$ |

… | $n$ | $pq^{n-1}$ |

The mean (or expected value) is, by definition:

Hence:

As a check, if we sum all probabilities we have:

## Approach B: Distributions

We use a negative binomial to model the variable. The definition of a negative binomial is:

(…) the number of successes in a sequence of

iidBernoulli trials before a specified (non-random) number of failures (denoted r) occurs is given by NBin(r, p).

Let $X \sim NBin(1,~^1/_6)$, that is we define a single failure as the chance of throwing a 6. The expected value of a negative binomial is given by:

The solution to our problem is given by $\mathbb{E}[X] + 1$ since we want to include the last throw, hence:

**Notes.** Wikipedia presents the mean using the probability of a success instead of a failure:

Where $q = (1 - p)$.