<s>[INST] Combinatorics : Choosing r elements from a multiset of n elements, given some elements in multiset are identical to each other Given a multiset = {a, a, a, b, b, b, b, c, c}. The multiset has:
number of a's = 3
number of b's = 4
number of c's = 2
In how many ways we can select any 3 elements from this multiset?

My solution to this question:
to get the required number of ways in which we can select three elements from that multiset we need to find the coefficient of $x^3$ in $\{\left( 1+x+x^2+x^3 \right) \left( 1+x+x^2+x^3 +x^4 \right) \left( 1+x+x^2 \right)\}$
Now, I'm stuck. How to proceed with this? Do I have to manually sum the number of $x^3$ we can obtain after multiplication, to get the coefficient.
Can this be done using Generating functions? If yes, then how?
Give references to book/study material online link, if you want to escape writing down complete solution.
 [/INST] Here the numbers are so small that it’s not hard simply to write out the terms of degree $3$ and count them:
$$\begin{align*}
&x^3\cdot1\cdot1\\
&x^2\cdot1\cdot x\\
&x^2\cdot x\cdot 1\\
&x\cdot 1\cdot x^2\\
&x\cdot x\cdot x\\
&x\cdot x^2\cdot 1\\
&1\cdot x\cdot x^2\\
&1\cdot x^2\cdot x\\
&1\cdot x^3\cdot 1
\end{align*}$$
However, counting multisets of a given cardinality isn’t too hard a problem theoretically. If we had at least $3$ of each letter available, the answer would be simply
$$\left(\!\!\binom{3}{\color{red}3}\!\!\right)\;,$$
the number of multisets of cardinality $3$ taken from a set of $3$ available types of object. By a standard stars and bars argument this is equal to
$$\binom{3+\color{red}3-1}{\color{red}3}=\binom53=10\;.$$
However, we have only $2$ $c$s available, so we have to throw away any multiset with more than $2$ $c$s. Since we’re looking at multisets of size $3$, there is only one, and we get $10-1=9$ as the final count.
You can also work directly with your generating function. Note that
$$1+x+x^2+x^3=\frac{1-x^4}{1-x}\;,$$
and similarly for the other two factors, so your generating function can be rewritten as
$$\frac{(1-x^3)(1-x^4)(1-x^5)}{(1-x)^3}\;.\tag{1}$$
Now
$$\begin{align*}
(1-x^3)(1-x^4)(1-x^5)&=(1-x^3-x^4+x^7)(1-x^5)\\
&=1-x^3-x^4-x^5+x^7+x^8+x^9-x^{12}\;,
\end{align*}$$
so $(1)$ is a sum of terms of the form $\dfrac{x^m}{(1-x)^3}$. A useful generating function to know is
$$\frac1{(1-x)^3}=\sum_{n\ge 0}\binom{n+2}nx^n=\sum_{n\ge 0}\binom{n+2}2x^n\;,$$
from which we get
$$\frac{x^m}{(1-x)^3}=\sum_{n\ge 0}\binom{n+2}2x^{m+n}\;.\tag{2}$$
The coefficient of $x^3$ in $(2)$ is 
$$\binom{(3-m)+2}2=\binom{5-m}2\;,$$
which is $0$ for $m>3$, so we need only deal with $\dfrac1{(1-x)^3}-\dfrac{x^3}{(1-x)^3}$, with $m=0$ and $m=3$, getting
$$\binom52-\binom22=9$$
as before.
</s>