Given $16$ pens to be distributed between $4$ people assuming the fourth person gets at least $3$ pens and the three other ones should not get more than $5$ pencils,in how many ways it's possible?
We are looking for the integral solutions to the equation $b_1+b_2+b_3+b_3+b_4=16$ such that $b_4 \ge 3$ and $b_1,b_2,b_3 \le 5$,this is given by :
$$[x^{16}]\left[\sum_{3 \le k \le 16}^{}x^k \right]\left[\sum_{0 \le k \le 13}^{}x^k \right]^3$$ $$=[x^{13}]\left[\sum_{0 \le k \le 13}^{}x^k \right]\left[\sum_{0 \le k \le 13}^{}x^k \right]^3$$ $$=[x^{13}](1-x^{14})^4(1-x)^{-4}$$ $$=[x^{13}]\sum_{k=0}^{4}\binom{4}{k}(-1)^kx^{14k}\sum_{k \ge 0}^{}\binom{k+3}{k}x^{k}$$ $$=\binom{16}{13}$$
However the answer is not this,so where was I wrong?
$b_1 + b_2 + b_3 + b_4=16$
As $b_4 \geq 3$, the number of ways to distribute $16$ pens will be equivalent to
$b_1 + b_2 + b_3 + b_4 = 13 \,$ without a restriction on $b_4$. The number of ways -
$\displaystyle = {16 \choose 3}$
Now $b_1, b_2, b_3 \leq 5$ so we should exclude number of ways in which one of them is $\geq 6$ which will be given by -
$b_1 + b_2 + b_3 + b_4 = 7$
Number of ways $\displaystyle = {3 \choose 1} {10 \choose 3} \,$ as there are ${3 \choose 1}$ ways to choose a number from $b_1, b_2, b_3$ that can be $\geq 6$.
But this will overcount cases where $2$ numbers are $6$ or greater. So we need to add those back.
$b_1 + b_2 + b_3 + b_4 = 1$ (two numbers are $6$ or more).
Number of ways $\displaystyle = {3 \choose 2} {4 \choose 3} \,$ as there are ${3 \choose 2}$ ways to choose two numbers from $b_1, b_2, b_3$ that can be $\geq 6$.
Now $3$ numbers cannot be all $\geq 6$ at the same time.
So applying P.I.E, our final answer is
${16 \choose 3} - {3 \choose 1} {10 \choose 3} + {3 \choose 2} {4 \choose 3} = 212$