In how many ways can we put balls in drawers with the following conditions Say we have 5 drawers and 17 identical balls. In how many ways can we put the balls in the drawers that the upper drawer will have exactly 3 balls. The middle will have at least 4 balls and the lowest will have at most 5?
I tried to do it by the complementery way, I calculated all of the options and removed the bad options(when there are more than 5 balls in the lowest drawer) ${10+4-1\choose 4-1}(all) - {4+4-1\choose 4-1}(6 balls) - {3+4-1\choose 4-1}(7 balls) - {2+4-1\choose 4-1}(8 balls) - {1+4-1\choose 4-1}(9 balls) -1(10 balls) = 216$
Can someone confirm or fix me?
Thanks in advance!
 A: Let's start by placing three balls in the top drawer and four balls in the middle drawer.  Since we can place no more balls in the top drawer, this leaves us with ten balls to distribute to the bottom four drawers, subject to the restriction that the number of balls placed in the lowest drawer is at most $5$.  Therefore, if we let $x_k$ denote the number of balls placed in the $k$th drawer from the bottom, then we obtain the equation
$$x_1 + x_2 + x_3 + x_4 = 10 \tag{1}$$
subject to the restriction that $x_1 \leq 5$.  Equation 1 is an equation in the nonnegative integers.  A particular solution corresponds to the placement of three addition signs in a row of ten ones.  For instance, 
$$1 1 1 + 1 1 + + 1 1 1 1 1$$
corresponds to the solution $x_1 = 3$, $x_2 = 2$, $x_3 = 0$, and $x_4 = 5$, while 
$$1 1 1 1 + 1 1 + 1 1 1 + 1$$
corresponds to the solution $x_1 = 4$, $x_2 = 2$, $x_3 = 3$, and $x_4 = 1$.  Therefore, the number of solutions of equation 1 in the nonnegative integers is the number of ways we can insert three addition signs in a row of ten ones, which is 
$$\binom{10 + 3}{3} = \binom{13}{3}$$
since we must choose which three of the thirteen positions (ten ones and three addition signs) will be filled with addition signs.
However, we have counted distributions in which more than five balls are placed in the bottom drawer.  We must subtract these from the total.  If more than five balls are placed in the bottom drawer, then $y_1 = x_1 - 6$ is a nonnegative integer.  Substituting $y_1 + 6$ for $x_1$ in equation 1 yields
\begin{align*}
y_1 + 6 + x_2 + x_3 + x_4 & = 10\\
y_1 + x_2 + x_3 + x_4 & = 4 \tag{2}
\end{align*}
Equation 2 is an equation in the nonnegative integers with 
$$\binom{4 + 3}{3} = \binom{7}{3}$$
solutions since we must choose which three of the seven positions (four ones and three addition signs) will be filled with addition signs.  
Hence, the number of ways we can distribute $17$ balls to five drawers if exactly three are placed in the top drawer, at least four are placed in the middle drawer, and at most five are placed in the bottom drawer is
$$\binom{13}{3} - \binom{7}{3}$$
In your attempt, you subtracted off the number of cases with at least six balls, at least seven balls, at least eight balls, at least nine balls, and all ten of the remaining balls placed in the bottom drawer.  However, you only needed to eliminate those cases with at least six balls placed in the bottom drawer.  
If you wanted to eliminate those cases with exactly six balls placed in the bottom drawer, you would need to count the number of solutions of the equation
$$x_2 + x_3 + x_4 = 4 \tag{3}$$
in the nonnegative integers.  To eliminate those cases with exactly seven balls in the bottom drawer, you would need to count the number of solutions of the equation 
$$x_2 + x_3 + x_4 = 3 \tag{4}$$
in the nonnegative integers.  To eliminate those cases with exactly eight balls in the bottom drawer, you would need to count the number of solutions of the equation
$$x_2 + x_3 + x_4 = 2 \tag{5}$$
in the nonnegative integers.  To eliminate those cases with exactly nine balls in the bottom drawer, you would need to count the number of solutions of the equation 
$$x_2 + x_3 + x_4 = 1 \tag{6}$$
in the nonnegative integers.  To eliminate the case with exactly ten balls in the bottom drawer, you would need to count the number of solutions of the equation 
$$x_2 + x_3 + x_4 = 0 \tag{7}$$
in the nonnegative integers.  Notice that adding the number of solutions of equations 3, 4, 5, 6, and 7 yields
$$\binom{6}{2} + \binom{5}{2} + \binom{4}{2} + \binom{3}{2} + \binom{2}{2} = \binom{7}{3}$$
