I made up a question such that

There are $3$ identical blue balls ,$2$ identical red balls , $5$ distinguishable yellow balls ,$4$ distinguishable green balls. We want to make a mixture consisting of $8$ balls by using these balls. How many ways are there

a-) If selection order does not matter

b-) If selection order matters


a-) This part was easy by using generating functions such that

Blue balls = $(1+x +x^2 +x^3 ) $

Red balls = $(1+x +x^2 )$

Yellow balls = $(1+5x +10x^2 +10x^3 +5x^4 +x^5) $

Green balls = $(1+4x +6x^2 +4x^3 +x^4)$

We should find the coefficient of $[x^{8}]$ in the expansion of them .

b-) This part is where i hesitated my solution. I used exponential generating functions , but i am not sure about the exponential generating function of distinguishable balls.

Blue balls = $$\bigg(1+ \frac{x}{1!} +\frac{x^2}{2!} + \frac{x^3}{3!} \bigg ) $$

Red balls = $$\bigg(1+ \frac{x}{1!} +\frac{x^2}{2!} \bigg)$$

Yellow balls = $$ \bigg (1 + \frac{P(5,1) \times x}{1!} +\frac{P(5,2) \times x^2}{2!} + \frac{P(5,3) \times x^3}{3!} + \frac{P(5,4) \times x^4}{4!} + \frac{P(5,5) \times x^5}{5!} \bigg)$$

Green balls = $$ \bigg (1 + \frac{P(4,1) \times x}{1!} +\frac{P(4,2) \times x^2}{2!} + \frac{P(4,3) \times x^3}{3!} + \frac{P(4,4) \times x^4}{4!} \bigg)$$

So , i should find the coefficient of $\frac{x^{8}}{8!}$ or find the coefficient of $x^{8}$ and multiply it by $8!$.

I am not sure about part $b$ .I want you to check my solution.

  • $\begingroup$ For yellow and green balls, you should simply continue with what you used for the first question. What you are doing for the yellow and green balls for second question is not required. What you did for red and blue balls is correct. $\endgroup$
    – Math Lover
    Jul 17, 2021 at 18:02
  • $\begingroup$ Then look for coefficient of $x^8$ and multiply by $8!$. Also, like the below answer, you can have one generating function for all distinguishable balls rather than two different for green and yellow. $\endgroup$
    – Math Lover
    Jul 17, 2021 at 18:08
  • $\begingroup$ @MathLover when i look over exponential generating functions , your recommendation did not make sense to me ,because in your recommendation , you choose which object will be used but not placed them. For example , assume that we contruct our $8$ balls with only yellow and green balls , it can be done by $5$ yellow and $3$ green or $4$ yellow and $4$ green. In the first case , we can dsiperse them by $8! / (5! \times 3!)$ but we do not know which ball will be placed which leap. Moreover, the balls are distingusihable ,then we should also multiply by $P(5,5) \times P(4,3)$. think like passwords $\endgroup$ Jul 17, 2021 at 18:58
  • $\begingroup$ @MathLover what i meant by passwords was how many password are there if it contain $5$ letter and $3$ digits when repetition is not allowed $\endgroup$ Jul 17, 2021 at 19:00
  • $\begingroup$ Please take example of green balls. The generating function to only choose (not arrange) green balls is $1+4x +6x^2 +4x^3 +x^4$, correct? But that is all we need to do - select green balls and yellow balls. Their permutation comes from multiplication we do in the end which is by $8!$ $\endgroup$
    – Math Lover
    Jul 17, 2021 at 19:03

2 Answers 2


Your work is all correct.

Here is a way to simplify your work. Give each of the yellow and green balls its own generating functions, since $5$ distinguishable yellow balls is the same as 5 different colors each with one ball. The g.f. for each of these colors with a single ball is $1+x$, for both the ordered and unordered cases. Therefore, the unordered case is $$ [x^8](1+x+x^2+x^3)(1+x+x^2)(1+x)^{5+4} $$ and the ordered case is $$ 8!\cdot [x^8](1+x+x^2/2!+x^3/3!)(1+x+x^2/2!)(1+x)^{5+4} $$


I believe you have arrived at the correct answer, though I wouldn't do it the way you did.

There are $9$ distinguishable balls; it doesn't matter if they're green or yellow. Suppose we pick $r$ red balls, $b$ blue balls and $k$ green/yellow balls. We can arrange these in $$\frac{12!}{r!b!}\tag1$$ ways.

So, it seems to me that an ordinary generating function is more appropriate for the green/yellow balls. I would use $$\sum_{k=0}^9\binom9kx^k$$ I think your expression comes to the same thing, but it's harder to understand. I don't think you would have had the doubts that led you to post this question if you'd done the problem the way I suggest.

Finally, you should find the coefficient of $x^{8}$ and multiply by $12!$. The expression in $(1)$ makes this clear.

  • $\begingroup$ I made a typo wrting $x^{12}$ , it would be $x^8$ $\endgroup$ Jul 17, 2021 at 17:36
  • $\begingroup$ @Bulbasaur Yes, and I just copied without thinking, duh. Thanks, I'll edit my answer. $\endgroup$
    – saulspatz
    Jul 17, 2021 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .