Example: There are 3 bags with 10 balls each of red, white, and black. If 16 balls are drawn from them, and it is required that all three colors are included, how many different ways are there to do this?
Assume the total number of ways to take out $n$ balls is $a_{n}$, where the number of red, white, and black balls are $x_{1}$, $x_{2}$, and $x_{3}$ respectively, then $a_{n}=\sum_{x_{1}+x_{2}+x_{3}=n} 1\left(x_{i}\right.$ are positive integers, $\left.1 \leqslant x_{i} \leqslant 10, i=1,2,3\right)$, thus the generating function of $a_{n}$ is
$$
\begin{aligned}
f(x) & =\sum_{n=0}^{\infty} a_{n} x^{n}=\sum_{n=0}^{\infty}\left(\sum_{x_{1}+x_{2}+x_{3}=n} 1\right) x^{n}=\sum_{x_{1}=1}^{10} \sum_{x_{2}=1}^{10} \sum_{x_{3}=1}^{10} x^{x_{1}+x_{2}+x_{3}} \\
& =\left(\sum_{x_{1}=1}^{10} x^{x_{1}}\right)\left(\sum_{x_{2}=1}^{10} x^{x_{2}}\right)\left(\sum_{x_{3}=1}^{10} x^{x_{3}}\right)=\left(x+x^{2}+\cdots+x^{10}\right)^{3}=\frac{x^{3}\left(1-x^{10}\right)^{3}}{(1-x)^{3}} \\
& =x^{3}\left(1-3 x^{10}+3 x^{20}-x^{30}\right) \sum_{n=0}^{\infty} C_{n+2}^{2} x^{n}
\end{aligned}
$$

The coefficient of $x^{16}$ is
$$
a_{16}=C_{13+2}^{2}-3 C_{3+2}^{2}=105-30=75 .
$$

Thus, there are 75 different ways to take out the balls.