# Probability of drawing n elements from a set in x attempts where an element can be drawn more than once

So I was thinking about how many digits of a random irrational number it would take on average to hit every digit 0-9, then I wondered what if I only cared about hitting certain digits (say 0-4). Or what if I was working in a different base and so on. Then I realized this question is equivalent to any other situation where you care about randomly picking all the elements or some of the elements in a set. So to put my question into marbles in a bag:

Suppose you had n marbles in a bag and you randomly pick one of the marbles from the bag then put it back and draw again. 1) Whats the expectation value for the number of draws it would take to get every marble? 2) Also What is the probability of drawing all n marbles after x drawings (assuming x>=n). To make the question more general, suppose m rocks were also placed in the bag with the marbles such that any marble would have a 1/(n+m) chance of being drawn. Again what is the expectation value for the number of draws it would take to get all n marbles and what is the probability of drawing all n marbles after x drawings (assuming x>=n)?

• This can be modelled with a probability transition matrix. Is that a phrase you've come across in your studies? – hardmath Aug 16 '18 at 0:29

1. As given here, expectation of $T$ draws to draw every marble is $$\mathbb{E}\left[T\right] = n\left(1 + \dfrac{1}{2} + \dots + \dfrac{1}{n}\right)$$
2. The probability of drawing every marble after having drawn $x$ marbles can be found in the discussion here, and in our case is given by $$\operatorname{Pr}\left(T \leq x\right) = \dfrac{n!}{n^{x}}\begin{Bmatrix}x \\ n\end{Bmatrix}$$ where $\begin{Bmatrix}x \\ n\end{Bmatrix} = \dfrac{1}{n!}\sum_{i = 0}^{n}\left(-1\right)^{n - i}\begin{pmatrix}n \\ i\end{pmatrix}i^{x}$ is the Stirling number of the second kind.
3. With $m$ rocks, the expectation generalises to $$\mathbb{E}\left[T\right] = \left(n + m\right)\left(1 + \dfrac{1}{2} + \dots + \dfrac{1}{n}\right)$$ and the probability of drawing every marble after having drawn $x$ marbles can be found using the Law of Total Probability by a sum involving our previous answer weighted by binomial probabilities ($i$ marbles drawn out of $x$ total draws) $$\operatorname{Pr}\left(T \leq x\right) = \sum_{i = n}^{x}\begin{pmatrix}x \\ i\end{pmatrix}\left(\dfrac{n}{n + m}\right)^{i}\left(\dfrac{m}{n + m}\right)^{x - i}\dfrac{n!}{n^{i}}\begin{Bmatrix}i \\ n\end{Bmatrix}$$