How many ways are there to distribute seven distinct apples and six distinct pears to three distinct people such that each person has at least one pear.
Note: The first part of the problem was the same but the word distinct was replaced with identical apples and pears. That answer is $360$ ways.
What has to be done differently when the word identical is replaced with distinct?
Let $a_i$, $1 \leq i \leq 3$, be the number of apples given to the $i$th person. Since there are no restrictions on the number of apples given to each person, $$a_1 + a_2 + a_3 = 7 \tag{1}$$ is an equation in the nonnegative integers. A particular solution of equation 1 in the nonnegative integers corresponds to the placement of two addition signs in a row of seven ones. For instance, $$1 + 1 1 + 1 1 1 1$$ corresponds to the solution $a_1 = 1$, $a_2 = 2$, $a_3 = 4$, while $$1 1 1 1 + 1 1 1 +$$ corresponds to the solution $a_1 = 4$, $a_2 = 3$, $a_3 = 0$. The number of solutions of equation 1 in the nonnegative integers is $$\binom{7 + 2}{2} = \binom{9}{2}$$ since we must select which two of the nine positions required for seven ones and two addition signs will be filled with addition signs.
Since a particular solution of the equation $$x_1 + x_2 + x_3 + \cdots + x_n = k \tag{2}$$ in the nonnegative integers corresponds to the placement of $n - 1$ addition signs in a row of $k$ ones, equation 2 has $$\binom{k + n - 1}{n - 1}$$ solutions in the nonnegative integers since we must select which $n - 1$ of the $k + n - 1$ positions required for $k$ ones and $n - 1$ addition signs will be filled with addition signs.
Let $p_i, 1 \leq i \leq 3$, be the number of pears given to the $i$th person. Since each person must receive at least one pear, $$p_1 + p_2 + p_3 = 6 \tag{3}$$ is an equation in the positive integers. A particular solution of equation 3 corresponds to the placement of two addition signs in the five spaces between successive ones in a row of six ones. $$1 \square 1 \square 1 \square 1 \square 1 \square 1$$ For instance, placing addition signs in the second and fifth spaces yields $$1 1 + 1 1 1 + 1$$ which corresponds to the solution $p_1 = 2$, $p_2 = 3$, $p_3 = 1$. The number of solutions of equation 3 in the nonnegative integers is $$\binom{5}{2}$$ since we must select two of the five spaces between successive ones in a row of six ones in which to place an addition sign.
Since a particular solution of the equation $$x_1 + x_2 + x_3 + \cdots + x_n = k \tag{4}$$ in the positive integers corresponds to the placement of $n - 1$ addition signs in the $k - 1$ spaces between successive ones in a row of $k$ ones, equation 4 has $$\binom{k - 1}{n - 1}$$ solutions in the positive integers.
Hence, the number of ways seven identical apples and six identical pears can be distributed to three distinct people such that each person receives at least one pear is $$\binom{9}{2}\binom{5}{2} = 360$$
Since there are no restrictions on the number of apples each person receives, they may be distributed in $3^7$ ways since there are three choices of recipient for each of the seven apples.
Since each person receives at least one pear, we must subtract the number of ways of distributing the pears in which fewer than three people receive a pear from the $3^6$ ways the pears could be distributed.
There are $\binom{3}{1}$ ways to exclude one person as a recipient and $2^6$ ways to distribute the six pears to the remaining two people.
However, if we subtract the number of ways of excluding one of the people from being a recipient of a pear, we will have subtracted too much since we will have subtracted those distributions in which two people do not receive a pear twice, once for each way of designating one of them as the person who does not receive a pear. Thus, we must add those cases back.
There are $\binom{3}{2}$ ways of excluding two of the people from being recipients of a pear and $1^6$ ways to give all six of the pears to the same person.
Hence, by the Inclusion-Exclusion Principle, the number of ways of distributing the seven distinct pears so that each person receives at least one is $$3^6 - \binom{3}{1}2^6 + \binom{3}{2}1^6$$ so the number of ways of distributing seven distinct apples and six distinct pears to three people such that each person receives at least one pear is $$3^7\left[3^6 - \binom{3}{1}2^6 + \binom{3}{2}1^6\right]$$