Let $S_1, S_2$ and $S_3$ be three ordered sets, each having $3$ elements. Let all three sets be pairwise disjoint. For example say $S_1 = \{ a, b, c \}, S_2 = \{ 1, 2, 3 \}$ and $S_3 = \{ I, II, III \}$.
Let $T$ be a target container with room for $6$ elements. $T$ is supposed to be filled with items from the three sets $S_1, S_2$ and $S_3$ but their original order has to be respected. This means that (i) the $k$-th element from any set must be present if any element after the $k$-th element is also present and (ii), that the $k$-th element must always come before the $k+1$-th element, and the $k+2$-th element and so on.
For example $T = \{1, 2, 3, a, b, I\}$ is a valid configuration for $T$ but $T = \{ 1, 2, 3, b, c, a \}$ is not since $a$ must appear before $b$ and $c$ due to the order of $S_2$. Also $T = \{ 1, 2, b, c, I, II \}$ is invalid because items $b$ and $c$ appear but $a$ is missing.
Note that each valid configuration of $T$ must have $6$ elements but it is totally fine to choose elements from only two sets for that. In other words, $T$ can completely disregard one of the sets and only choose elements from the remaining two.
Goal: Find the number of all possible configurations of $T$ obeying these rules.
My approach: I have come up with this formula $$ \sum_{l_1, l_2, l_3 \in \{ 0, 1, 2, 3 \}: l_1 + l_2 + l_3 = 6} \binom{6}{l_1} \binom{6 - l_1}{l_2} = 510 $$ due to the following reasons:
- Let $l_1, l_2, l_3$ be the number of elements which we are taking from $S_1, S_2$ and $S_3$ respectively. Since each set contains $3$ elements, $l_1, l_2, l_3 \in \{0, 1, 2, 3\}$ and since $T$ must contain $6$ elements in total, $l_1 + l_2 + l_3 = 6$.
- $T$ has $6$ slots in total of which $l_1$ are taken by elements from $S_1$. The number of ways to choose $l_1$ slots those items from $S_1$ is specified by $\binom{6}{l_1}$.
- Once the slots for the elements from $S_1$ are chosen, $6 - l_1$ slots remain. Using the same argument as previously, there are $\binom{6 - l_1}{l_2}$ ways to choose slots for the items of $S_2$.
- The remaining slots are left for the items from $S_3$.
- Now, if there are $l_1$ elements to be taken from $S_1$, then there is only one option to choose these elements. You simply take the first $l_1$ elements in $S_1$. Therefore, nothing has to be added here. This argument also applies for the elements of $S_2$ and $S_3$.
Could you please give me your thoughts on this and tell me whether I did something wrong here?