TITLE: Permutation of 2 or more groups while keeping the ordering of the groups
QUESTION [5 upvotes]: I've been trying to get a general formula for this, but I couldn't find anything exactly what I need. What I want is, let's say we have 3 groups:
(x,y,z),(a,b,c) and (k,l,m)
What is the total number of permutations of these three occurring in a single group while they keep their initial order, but can intertwine with other groups? Is there a general formula for this or can we derive it somehow?
e.g. (x,a,b,k,y,c,l,m,z) or (k,l,a,x,b,y,z,m,c)
notice that x always comes before y and y always comes before z in the combined group, same goes for other groups too.
In a small scale with 2 groups:
(1,2) and (3,4)
All possibilities:
(1,2,3,4)
(1,3,4,2)
(1,3,2,4)
(3,4,1,2)
(3,1,2,4)
(3,1,4,2)
Is there a formula which would give me the number "6" for these two groups?
Thanks!

REPLY [2 votes]: If you haven't graduated to the multinomial coefficient, here is a simple way.
Using the same example of $(x,y,z),(a,b,c),(k,l,m)$, imagine $9$ slots are available.
Place $(x,y,z)\;$ in this order$\;$ in $\binom 93$ ways,
and $(a,b,c)$,  similarly in the remaining slots in $\binom63$ ways,
to get a total of $\binom 93 \binom 63$ ways
[ The last group, of course, automatically goes into the remaining $3$ slots ]