Product Principle for Generating Functions
I am inquiring about the Product Principle for Generating Functions as applied in combinatorial counting problems.
First, let me state the principle: Consider a two-phase process $\mathcal{C}$. Pick an integer $0 \leq k \leq n$ and split $[n]$ into subintervals $\{1,2, \ldots, k\}$ and $\{k+1, k+2, \ldots, n\}$. Perform task $\mathcal{A}$ on the first interval and perform task $\mathcal{B}$ on the second interval. Let
- $A(x)=$ the generating function for task $\mathcal{A}$
- $B(x)=$ the generating function for task $\mathcal{B}$
Then the generating function for process $\mathcal{C}$ is $$ C(x)=A(x) B(x) $$ The source is here: https://www.youtube.com/watch?v=k0n7y3eEf64&list=PLlWULwPzrppVYesREEHJDeYftNLqajvzs&index=14
and many other documents also describe it similarly.
I think it is not correct. Let me give an example:
Problem 1: I have $100$ balls, and I need to select a few balls and color them either blue or red (each ball one color). The remaining balls are to be colored white or yellow. Okay, the above principle works well.
Problem 2: I have $100$ balls, and I need to select a few balls and color them either blue or red (each ball one color). The remaining balls are to be colored blue or yellow. Clearly, the principle cannot be applied here, as some methods will be counted twice.
I want to ask what the correct principle, with full conditions, is and any related documents. Thank you!