# How many ways are there to divide into unordered piles…?

How many ways are there to divide ﬁve pears, ﬁve apples, ﬁve doughnuts, ﬁve lollipops, ﬁve chocolate cats, and ﬁve candy rocks into two (unordered) piles of ﬁfteen objects each?

-

Let $x_1,x_2,x_3,x_4$, and $x_5$ be the numbers of each type of item in one pile; the requirements are that $x_1+x_2+x_3+x_4+x_5=15$, where $x_1,x_2,x_3,x_4$, and $x_5$ are non-negative integers less than or equal to $5$. By a standard stars-and-bars calculation there are

$$\binom{15+5-1}{5-1}=\binom{19}4\tag{1}$$

solutions in unrestricted non-negative integers. Now use an inclusion-exclusion calculation to account for the upper bound of $5$ on each of the variables. The number of solutions in which a fixed $x_k$ exceeds $5$ is the number of solutions in non-negative integers of $y_1+y_2+y_3+y_4+y_5=9$, which is $$\binom{9+5-1}{5-1}=\binom{13}4\;,$$ and there are $5$ variables, so as a first correction we reduce $(1)$ to

$$\binom{19}4-5\binom{13}4\;.\tag{2}$$

However, it’s possible for two variables to exceed their upper bounds simultaneously, and in $(2)$ we’ve subtracted each of those ‘bad’ solutions twice, so we need to add them back in. The number of solutions in which a fixed pair of variables exceed $5$ is the number of solutions in non-negative integers to $y_1+y_2+y_3+y_4+y_5=3$, which is $$\binom{3+5-1}{5-1}=\binom74\;,$$ and there are $\binom52$ pairs of variables, so the final count is

$$\binom{19}4-5\binom{13}4+\binom52\binom74=3876-5\cdot715+10\cdot35=651\;.$$

(No further correction terms are required, since it’s not possible for more than two of the variables to exceed the limit of $5$ simultaneously.)

-

Presumably the intended solution is to write down the generating function \begin{multline*} (1+p+p^2+p^3+p^4+p^5)(1+a+a^2+a^3+a^4+a^5) \\ {}\times (1+d+d^2+d^3+d^4+d^5)(1+l+l^2+l^3+l^4+l^5) \\ {}\times (1+c+c^2+c^3+c^4+c^5)(1+r+r^2+r^3+r^4+r^5) \end{multline*} and count the monomials of total degree $15$, which can be done by setting all the variables equal to $o$ say (for object) and finding the coefficient of $o^{15}$ in the resulting polynomial.

-