# Number of trials to first success

How many times, on average, do we need to roll an n-sided die until we get an X?

The probability of getting an X for the first time on the i-th trial is

$$\left( 1 - \frac{1}{n} \right)^{i - 1} \frac{1}{n} .$$

Let $$p = \frac{1}{n}$$. The mean number of trials to first success is

$$p \sum_{i = 1}^{\infty} i (1 - p)^{i - 1} = p \left[ - \sum_{i = 1}^{\infty} (1 - p)^i \right]^{\prime} = p \left( \frac{p - 1}{p} \right)^{\prime} = \frac{1}{p} = n .$$