# Probability of rolling a dice 8 times before all numbers are shown.

What is the probability of having to roll a (six sided) dice at least 8 times before you get to see all of the numbers at least once?

I don’t really have a clue how to work this out.

Edit: If we are trying to find the number of situations where all of the numbers are shown, for seven rolls, a favorable outcome would be one in which there are two numbers the same, for example: 1123456. These numbers can be arranged in 7!/2!5! ways, and there are 6 different numbers that could be repeated.
So the probability of getting all 6 numbers with 7 throws is (6*7!/2!5!)/6^7 = 126/279936.
Is that right?
Then 1 minus this is the probability?

Edit: prob. of not getting all six numbers with seven rolls = 1-prob of getting all six numbers with seven rolls

Six numbers same with seven rolls means one number repeated twice 7!/2! ways of doing this for each repeated number
6*(7!/2!) is number of ways of getting all six numbers with seven rolls. Total number of outcomes 6^7.
Prob of getting all six numbers with seven rolls = (6*(7!/2!))/6^7 = 0.054
Prob of not getting all six numbers with seven rolls (=prob of needing at least 8 rolls to get all numbers) = 1-0.054 = 0.946

#### Solutions Collecting From Web of "Probability of rolling a dice 8 times before all numbers are shown."

Rephrase the question:

What is the probability of not seeing all $6$ values when rolling a die $7$ times?

Find the probability of the complementary event:

What is the probability of seeing all $6$ values when rolling a die $7$ times?

Use the inclusion/exclusion principle in order to count the number of ways:

• Include the number of ways to roll a die $7$ times and see up to $6$ different values: $\binom66\cdot6^7$
• Exclude the number of ways to roll a die $7$ times and see up to $5$ different values: $\binom65\cdot5^7$
• Include the number of ways to roll a die $7$ times and see up to $4$ different values: $\binom64\cdot4^7$
• Exclude the number of ways to roll a die $7$ times and see up to $3$ different values: $\binom63\cdot3^7$
• Include the number of ways to roll a die $7$ times and see up to $2$ different values: $\binom62\cdot2^7$
• Exclude the number of ways to roll a die $7$ times and see up to $1$ different values: $\binom61\cdot1^7$

Divide the result by the total number of ways, which is $6^7$:

$$\frac{\binom66\cdot6^7-\binom65\cdot5^7+\binom64\cdot4^7-\binom63\cdot3^7+\binom62\cdot2^7-\binom61\cdot1^7}{6^7}=\frac{35}{648}$$

Calculate the probability of the original event by subtracting the result from $1$:

$$1-\frac{35}{648}=\frac{613}{648}\approx94.6\%$$

(Edit: Answer is for the probability of seeing all the numbers for $n$ rolls)

For exactly $n$ rolls, the problem can be solved using a markov chain

\begin{align*}
A&=
\begin{pmatrix}0 & 1 & 0 & 0 & 0 & 0 & 0\cr 0 & \frac{1}{6} & \frac{5}{6} & 0 & 0 & 0 & 0\cr 0 & 0 & \frac{1}{3} & \frac{2}{3} & 0 & 0 & 0\cr 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0\cr 0 & 0 & 0 & 0 & \frac{2}{3} & \frac{1}{3} & 0\cr 0 & 0 & 0 & 0 & 0 & \frac{5}{6} & \frac{1}{6}\cr 0 & 0 & 0 & 0 & 0 & 0 & 1\end{pmatrix}
\end{align*}

where the rows and columns are the number of faces of the die seen.

The probability of seeing all the faces in exactly 8 rolls is $(A^8)[0,6]$, which is $\dfrac{665}{5832}\approx 0.11402606310014$

For any $n$, it can be found by finding the generating function $G(z)$ and in turn finding the coefficient of $z^n$

\begin{align*}
\mathbb{P}(n) = 1-\frac{20}{2^n}+15\left(\frac{2}{3}\right)^n+\frac{15}{3^n}-6\left(\frac{5}{6}\right)^n-\frac{6}{6^n}
\end{align*}

Perhaps this is of some help, even if not your final answer.

If a fair die is rolled 8 times and $X$ is the number
of different faces seen, then simulation of a million performances
of the 8-roll experiment shows the following approximate distribution
of $X$, in which the margin of simulation error is about $\pm 0.001.$

         1        2        3        4        5        6
0.000003 0.002275 0.069393 0.363681 0.450468 0.114180


Of course, $P(X = 1) = 1/6^7 = 0.000004$ to 6 places.
To get $P(X = 6),$ consider that one face may be seen
three times, or two different faces may each be seen twice.
A straightforward
computation of other probabilities in the distribution seems
feasible but increasingly tedious. Perhaps there are clever combinatorial
methods that make some of them easier.

However, pending clarification, I’m still not sure if $P(X = 6)$
is exactly the probability you’re trying to find.

Notes:

(a) For a 7-roll experiment an analogous simulation gives $0.0544 \pm 0.001,$ which does not agree with your result $126/279936 \approx 0.00045.$ (I do not believe you are considering all possible permutations of the numbers that occur only once.)

(b) For a 6-roll experiment a simulation gives $0.015496 \pm 0.001,$
compared with the exact $6!/6^6 = 0.0154321.$ Clearly, the
probability of getting all 6 faces is 7 rolls must be larger than
that.

(c) A related problem is the number of rolls $W$ required before
all 6 faces are seen. Then $E(W) = 6/6 + 6/5 + \dots + 6/1 = 14.7.$
For more on this, see the ‘coupon collecting problem’.

Here’s another way of looking at it, along the lines suggested by barak manos.

Note that 7 rolls containing all 6 values must contain a duplicate. There are $\binom{7}{2}\cdot 6$ choices for the duplicate entries. Thus, the desired probability is given by

$$1-\frac{\binom{7}{2}\cdot 6\cdot 5!}{6^7} = 1-\frac{70}{1296}=\frac{613}{648}.$$
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://bootmath.com/probability-of-rolling-a-dice-8-times-before-all-numbers-are-shown.html", "fetch_time": 1531772832000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2018-30/segments/1531676589455.35/warc/CC-MAIN-20180716193516-20180716213516-00541.warc.gz", "warc_record_offset": 57089896, "warc_record_length": 7560, "token_count": 1726, "char_count": 5528, "score": 4.59375, "int_score": 5, "crawl": "CC-MAIN-2018-30", "snapshot_type": "latest", "language": "en", "language_score": 0.8681277632713318, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00046-of-00064.parquet"}