Say I have 5 blue, 6 red, and 7 green balls. How many ways are there to choose 8 balls, without regard to order? My first thought was to just add up all the balls and choose 8 from the collection of 18, but I know that that'll overcount the possibilities, as I can get the same color combination of balls multiple ways by choosing different balls within the same color group. How would I correctly approach this problem?

  • $\begingroup$ So all the same color balls are the same? $\endgroup$
    – S.C.B.
    Jan 24 '17 at 1:25
  • $\begingroup$ Yep. All balls in the same color group are the same. $\endgroup$ Jan 24 '17 at 1:29

Any selection can be described as a triple $(b,r,g)$ where $0≤b≤5$, $0≤r≤6$, $0≤g≤7$ and $r+b+g=8$.

As the numbers involved are small, it's not difficult to work case by case. We'll go through the possible values of $b$.

I. $b=0$. Then $r≥1$ but any non-zero value of $r$ works so $\fbox 6$ cases.

II. $b=1$. Now $r$ can be any value from $0$ to $6$ so $\fbox 7$ cases.

III. $b=2$ Again we can use any value of $r$ so $\fbox 7$ cases.

IV. $b=3$. Now $0≤r≤5$ so $\fbox 6$ cases.

V. $b=4$ Now $0≤r≤4$ so $\fbox 5$ cases.

VI. $b=5$ Now $0≤r≤3$ so $\fbox 4$ cases.

Finally the answer is $$6+7+7+6+5+4=\fbox {35}$$

Note: while the logic is fairly simple, case by case enumeration can be a bit error prone so I suggest checking carefully. As an alternate method you could multiply out the generating functions $$(1+x+x^2+x^3+x^4+x^5)(1+x+\cdots +x^6)(1+x+\cdots +x^7)$$ seeking the coefficient of $x^8$.


Let's say that we ignore the green balls for now. We have can have between 0 and 5 blue balls and 0 and 6 red balls. So the number of possible pairings of number blue and number red is: $$6 * 7 = 42$$ Now we have to eliminate combinations where we had more than 8 balls so we need to see how far above the target we can get by adding the number of blue (5) and red (6) balls and subtracting the total desired (8). Then we sum the integers from 1 to that answer. This gives us how many of our 42 scenarios are too high. $$5 + 6 - 8 = 3$$ $$\sum_{n=1}^{3} n = 6$$ $$42 - 6 = 36$$ Then we need to subtract off the bottom where the greens can't get us to 8 which only occurs when we have zero blue and zero red so: $$36 - 1 = 35$$ And thus you have 35 combinations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.