0

Suppose I have $3$ yellow balls, $2$ red balls and $4$ green balls. How many different combinations of colors can I get if I select $k$ balls?

For $k = 1$ it is easy. I can select a yellow, or a red or a green, i.e. $3$ in total.

For $k = 2$ I count $6$ possible combinations: YY, YR, YG, RR, RG, GG. But what is the general formula?

And what's the formula for the total sum of combinations, i.e. for the total number of ways I could present a selection of balls?

Jens
  • 5,786

1 Answers1

2

The generating function is $(1+x+x^2)(1+x+x^2+x^3)(1+x+x^2+x^3+x^4)$ where the highest exponent is the number of balls of each color. You can expand it and find the coefficient of $x^k$.

Ross Millikan
  • 383,099
  • Thanks! Though I have no idea why this method would provide an answer, I can certainly work with it, especially given your link to Wolfram. However, does this mean there isn't an explicit formula? – Jens Jan 22 '16 at 18:13
  • Basically the $(1+x+x^2)$ term says there is one way to have each of $0,1,2$ red balls and no ways to have any other number. The others are similar. When you multiply them, the laws of exponents do just the calculation you want. You can prove it by writing out the summations. – Ross Millikan Jan 22 '16 at 19:10
  • 1
    Often, there are generating functions or partition polynomials for combinatorial entities. To see the partitions of your colored balls in detail, you can expand $(1+r+r^2)(1+y+y^2+y^3)(1+g+g^2+g^3+g^4)$. It stands for the combinations of 0 to 2 red balls, 0 to 3 yellow balls and 0 to 4 green balls. – IV_ Jun 08 '19 at 17:00