What's the number of solutions for $x_1 + x_2 + x_3 + ... + x_k = n$ where $x_i \neq x_j$, for all $i, j \in {1\dots k}$

158 Views Asked by At

I want to find the number of solutions for $$x_1 + x_2 + x_3 +\ldots + x_k = n$$ where:

  • $x_i$ is a positive integer $\forall i \in {1, \dots, k}$.
  • if $i \neq j$ then $x_i \neq x_j$, for all $i, j \in {1\dots k}$.
  • $n$ is a positive integer.

I've tried (unsuccessfully) to play around with generating functions and I'm out of ideas. Any help will be appreciated!

4

There are 4 best solutions below

2
On BEST ANSWER

Accroding to this paper, we consider $C(n, k)$, the number of compositions of $n$ with $k$ distinct parts.

we then have, $$ C(n, k)=C(n-k, k)+k C(n-k, k-1) $$ We deduce this by subtracting 1 from each part of the distinct compositions of $n$ into $k$ parts. Then those distinct compositions in which no part is 1 have a one to one correspondence with distinct compositions of $n-k$ into $k$ parts, whereas those distinct compositions with a part 1 correspond to a distinct composition of $n-k$ into $k-1$ parts with an additional zero part which can occur in any of $k$ positions.

ClearAll["Global`*"]

C1[n_, k_] := 0 /; n <= 0
C1[n_, 1] := 1
C1[n_, k_] := C1[n - k, k] + k*C1[n - k, k - 1]

Table[C1[n, k], {n, 1, 6}, {k, 1, 3}] // Grid

$$ \begin{array}{cccccccccccccccccccc} 1 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 2 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 2 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 4 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 4 & 6 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 6 & 6 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 6 & 12 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 8 & 18 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 8 & 24 & 24 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 10 & 30 & 24 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 10 & 42 & 48 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 12 & 48 & 72 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 12 & 60 & 120 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 14 & 72 & 144 & 120 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} & \text{} \\ 1 & 14 & 84 & 216 & 120 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} & \text{} \\ 1 & 16 & 96 & 264 & 240 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} & \text{} \\ 1 & 16 & 114 & 360 & 360 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} & \text{} \\ 1 & 18 & 126 & 432 & 600 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \text{} \\ 1 & 18 & 144 & 552 & 840 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \end{array} $$

1
On

Elaborating on my hint (If you're stuck, explain what you've tried):
How do you convert "distinct integers" to a different set of variables without that constraint?

First consider when $x_i$ are in increasing order.
Define $ a_1 = x_1, a_2 = x_2 - x_1, a_3 = x_3 - x_2, \ldots $.
Show that these $a_i$ are positive integers.
Show that $ x_1 = a_1, x_2 = a_1 +a_2, x_3 = a_1+a_2+a_3, \ldots $.
Show that the condition is $ ka_1+(k-1)a_2+(k-2)a_3+\ldots + 1a_k = n$, with the only constraint being that the variables are positive integers.

Can you create the corresponding generating function for this scenario?

$$ \frac{ x^{k(k+1)/2} } { ( 1-x)(1-x^2)\ldots ( 1-x^{k}) } $$

Finally, remember to multiply by $k!$ due to the "$x_i$ are in increasing order".

14
On

This is a long winded comment.
This is not an answer.

First of all, the OP (i.e. original poster) has indicated at least some involvement with generating functions, which I am totally ignorant of. In my experience and observation of others on MathSE, this type of problem is best attacked by either generating functions or Stars and Bars.

For Stars and Bars theory, see this article and this article. As I discuss below, I think that Stars and Bars is not the right approach, for this type of problem.

So, I think that the OP should show work, in accordance with this article on MathSE protocol before someone provides them with an answer.


$\underline{\text{Stars and Bars discussion}}$

The $k$ variables, which must be distinct can be permuted in $~k!~$ ways. So, you can reserve the factor $~(k!),~$ and then assume that

$$x_1 < x_2 < \cdots < x_k.$$

For $~i \in \{2,3,\cdots,k\},~$
let $~y_i = x_i - x_{i-1} \implies y_i \geq 1.$

This implies that for $~j \in \{2,3,\cdots,k\},~$ that $~x_j = x_1 + y_2 + y_3 + \cdots + y_j.~$

So, the problem has now been converted into counting the number of solutions to

  • $k(x_1) + (k-1)y_2 + (k-2)y_3 + \cdots + y_k = n ~: ~n \in \Bbb{Z^+}.$

  • $x_1, y_2, y_3, \cdots, y_k \in \Bbb{Z^+}.$

At this point, the natural move is to use the further change of variables:

$$u_1 = x_1 - 1, ~~u_i = y_i - 1 ~: ~i \in \{2,3,\cdots,k\}.$$

This transforms the problem into

  • $\displaystyle k(u_1) + (k-1)u_2 + (k-2)u_3 + \cdots + u_k = n - \left[ ~\frac{(k+1)k}{2} ~\right].$

  • $u_1, u_2, u_3, \cdots, u_k \in \Bbb{Z_{\geq 0}}.$

My reaction at this point is $\color{red}{\text{so what}}$.
Unless I am missing something, even this alteration of the problem still doesn't seem to lend itself to Stars and Bars.

1
On

A slight variation on stars and bars.

Let $1+1+1+...+1=n$, where there are $n$ ones.

Pick a plus sign. Add up all the ones to the left of the plus sign, and all the ones to the right, now you have an expression of the form $x+y=n$. There are as many ways to add two positive numbers to get $n$ as there are ways to pick 1 plus sign out of the $(n-1)$ total plus signs.

If you pick 2 plus signs instead, then add all ones to the left of the left most plus signs, the ones to the right of the right most plus sign, then the remaining 1's to get an expression of the form $x+y+z=n$.

This can be generalized. There are $\binom{n-1}{k-1}$ ways to add up $k$ numbers to sum to $n$.

This doesn't eliminate cases where addends are the same and it doesn't account for commutativity of addition.

You can account for commutativity by dividing by $k!$ if the addends are all different.

How do you guarantee they are different?