Counting ways to distribute 7 apples and 5 pears between 4 children with restriction

Solution 1:

I'll do the apples rather than the pears to illustrate the simplification I have in mind. There are $\binom {10}{3}=120$ ways to distribute $7$ apples among $4$ kids without restriction. If no kid can have $4$ or more apples, then after assigning $4$ of the apples to one of the kids, there are $\binom 63=20$ ways to distribute the remaining $3$ apples among the $4$ kids, so there are $4 \cdot 20=80$ disallowed combinations, meaning $40$ allowed combinations.

Solution 2:

One way is by considering partitions. It is sufficient to just distribute $5$ pears among the kids; the apples are complementary.

Then consider the partitions of $5$ into atmost four parts such that no part is larger than $3$. These can be listed easily

  • $(3,2,0,0)$
  • $(3,1,1,0)$
  • $(2,2,1,0)$
  • $(1,1,1,2)$

First item means one kid gets $3$ pears, second gets $2$ and other two get none. Others are similar.

Since the kids are distinct, total contribution is (in order) $$\binom{4}{1}\binom{3}{1}+ \binom{4}{1}\binom{3}{2} + \binom{4}{1}\binom{3}{2} + \binom{4}{1}=40$$

EDIT :

A shortcut is to realize the list has three partitions of type $aabc$ and one of type $aaab$. Hence $3\cdot \frac{4!}{2!}+4=40$

Solution 3:

Using more powerful technique, for much more tough questions :

Lets use generating functions, lets assume that $x's$ mean apples and $y's$ mean pears, then a child can have at most $3$ apples or pears. Hence the generating function of each child is $$(x^3+ x^2y +xy^2 +y^3) = \frac{x^4 -y^4}{x-y}$$

Now , we need to find the coefficient of $x^7y^5$ in the expansion of $$(x^3+ x^2y +xy^2 +y^3)^4=\left( \frac{x^4 -y^4}{x-y} \right)^4$$

The answer is $40$.