Integer solutions question simple Suppose I have:
$$x_1 + x_2 + x_3 + x_4 = 12$$
and I want to find all solutions $x_i \geq 1$
Well firstly I can give 1 to each x, so that leaves me with:
$$x_1 + x_2 + x_3 + x_4 = 8$$
Then, I can just make 3 dividers, like such:
$$x_1 | x_2 | x_3 | x_4$$
and so my answer is $$\binom{8+3}{3} = \binom{11}{3}$$
My sheet says:
$\textit{Theorem}$: The number of ways to distribute $r$ identical objects into $n$ distinct boxes with at least $one$ object in each box is:
$$\binom{r-1}{n-1}$$
As you can see, this formula works, cause $\binom{12-1}{4-1} = \binom{11}{3}$
But I'm not sure where they got this formula, and why it works?
 A: That formula can be viewed as the glueing of your 2-step thinking.
You had $r $ objects for $n $ boxes with no empty box. You then subtracted $n $ from $r $, saying you now want to distribute $r-n$ balls over $n $ boxes without caring about having empty boxes. Using the "dividers" train of thought you see there are
$${(r-n) + (n-1)\choose{n-1}} $$ ways of doing it. But that is just the same as
$${r-1\choose{n-1}} $$
which is the theorem's formula.
A: When you specify non-negative integers, the dividers can be before the first ball, after the last ball, or have multiple dividers between balls, as shown below.
$\bullet \bullet\bullet \bullet |\bullet\bullet|\bullet \bullet\bullet\bullet  \bullet\bullet |\quad$ [ $0$ in $x_4$ ]
$| \bullet \bullet\bullet\bullet | \bullet\bullet\bullet \bullet\bullet |\bullet \bullet\bullet\quad$ [ $0$ in $x_1$ ]
$\bullet \bullet\bullet\bullet | | \bullet\bullet\bullet |\bullet\bullet\bullet \bullet\bullet\quad$ [ $0$ in $x_2$ ]
On the other hand, when you specify positive integers, the dividers must be within the boundaries of the balls, and with at most one divider between two balls, e.g.
$\bullet | \bullet\bullet\bullet |  \bullet\bullet\bullet |\bullet\bullet\bullet \bullet\bullet\quad$
Thus there are just $(n-1)$ spaces in which to place the $(k-1)$ dividers singly.
