Imagine I have $n$ indistinguishable cats and $k$ designs to color the hats on those cats. Consider the case where $k \leq n.$ I want to figure out the number of ways I can color the hats on these indistinguishable cats such that each design shows up at least once.

I've been having some funky problems with trying to get this counting problem right. I originally imagined that, given that the cats are indistinguishable, We can first assign $k$ designs to $k$ of these cats 1 way and then choose among the $k$ designs for each of the other $n-k$ indistinguishable cats $k^{n-k}$. I assumed that we should divide this by the number of ways we could permute those $n-k$ cats, since the order of assignment doesn't matter. Thus, my original hypothesis for the counting proof was $$\frac{k^{n-k}}{n-k}.$$ However, this hypothesis has failed on a number of inputs. Namely, when $n=4$ and $k=2$, the number of ways should be 3, but this hypothesis says it should be $2$. Does anyone have recommendations on how to go about this kind of problem?

  • 1
    $\begingroup$ You say the cats are indistinguishable, however you used $k^{n-k}$ which implies that the remaining $n-k$ cats are distinguishable. Letting $x_1,x_2,\dots,x_k$ to be the number of cats wearing each pattern hat, you have the system $\begin{cases} x_1+x_2+\dots+x_k=n\\ 1\leq x_i\end{cases}$. Have you seen this form before in another problem? $\endgroup$ – JMoravitz Jun 1 '16 at 21:25
  • 1
    $\begingroup$ kittywigs.com $\endgroup$ – Will Jagy Jun 1 '16 at 21:29
  • $\begingroup$ since the order of the remaining $n-k$ hats doesn't matter, assume you force a single one. In other words give each design a precedence ($h_1, h_2,...$) and hand out hats one at time such that if you just handed out hat $h_i$ the next hat $h_j$ that you hand out must satisfy $j \geq i$. This way you can assure that you don't double-count any configurations, without the risk of mis-correcting. $\endgroup$ – Gabriel Burns Jun 1 '16 at 21:30
  • $\begingroup$ Sorry, I should clarify, the $h$'s in the previous comment refer to hat designs, so when I say the last hat you handed out was $h_i$, I mean it was a hat with the design $h_i$. $\endgroup$ – Gabriel Burns Jun 1 '16 at 21:39

Think of the hats as boxes. Now pick $k$ of the cats at random and place one into each box. That satisfies the requirement that each hat type be used at least once. Now how many ways can you arrange the remaining cats into the boxes? (Hint: "stars and bars").

  • $\begingroup$ Upvoted (+1), first answer and precisely the right idea. $\endgroup$ – Marko Riedel Jun 1 '16 at 22:33

Another possible approach to this problem is to use Burnside's lemma. We have $n$ slots with the symmetric group $S_n$ acting on them and color them with one of $k$ colors where each color must appear at least once. This means a term from the cycle index $Z(S_n)$ that represents the product of $q$ cycles fixes

$${q\brace k} \times k!$$

assignments. Now the number of permutations with $q$ cycles is given by

$$\left[n\atop q\right].$$

It follows that the desired count has the closed form

$$\frac{1}{n!} \sum_{q=1}^n \left[n\atop q\right] {q\brace k} \times k!.$$

Observe that

$${q\brace k} = q! [z^q] \frac{(\exp(z)-1)^k}{k!}$$

which yields for the sum

$$\frac{1}{n!} \sum_{q=1}^n \left[n\atop q\right] q! [z^q] (\exp(z)-1)^k.$$

Observe furthermore that

$$\left[n\atop q\right] = n! [w^n] \frac{1}{q!} \left(\log\frac{1}{1-w}\right)^q$$

so we obtain

$$[w^n] \sum_{q=1}^n \left(\log\frac{1}{1-w}\right)^q [z^q] (\exp(z)-1)^k.$$

Now the power of the logarithm starts at $w^q$ so we may extend $q$ to infinity since the values beyond $n$ do not contribute to $[w^n]$, getting

$$[w^n] \sum_{q\ge 1} \left(\log\frac{1}{1-w}\right)^q [z^q] (\exp(z)-1)^k = [w^n] \left(\exp\log\frac{1}{1-w}-1\right)^k \\ = [w^n] \left(\frac{1}{1-w}-1\right)^k = [w^n] \frac{w^k}{(1-w)^k} \\ = [w^{n-k}] \frac{1}{(1-w)^k} = {n-k+k-1\choose k-1} = {n-1\choose k-1}.$$

This is of course the same as what we had in the companion answer, where the designs are $k$ boxes and we place a single indistinguishable cat in each box and distribute the remaining $n-k$ cats into the $k$ boxes according to stars and bars, getting with $n-k$ stars and $k-1$ bars

$${n-k+k-1\choose k-1} = {n-1\choose k-1}$$

the same as before.

This method (Burnside) also appeared at this MSE link I. The first step of the central simplification was an annihilated coefficient extractor. There are several more examples of this technique (ACE) at this MSE link II and at this MSE link III and also here at this MSE link IV.

  • $\begingroup$ This site would be so much poorer without your answers :-) $\endgroup$ – joriki Jun 2 '16 at 21:49
  • 1
    $\begingroup$ The same holds for your work. Thank you very much for the kind remark. $\endgroup$ – Marko Riedel Jun 2 '16 at 22:11

Firstly, the problem with your calculation is that you're assuming that every different permutation of cats will have been counted separately in the original count, but this is only true if all the designs are different. For example, a case where all the cats were given the same design would only have been counted once to start with.

Here's another approach. As the cats are indistinguishable, you might as well arrange them in a line with all the design 1s at one end, followed by the design 2s etc, where the designs are ordered in some predetermined sequence. The allocation is defined simply by the places in the line where the design transitions from one design to the next. There need to be $k-1$ such changes of design and there are $n-1$ places where it can happen.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.