# Color ball drawer probability question

There is a ball drawer.
Seven color balls will be drawn with the same probability ($$1/7$$).
(black, blue, green, yellow, white, pink, orange)

If Anson attempts $$9$$ times,
what is the probability that he gets all $$7$$ different color balls?

My work:

I separate the answer to $$3$$ ways.

1. $$7$$ attempts -> done (get $$7$$ colors)
2. $$8$$ attempts -> done (get $$7$$ colors)
3. $$9$$ attempts -> done (get $$7$$ colors)

Therefore, my answer is $$\frac{9C7 + 8C7 + 7C7}{7^7 \cdot (7!)}$$ However, I don't know it is correct or not.

• Welcome to MSE. Your question is phrased as an isolated problem, without any further information or context. This does not match many users' quality standards, so it may attract downvotes, or closed. To prevent that, please edit the question. This will help you recognise and resolve the issues. Concretely: please provide context, and include your work and thoughts on the problem. These changes can help in formulating more appropriate answers. Aug 9 '21 at 8:39
• Since nine balls are drawn, either one ball is selected three times and each of the others is drawn once or two balls are drawn twice each and each of the others is drawn once. Aug 9 '21 at 9:37
• @Cycle, can you further explain your intuition behind taking those 3 cases? IMO, there will be two cases: (7 different balls + 2 balls of different colors among the seven) or (7 different balls + 2 balls of same colors among the seven). Aug 9 '21 at 9:43
• @n. f. taussig, i know what u mean, but i don’t how to calculate my thoughts. eg 1- P(3 same color selected) Aug 9 '21 at 10:04
• Are we to assume that the probability of drawing any color is always $1/7$ whatever number of draws we make ? Aug 9 '21 at 10:27

Since there are seven choices for each of the nine balls Anson selects, there are $$7^9$$ possible sequences of colors.

Method 1: If each color appears among the nine balls, there are two possibilities:

1. One color is selected three times and each of the other colors is selected once.
2. Two colors are each selected twice and each of the other colors is selected once.

One color is selected three times and each of the other colors is selected once: There are seven ways to select the color which appears three times, $$\binom{9}{3}$$ ways to select the three positions occupied by that color, and $$6!$$ ways to arrange the remaining six colors in the remaining six positions. There are $$\binom{7}{1}\binom{9}{3}6!$$ such cases.

Two colors are each selected twice and each of the other colors is selected once: There are $$\binom{7}{2}$$ ways to select the two colors which each appear twice, $$\binom{9}{2}$$ ways to select two positions for the selected color which appears first in an alphabetical list, $$\binom{7}{2}$$ ways to select two positions for the other selected color, and $$5!$$ ways to arrange the remaining five colors in the remaining five positions. There are $$\binom{7}{2}\binom{9}{2}\binom{7}{2}5!$$ such cases.

Therefore, the number of favorable cases is $$\binom{7}{1}\binom{9}{3}6! + \binom{7}{2}\binom{9}{2}\binom{7}{2}5!$$ so the probability that all seven colors are selected is $$\Pr(\text{all seven colors selected}) = \frac{\dbinom{7}{1}\dbinom{9}{3}6! + \dbinom{7}{2}\dbinom{9}{2}\dbinom{7}{2}5!}{7^9}$$

Method 2: We use the Inclusion-Exclusion Principle.

There are $$7^9$$ possible sequences of colors. From these, we must exclude those sequences in which one or more colors is missing.

There are $$\binom{7}{k}$$ ways to select which $$k$$ colors are missing and $$(7 - k)^9$$ sequences of colors which can be formed with the remaining colors. Thus, by the Inclusion-Exclusion Principle, the number of favorable cases is \begin{align*} & \sum_{k = 0}^{7} (-1)^k\binom{7}{k}(7 - k)^9\\ & \qquad = 7^9 - \binom{7}{1}6^9 + \binom{7}{2}5^9 - \binom{7}{3}4^9 + \binom{7}{4}3^9 - \binom{7}{5}2^9 + \binom{7}{6}1^9 - \binom{7}{7}0^9 \end{align*} Hence, the probability that each color appear is \begin{align*} & \Pr(\text{all seven colors selected})\\ & \qquad = \frac{7^9 - \dbinom{7}{1}6^9 + \dbinom{7}{2}5^9 - \dbinom{7}{3}4^9 + \dbinom{7}{4}3^9 - \dbinom{7}{5}2^9 + \dbinom{7}{6}1^9 - \dbinom{7}{7}0^9}{7^9} \end{align*}

• thanks for answering me and i am a newbie in MSE. I am wonder the above solution is secondary level or university? Aug 9 '21 at 14:08
• While the first solution could be done by a good secondary school student, this is a university level problem. Aug 9 '21 at 18:57

You can also count using generating functions.

Each of the $$7$$ colors can be used once, twice, or thrice so the generating function for each color is $$\left(x+\frac{x^2}{2!} +\frac{x^3}{3!}\right)$$

and to fill $$9$$ slots, we need to find coefficient of $$x^9$$ in $$9!\left(x+\frac{x^2}{2!} +\frac{x^3}{3!}\right)^7 =2328480$$

so $$Pr = \dfrac{2328480}{7^9}$$

• +1 for using generating functions :)) Aug 9 '21 at 12:40
• @Bulbasaur: Thanks, I was expecting you to jump in ! :)) They really cut out a lot of verbiage ! Aug 9 '21 at 12:51