# Selecting identical and distinguishable balls when the order matters

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

MY WORK =

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.

• 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. Jul 17 at 18:02
• 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. Jul 17 at 18:08
• @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 Jul 17 at 18:58
• @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 Jul 17 at 19:00
• 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!$ Jul 17 at 19:03

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}$$
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.
• I made a typo wrting $x^{12}$ , it would be $x^8$ Jul 17 at 17:36