counting non-unique sub-multisets of a set.

660 Views Asked by At

Thank you all for your replies. I am so sorry for the inconvenience, I think I have messed up a lot in here.

I'll just rephrase the whole question again. Let N be the original set which follows the conventional set definition of not having duplicates. What I am trying to find is the number of multi-sets of length C, where all of their elements ∈ N.

The length is define as the number of the elements in the multi-set including the repeated ones. N is composed of integers only.

Since I am not so good with symbols, I'll put a numerical example: Let N = {1, 2, 3, 4} and C = 7, a possible multi-set is x = {1, 1, 1, 2, 2, 4, 5} , where the length of x = 7. There is no constrain on the number of repetition as long as the length of x is <= C.

The sets {1, 1, 1, 2, 2, 3, 4, 5} and {1, 1, 1, 1, 2, 2, 4, 5} are not included since both have a length that is > 7.

There is no limit on C i.e. it can be bigger than the size of N.

I am also not interested in the permutations of the sets, so: {1, 1, 1, 2, 2, 4, 5}, {1, 1, 2, 1, 2, 4, 5}, {1, 1, 1, 2, 2, 5, 4} etc.. are all the same.

2

There are 2 best solutions below

0
On

Assuming that order does not matter, this is solvable using Stars-and-Bars.

Define an ordering of our set of integers $N = \{n_1,n_2,n_3,\dots,n_k\}$

Let $x_i = $the number of times that $n_i$ appears in our multiset for each $i\in [k]$

We are curious then to the number of Dionphantine solutions to $x_1+x_2+\dots+x_k \leq k$

To account for the fact that we are asking about $\leq$ instead of $=$, introduce an additional variable $x_0$ such that $x_0= k - x_1-x_2-\dots-x_k$.

So, then the number of Dionphantine solutions to $x_0+x_1+\dots+x_k = k$ with each $x_i\geq 0$ is then given by the multichoose function (read about the Stars and Bars method from wikipedia to see why) as $$\left(\!\!\!\binom{k}{k+1}\!\!\!\right) = \binom{k+(k+1)-1}{(k+1)-1} = \binom{2k}{k}$$

3
On

Did I understand correctly? You want the number of multi-sets where each element is an element of $\{1,2,3\dots n\}$ and each element appears at most $n$ times?

To solve this just select how many times you want each of the integers fron $1$ to $n$ to appear in the multiset, this value can be any integer between $0$ and $n$ and so there are $n+1$ choices, since this choice is taken $n$ times the final answer is $(n+1)^n$