-1

Say I have a multiset with $n$ elements, with $n_1, n_2,..., n_k$ of each "type", and $n_0 = n-(n_1+n_2+...+n_k)$ of "type" "don't care".

I take a random permutation of the multiset.

What is the probability that none of the $n_1, n_2,..., n_k$ occupy a position taken by their respective "type" before the permutation?

As a simple example, say the multiset is $\{1,2,2,3,3,3,0,0,0,0,0,0,0\}$, where $0$ represents the "don't care" item.

Then $\{0,0,0,0,0,1,0,2,2,3,3,3,0\}$ is one such derangement - none of the positive integers appears in a place previously occupied by one of itself, and I don't care about any zero that does.

There are some nice answers on the site for the case of multiset derangements, but none I've found deal with the "don't care" case.

Solution or reference(s) most appreciated.

rasher
  • 517

1 Answers1

1

The answer here is basically the same as the standard derangement for multisets; the answer in Derangement formula for multisets provides the exact logic you need to solve this problem. The difference is that your "don't care" type is never used in the inclusion-exclusion; it simply needs to be added into the total number of permutations.

Following the major steps in that proof, specify $\beta_i$ instances of type $i$ to be fixed, for $1 \leq i \leq k$. Note we are specifically excluding type $0$, since we do not care about whether they are fixed points. The number of ways we can select these fixed points is $${n_1 \choose \beta_1} {n_2 \choose \beta_2} \cdots {n_k \choose \beta_k}$$ We now permute the remaining elements arbitrarily. There may well be additional fixed points created, but the inclusion-exclusion will take care of that. The number of ways to permute the remaining elements is $${{n-\sum_{i=1}^k \beta_k} \choose {n_0;n_1-\beta_1;\cdots;n_k-\beta_k}}$$

Finally, applying inclusion-exclusion gives us the answer $$ \sum_{\beta_1 = 0}^{n_1} \cdots \sum_{\beta_k = 0}^{n_k} (-1)^{\beta_1 + \dots + \beta_k} \binom{n_1}{\beta_1} \cdots \binom{n_k}{\beta_k} {{n-\sum_{i=1}^k \beta_k} \choose {n_0;n_1-\beta_1;\cdots;n_k-\beta_k}}$$

Note that it is easy to adapt this argument to the case where you have multiple classes of "don't care" types.

Jeremy Dover
  • 1,592
  • Thanks much! After reviewing the referenced answer, this should have been obvious to me, thanks for lighting the way. – rasher Oct 27 '18 at 01:53