Trials Until First Success

July 21, 2015 in Mathematics

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 iid Bernoulli 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)$.

who am i

I am a Software Engineer and aspiring Computer Science theorist. My ultimate goal is to develop AI algorithms with some provable guarantees.

what is this

This is a blog about computer science theory, some mathematics, and the AI. I put here all my thoughts that are not publication-ready.

© MMXVI — MMXVII by Uros Nedic.
Content available under Creative Commons (BY-NC-SA) unless otherwise noted.