2

A multiset $A$ contains $n$ positive integers. The multiplicity of every integer is less or equal to $m$.

$A$ is partitioned into $m$ subsequences in such a way that the multiplicity of all elements in a subsequence is $1$. Orders doesn't matter, i.e., with $m=2$, the sequence $\{1,1,15\}$ has only one partition, namely, $\{1,15\},\{1\}$, which is the same as $\{15,1\},\{1\}$ and $\{1\},\{1,15\}$.

How to determine the amount of possible partitions from $n$, $m$ and the multiplicities of the elements of $A$?

Peter Taylor
  • 13,425
Coolwater
  • 1,292
  • I suspect you mean the multiplicity of every integer (in $A$) is less than or equal to $m$, or perhaps that $m$ is actually the maximum of the multiplicities of entries in $A$. Since order "doesn't matter", it might be better to refer to partitioning multiset $A$ into (ordinary) sets, and counting the number of ways to do this. If those sets ("cells" of the partition) were unique, then the problem amounts to counting the $m\times n$ binary matrices with specified row sums and distinct columns. – hardmath Apr 27 '14 at 12:30
  • It might be helpful to know a little about what motivates this Question, in understanding both its requirements and what forms of an Answer ("How to determine...") will be useful. Although this older Question, partition of a multiset, was not well-stated, it drew a good Answer by @DavidBevan which includes some Mathematica code that might interest you. – hardmath Apr 27 '14 at 13:31

1 Answers1

2

Let $A$ be a multiset containing $n$ distinct integers having multiplicities $0 \lt r_i \le m, i=1,\ldots,n$. We are asked to count how many ways $A$ can be partitioned into $m$ ordinary sets $C_j \subseteq A, j=1,\ldots,m$.

We assume that ordering of these cells $C_j$ is of no consequence in our counting, repeated (equal) cells are allowed, and no cell is the empty set $C_j \neq \emptyset$.

These $C_j$ can be identified with columns of an $n\times m$ binary matrix $M$ whose rows contain a $1$ or $0$ according the the presence or absence, resp., of the $i$th integer in the $j$th set $C_j$. The multiplicity $r_i$ of the $i$th integer is the $i$th row sum, and indifference as to ordering of cells is imposed by putting the columns in lexicographic order. Finally the absence of an empty set among cells amounts to $M$ having no columns of all zeros.

The number of such matrices can be computed by a procedure similar to the one for counting binary matrices with prescribed row sums and unique columns, using a product of integer "transition" matrices that express the building of the matrix one row at a time, but instead of guaranteeing that all columns are distinct when the final row is added, we have to guarantee all columns are nonzero at that point. This turns out to be a somewhat easier condition.

We then count the number of distinct outcomes by forming:

$$ P(m) = [1, 0, \ldots ,0] ( \prod_{i=1}^n T_i ) [1, \ldots ,1, 1]^T $$

where $T_i$ is an integer matrix, depending only on $m$ and $r_i$, whose entries count the ways of transitioning from the stage where $M$ has its first $i-1$ rows filled in to the next, where $M$ has its first $i$ rows filled in, subject to the restriction on row sums and lexicographic ordering of columns.

NB: The count $P(m)$ includes possible matrices with zero columns (corresponding to using empty sets in the "partition"), but we can exclude these from the count by taking $P(m) - P(m-1)$.

The initial state for $M$ is empty rows, in which all columns $C_j$ are "equivalent" (being empty). At each stage we must account for all possible states that can arise to the extent that adding the next row can be done (filling $r_i$ entries) in accordance with lexicographic ordering.

To represent states we use a partition of the integer $m$:

$$ m = s_1 + s_2 + \ldots + s_k, s_1 \ge s_2 \ldots s_k $$

which describe how many identical columns there are grouped among the $m$ columns so far in the construction.

When entries are introduced in the $i$th row the partition of the integer $m$ may be refined (broken down into smaller summands) or stay the same, but we can never go backward. Columns that were previously different cannot become identical by introducing more entries. Thus the matrix of transition counts is upper triangular.

To compute the transition counts one can take a partition of integer $m=s_1+\ldots+s_k$ and generate all the possible weak compositions of row sum $r$ that are dominated by the given partition:

$$ r = t_1 + \ldots + t_k, 0 \le t_d \le s_d $$

Since $r_i \le m$, it's always possible to find room to put the prescribed ones somewhere in the $i$th row and thus find a partition of $r_i$ satisfying the above. Note also that for weak compositions, order of summands matters and summands are allowed to be zero.

For each such weak composition, the partition of integer $m$ is modified accordingly as some groups of identical columns stay intact and some become split into two new groups as the columns acquires a mixture of both one and zero entries on the $i$th row.

Next we revisit some smallish examples where $m = n = 2e$ and each row sum $r_i = e$, for $e = 2,3$.

hardmath
  • 37,015
  • $C_j$ may be nonzero. The only condition is that the row sums should be the multiplicities, and swapping two columns shouldn't be considered as another partition (columns should be sorted, you could say). But what are those $T_i$? I understand nothing about them whether the $C_j$'s are unique (as previous question), nonzero or sorted, except for the fact that they are upper triangular matrices, if that still apply? – Coolwater Apr 27 '14 at 20:19
  • So $C_j$ may be zero, also? In effect we have $m$ or fewer sets in the partition? The $T_i$ are triangular, as in the other Q, and I will supply more detail about their construction. In the first stage whichever row sum is chosen to fill the first row, the sorting condition means there is only one way to do it. What we need to keep track of, so far as "state" is concerned, is the number of distinct columns of $M$ created so far, and the count of ways to supply the new entries of the next row may create further distinctions (but never makes columns alike that were different above). – hardmath Apr 27 '14 at 21:22
  • That's the basic reason that $T_i$ is triangular (but not square in general). – hardmath Apr 27 '14 at 21:23
  • The ways of transitioning from the stage where $M$ has its first $i−1$ rows filled in to the next, where $M$ has its first $i$ rows filled in, ehh? This is a number depending on the previous $i-1$ chosen rows, and $r_i$. How do I get from those to $T_i$ – Coolwater Apr 28 '14 at 17:16
  • We don't need to remember everything about the first $i-1$ rows. It suffices to lump their outcomes together as partitions of the integer $m$, I.e. unordered sums that add up to $m$. So I will explain and do an example once I get off work. – hardmath Apr 28 '14 at 18:56
  • 1
    @hardmath I have posted a slightly different question here that I think is strongly related with this one – Ninja Warrior Aug 20 '18 at 11:06