Combinatorics – The Number of Integer Solutions of Equations

combinatorics

The Number Of Integer Solutions Of Equations

An approach is to find the number of distinct non-negative integer-valued vectors $(x_1,x_2,…,x_r)$ such that $$x_1 + x_2 + … + x_r = n$$

  • Firstly, considering the number of positive integer-valued solutions.

    An approach to solving this problem for positive integer-valued solutions is to imagine that you have $n$ indistinguishable objects lined up and that you want to divide them into $r$ nonempty groups. To do so, you can select $r-1$ of the $n-1$ spaces between adjacent objects as the dividing points. See the diagram below for a visual representation.

$$0_\wedge0_\wedge0_\wedge…_\wedge0_\wedge0$$

$$n\,\, objects\,\,0$$
$$Choose\,\,r-1\,\,of\,\,the\,\,spaces\,\,_\wedge.$$

For instance if you have $n=8$ and $r=3$ and you choose the 2 divisors so as to obtain $$000|000|00$$ then the resulting vector is $x_1 = 3. x_2 = 3, x_3 = 2.$ As there are $n-1\choose r-1$ possible selections, you have the following proposition.

  • Proposition 1: There are $n-1\choose r-1$ distinct positive integer-valued vectors $(x_1, x_2,…,x_r)$ satisfying the equation $$x_1 + x_2 + … + x_r = n, \,\,\, x_i > 0,\,\,\, i = 1,…,r$$

  • Finally, from Proposition 1 you can obtain the following proposition

  • Proposition 2: There are $n+r-1\choose r-1$ distinct non-negative integer-valued vectors $(x_1, x_2,…,x_r)$ satisfying the equation $$ x_1 + x_2 + … + x_r = n$$

  • Question: I understand all the steps taken prior to Proposition 2, so what I want to know is how is Proposition 2 derived from Proposition 1? I have drawn multiple diagrams using the spaces between objects analogy by adding $r$ extra possible positions for a divider, but none of them hold for all possible vectors.

Best Answer

For concreteness, let us work with the specific numbers $8$ and $3$ mentioned in the post, though the argument is general.

We have $8$ identical candies, and we want to distribute them among $3$ kids, with some kid(s) possibly getting no candy. Call this Task A.

Task B goes as follows. Distribute $8+3$ candies among the kids, with each kid getting at least $1$ candy. Then take away a candy from each kid.

It is clear that there are just as many ways to carry out Task B as there are to carry out Task A. And by the analysis of Proposition 1, there are $\binom{8+3-1}{3-1}$ ways to carry out Task B.

Another way: Imagine $8+3-1$ slots in a row, like this: $$\square\quad\square\quad\square\quad\square\quad\square\quad\square\quad\square\quad\square\quad\square\quad\square$$ We will put place $8$ candies ("stars") in these slots, with the other $2$ slots serving as separators ("bars"), possibly adjacent. The number of ways of placing the candies is $\binom{8+3-1}{8}$. It is the same as the number of ways of choosing the $2$ slots to be left blank.

So the number of solutions is $\binom{10}{8}$, or equivalently $\binom{10}{2}$.

In general, the same analysis shows that the number of ways to distribute $n$ candies among $r$ kids is $\binom{n+r-1}{n}$, or equivalently $\binom{n+r-1}{r-1}$.

Related Question