How many compositions of $n$ into distinct $k$ parts are there

combinatoricsnumber theory

Let $n, k$ be a non-negative integers with $k\leq n$. A $k$-composition or a composition of $n$ into $k$ parts is a $k$-tuple $(x_1, …, x_k)$ such that $x_1+x_2+…+x_k = n$. I know that the number of $k$-compositions of $n$ is given by $n-1 \choose k-1$ but I'm struggling with the adding condition that the parts (the $x_i$) must be distinct. That is I want to count the number of $k$-compositions $(x_1, …, x_k)$ of $n$ where $x_i \neq x_j$ for all $i\neq j$.

I'm also curious about this question where $(x_1, …, x_k)\in \mathbb{F}_p$ where $p$ is a prime and $n<p$? I feel like there should be a simple solution or bijection for both of these problems but I'm having trouble with coming up with one.

Best Answer

The first question was answered in the comments.

In the finite field $\mathbb{F}_p$ with $p$ prime, if $k > p$ then there are no choices of $k$ distinct elements. If $k = p$, then there is a unique choice, so up to reordering there is a unique solution if $n \equiv p(p-1)/2$ and none otherwise. So given $n < p$ and considering all orderings, there are $p!$ solutions if $p$ odd and $n = 0$, $2$ solutions if $p = 2$ and $n = 1$ and $0$ solutions otherwise.

If $k < p$, then the number of solutions is the same for every $n$, since adding $k^{-1}$ to every $x_i$ adds $1$ to $n$ and is a bijection on the set of solutions. As $n$ varies from over $0, \dotsc, p-1$, there are a total of $\binom{p}{k} k!$ solutions, so the number of solutions for a fixed $n < p$ is $\frac1p \binom{p}{k} k! = \frac{(p-1)!}{(p-k)!}$.

Related Question