Average waiting time to guess a random number from $1$ to $100$ with equal probability and 1 second between each number is generated A random number between $1$ and $100$ is generated every second.
What would be the average waiting time for a specific number ($1$ for instance) to be generated?
Probability distribution is uniform.
Each number is generated independently of the others.
 A: Let $X$ denote the number of seconds until $1$ is generated:


*

*$P(X=0)=\frac{1}{100}$

*$P(X=1)=\frac{99}{100}\cdot\frac{1}{100}$

*$P(X=2)=\frac{99}{100}\cdot\frac{99}{100}\cdot\frac{1}{100}$

*$\dots$

*$P(X=n)=\left(\frac{99}{100}\right)^n\cdot\frac{1}{100}$


So the expected number of seconds until $1$ is generated is:
$$E(X)=\sum\limits_{n=0}^{\infty}n\cdot\left(\frac{99}{100}\right)^n\cdot\frac{1}{100}=99$$

Why is it that $\sum\limits_{n=0}^{\infty}n\cdot\left(\frac{99}{100}\right)^n\cdot\frac{1}{100}=99$:


*

*$|x|<1 \implies \sum\limits_{n=0}^{\infty}x^n=\frac{1}{1-x}$

*Differentiate each side of the equation: $\sum\limits_{n=0}^{\infty}nx^{n-1}=\frac{1}{(1-x)^2}$

*Multiply by $x$ each side of the equation: $\sum\limits_{n=0}^{\infty}nx^n=\frac{x}{(1-x)^2}$

*Use $x=\frac{99}{100}$ on each side of the equation: $\sum\limits_{n=0}^{\infty}n\left(\frac{99}{100}\right)^n=9900$

*Multiply by $\frac{1}{100}$ each side of the equation: $\sum\limits_{n=0}^{\infty}n\cdot\left(\frac{99}{100}\right)^n\cdot\frac{1}{100}=99$

A: We must be careful to avoid the "fence post error"
Consider a repetitive cycle of 100 seconds. On an average, 1 will appear once every 100 seconds, e.g.
1, 2, 3, 4, ........ 100, 1, 2, 3, 4, ...$
[ Consider a clock. Does a minute elapse every 60 seconds or every 59 seconds ?? ]
PS
Here is another way to look at it. Let us replace seconds by guesses.
P[guess correctly on any try] = 1/100 = p (say)
E[average # of guesses needed to guess correctly] = 1/p = 100
