The Number Of Integer Solutions Of Equations

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}$.


$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ With $\ds{ 0 < a < 1}$: \begin{align} &\color{#66f}{\large\sum_{x_{1} = 0}^{n}\ldots\sum_{x_{r} = 0}^{n}\delta_{x_{1} + \cdots + x_{r},n}} =\sum_{x_{1} = 0}^{\infty}\ldots\sum_{x_{r} = 0}^{\infty} \delta_{x_{1} + \cdots + x_{r},n} \\[3mm]&=\sum_{x_{1} = 0}^{\infty}\ldots\sum_{x_{r} = 0}^{\infty} \oint_{\verts{z}\ =\ a}{1 \over z^{-x_{1}\ -\ \cdots\ -\ x_{r}\ +\ n\ +\ 1}} \,{\dd z \over 2\pi\ic} \\[3mm]&=\oint_{\verts{z}\ =\ a}{1 \over z^{n + 1}} \pars{\sum_{x = 0}^{\infty}z^{x}}^{r}\,{\dd z \over 2\pi\ic} =\oint_{\verts{z}\ =\ a}{1 \over z^{n + 1}}\pars{1 \over 1 - z}^{r} \,{\dd z \over 2\pi\ic} \\[3mm]&=\oint_{\verts{z}\ =\ a}{1 \over z^{n + 1}} \sum_{k = 0}^{\infty}{-r \choose k}\pars{-1}^{k}z^{k}\,{\dd z \over 2\pi\ic} =\sum_{k = 0}^{\infty}{r + k - 1 \choose k} \oint_{\verts{z}\ =\ a}{1 \over z^{n - k + 1}}\,{\dd z \over 2\pi\ic} \\[3mm]&=\sum_{k = 0}^{\infty}{r + k - 1 \choose k}\delta_{kn} =\color{#66f}{\large{r + n - 1 \choose n}} \end{align}