# A box contain an unlimited number of balls (mixed) of five different colors. How many ways can a handful of one or more balls be randomly selected

I have a question: A box contain an unlimited number of balls (mixed) of five different colors. How many ways can a handful of one or more balls be randomly selected that has at least one ball and at most 12 balls in total?

I know that every handful is some combination with repetition, however as there is an unlimited number of balls is where I get the confusion.

• You could add up the number of possible colour combinations for 1 through to 12 balls. Or you could find a shortcut and pretend there is a sixth invisible colour (remembering that they cannot all be invisible). This is a combinatorial question, not a probability or statistics question Aug 4, 2021 at 0:33
• Since you can take at most 12 balls, you can take at most 12 balls of any one color. Just treat this as though the box contained exactly 12 balls of each color. Aug 4, 2021 at 0:34

Adding onto Karl's answer, we want to find the number of nonnegative integer solutions to $$x_1+x_2+x_3+x_4+x_5\leq 12$$ To determine this, we will first add a temporary variable, $$c$$, that is a nonnegative integer. We can use this variable to now have the statement $$x_1+x_2+x_3+x_4+x_5+c=12$$ Convince yourself that the number of nonnegative integer solutions to this equation is the same as the number of solutions to the first inequality.

Using stars and bars, we have that the number of nonnegative integer solutions to $$\sum_{i=1}^k a_i=n$$ is $$\binom{n+k-1}{k-1}$$.

We can apply this theorem to see that the number of ways to grab the colored balls is $$\binom{12+6-1}{6-1}=\binom{17}{5}=6188$$.

However, this includes the solution when $$x_1,x_2,x_3,x_4,x_5=0$$, which is explicitly stated in the problem to be excluded. Hence our final answer is $$\boxed{6187}$$.

Questions like this are often worded ambiguously, forcing you to figure out a sensible interpretation. In this case, you aren't told whether different balls of the same color should be considered different when counting "ways". However, if we considered same-colored balls distinct, then the colors would be irrelevant (and since the number of balls is "unlimited", we wouldn't have enough information to answer the question). So we can infer that you're expected to think of two handfuls as the same if they look the same (e.g. "5 red and 4 blue"), even though multiple different sets of balls might look the same way.

The "unlimited" here just means that it's possible to get a handful where all balls are the same color (of any color). Since we're only interested in handfuls of at most 12 balls, it doesn't matter whether the box has 12 of each color or 100 of each color.

In other words, you're looking for the number of non-negative integer solutions to

$$x_1+x_2+x_3+x_4+x_5\le12$$

and the "unlimited" means there are no explicit upper limits on the variables.