2

The number of weak compositions of $n$ with $k$ parts is given by: $$ \binom{n+k -1}{k-1}. $$ Consider the following identification: two compositions $(s_1 + \cdots + s_k), (t_1 + \cdots + t_k)$ are the same if $t_i = s_{k-i}$ for $i = 1,\ldots,k$. In other words, we consider them equivalent if they are reflections of each other.

Under this identification, how many weak compositions of $n$ with $k$ parts are there?

Equivalently, how many palindromic weak compositions are there (i.e. weak compositions that read the same forward and backward)?

Zvi Rosen
  • 293
  • 1
    It will likely depend on whether $n,k$ are even or odd. If $k,n$ are even, then the number of palindromic weak compositions is the same as the number of weak compositions of $n/2$ with $k/2$. If $k$ is even and $n$ odd, the number of palindromics will be zero. For $k$ odd, it gets more complicated - you have to loop over all possible values for the middle entry - all $i$ such that $n-i$ is even. – Thomas Andrews Sep 23 '13 at 19:09
  • That is what I found as well. I do have an answer, but I'm curious how other people would derive it. – Zvi Rosen Sep 23 '13 at 19:14

1 Answers1

1

This is a simple application of Polya Counting. Let us recall for a moment that the generating function of weak compositions of $n$ into $k$ parts is $$Z(E_k)\left(\frac{1}{1-z}\right)$$ where $$Z(E_k) = a_1^k$$ is the cycle index of the identity group so that we get the OGF $$\left(\frac{1}{1-z}\right)^k.$$ Now when we do coefficient extraction using the Newton binomial we obtain the count $$[z^n] \left(\frac{1}{1-z}\right)^k = {n+ k-1\choose n},$$ as observed in the introduction.

Now to answer the question we need the cycle index of the group $F_k$ containing the identity and a single flip of the row of slots into which we distribute the elements of the composition. We have that when $k$ is even, $$Z(F_k) = \frac{1}{2} a_1^k + \frac{1}{2} a_2^{k/2}$$ and when $k$ is odd, $$Z(F_k) = \frac{1}{2} a_1^k + \frac{1}{2} a_1 a_2^{(k-1)/2}.$$ Therefore the count $q_n$ when $k$ is even is given by $$[z^n]Z(F_k)\left(\frac{1}{1-z}\right) = \frac{1}{2} [z^n] \left(\frac{1}{1-z}\right)^k + \frac{1}{2} [z^n] \left(\frac{1}{1-z^2}\right)^{k/2}.$$ This gives $$q_n = \frac{1}{2} {n+k-1\choose n} + \frac{1}{2}\begin{cases} 0 & \text{if} \quad n \quad \text{is odd,}\\ {n/2 + k/2-1\choose n/2} & \text{if} \quad n \quad \text{is even.} \end{cases}.$$ The count $q_n$ for odd $k$ is given by $$[z^n]Z(F_k) \left(\frac{1}{1-z}\right) = \frac{1}{2} [z^n] \left(\frac{1}{1-z}\right)^k + \frac{1}{2} [z^n] \frac{1}{1-z}\left(\frac{1}{1-z^2}\right)^{(k-1)/2}.$$ The second term in the sum simplifies to $$(1+z)\left(\frac{1}{1-z^2}\right)^{(k-1)/2+1}.$$ This gives $$q_n = \frac{1}{2} {n+k-1\choose n} + \frac{1}{2}\begin{cases} {(n-1)/2 + (k-1)/2\choose (n-1)/2} & \text{if} \quad n \quad \text{is odd,}\\ {n/2 + (k-1)/2\choose n/2} & \text{if} \quad n \quad \text{is even.} \end{cases}.$$

Here is a MSE Link to a chain of Polya Counting applications.

Marko Riedel
  • 61,317