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!
Let your groups be group $A = (a_1,a_2,\dots,a_\alpha)$ group $B = (b_1,b_2,\dots,b_\beta)$, on up to group $K = (k_1,k_2,\dots,k_\kappa)$ with intended order $a_1<a_2<\dots<a_\alpha$ and similarly for the other letters as well.
Let $\alpha+\beta+\dots+\kappa = N$
Relate this problem to the problem of arranging letters in the word:
$$\underbrace{aaaaa\dots a}_{\alpha~\text{copies}}\underbrace{bbbbb\dots b}_{\beta~\text{copies}}\dots\underbrace{kkkkkk\dots k}_{\kappa~\text{copies}}$$
From earlier example, we know the number of arrangements to be:
$$\binom{N}{\alpha,\beta,\dots,\kappa} = \frac{N!}{\alpha!\beta!\dots\kappa!}$$
Given an arrangement of the word $aa\dots k$ as above, replace each $a$ by $a_1,a_2,\dots,a_\alpha$ with the leftmost $a$ as $a_1$, the second leftmost $a$ as $a_2$, etc... Similarly for the other letters.
Your example of $(1,2)$ and $(3,4)$, we have two groups of two, and a total of four elements for a total of $\binom{4}{2,2}=\frac{4!}{2!2!}=6$ arrangements.
Your example of $(x,y,z),(a,b,c),(k,l,m)$ we have three groups of three for a total of nine elements and therefore a total of $\binom{9}{3,3,3}=\frac{9!}{3!3!3!} = 1680$ arrangements.