<s>[INST] 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.
 [/INST] 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$

</s>