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?
[Math] Number of ways to choose n objects from groups of indistinguishable objects
balls-in-binscombinationscombinatorics
Best Answer
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$.