Question: If you roll a $6$-sided die $10$ times, what is the probability of rolling each number at least once?
My attempt:
It is fair to assume that the probability of not rolling a number is $5/6$, and if we roll 10 times, it will be $(5/6)^{10}$.
Assuming that $A$ denotes the event of rolling a number once. In that case, $\Pr\{A\}=1-(5/6)^{10} = 0.838494.$
But since we have $6$ unique numbers, it'll be $0.838494^6 = 0.347536$. But I made a program that calculates it, and the answer is $0.27$. What am I missing?
Let us calculate the number of all the sequences of $10$ rolls. It is equal to $6^{10}$. We don’t want the sequences that don’t contain any particular number from $1$ to $6$, so we should subtract them. There are ${6 \choose 1}$ ways to choose a missing number and $5^{10}$ ways to form a sequence without it.
The answer could be $6^{10}-{6 \choose 1}\cdot 5^{10}$, but actually we subtracted, for example, sequences that miss numbers $1$ and $2$ two times! We should add them back one time. There is ${6 \choose 2}$ ways to choose two numbers and there is $4^{10}$ sequences without them.
Continuing this reasoning in line with the inclusion-exclusion principle we get that the number of sequences of $10$ rolls such that every number $1,2,3,4,5,6$ was rolled at least once is equal to
$$6^{10}-{6 \choose 1}\cdot 5^{10}+ {6 \choose 2}\cdot 4^{10} - {6 \choose 3}\cdot 3^{10} + {6 \choose 4}\cdot 2^{10} - {6 \choose 5}\cdot 1^{10}=$$ $$= 16435440.$$
Then the probability of the event that every number $1,2,3,4,5,6$ will roll at least once is equal to $$\frac{16435440}{6^{10}}=\frac{38045}{139968}\approx 0.2718121285.$$
There’s also a useful notion of Stirling numbers of the second kind which incorporate this inclusion-exclusion reasoning and give essentially a ready answer. $S(n,k)$ is the number of ways to split $n$ distinguishable objects into $k$ non-empty groups. This is exactly what we want: to split $10$ rolls into $6$ groups ($S(10,6)$ ways to do so) and then assign a number from $1$ to $6$ to any group ($6!$ ways to do so). Then the answer is
$$\frac{S(10, 6)\cdot 6!}{6^{10}}= \frac{16435440}{6^{10}}.$$
(Here is a nice online Stirling numbers calculator to find $S(10,6)$.)
By the way, we just proved that $$S(10, 6)=\frac{1}{6!}( 6^{10}-{6 \choose 1}\cdot 5^{10}+ {6 \choose 2}\cdot 4^{10} - {6 \choose 3}\cdot 3^{10} + {6 \choose 4}\cdot 2^{10} - {6 \choose 5}\cdot 1^{10}).$$
Or, in general: $$ S(n,k)=\frac{1}{k!}\sum_{i=0}^k (-1)^{k-i}{k \choose i}i^n.$$