1

I was solving a combination problem of arranging N different groups into 2 equal parts where order of elements in the part doesn't matter. e.g- We have 3 types of elements/groups A, B and C . Type A has 1 element, type B has 6 elements and type C has 1 element.

If I arrange them in two equal parts, the possibilities are following :

ABBB | BBBC , BBBC | ABBB , ACBB | BBBB , BBBB | ACBB

Another case,

type X has 2 elements, type Y has 2 elements. the possible arrangements are :

XX | YY , XY | XY , YY | XX

How to calculate this count ? I was looking forward to generalize this for N types having different frequencies.

2 Answers2

0

Suppose there are $n$ different groups, and the $i^{th}$ group has $a_i$ members total. I will assume that $s=\sum_{i=1}^n a_i$ is even, so that it is possible to equally divide the elements.

Let $x_i$ be the number of members of the $i^{th}$ group that are put into the first part, so that $a_i-x_i$ are put into the second part. The numbers $x_i$ will describe a valid solution if and only if $$ x_1+x_2+\dots+x_n=s/2,\\ 0\le x_i\le a_i\hspace{.6cm}\text{for }1\le i\le n $$ We just need to count the number of integer solutions to the above equation and inequalities. This can be done using the Principle of Inclusion Exclusion and stars and bars, as described in the answers to this question.

Mike Earnest
  • 84,902
-1

$A$ is in one group. Either $C$ is in the same group as $A$ or it isn't.

Think about it....