Inclusion-Exclusion How many integer solutions are there to the equation $x_1 + x_2 + x_3 + x_4 = 32$ with $0 \leq x_i \leq 10$ for $i = 1, 2, 3, 4$?
How many integer solutions are there to the inequality
$$
y_1 + y_2 + y_3 + y_4 < 184
$$
with $y_1 > 0$, $0 < y_2 \leq 10$, $0 \leq y_3 \leq 17$, and $0 \leq y_4 < 19$?
Here are two problems. I can see this combination $(32+4-1,4-1)$ but I am having trouble finding out what to subtract from that.
Also, the second problem is looking for a more complicated solution. I understand that $y_1+y_2+y_3+y_4+y_5 = 182$ and $(182,4)$ for the combination but what do it have to subtract from that?
Thank you.
 A: For the first part, I suggest using a change of variables $a_i = 10 - x_i $. Then, we still have $ 0 \leq a_i \leq 10 $ but the condition now becomes
$$a_1 + a_2 + a_3 + a_4 = 8 $$
Hence, the condition that $a_i \leq 10$ is actually not necessary! Thus, by stars and bars, the number of solutions is $ { 8 + 4 - 1  \choose 4-1 } = 165.$
This agrees with Brian's solution, after you evaluate the binomial coefficients. (Phew!) Of course, this trick only works because the numbers are small (large), and in general, you have to use PIE as Brian did.
A: Use generating functions. Let $f(x)=1+x+...+x^{10}$ then find the coefficient of $x^{32}$ in $(f(x))^4$. 
A: Generating functions seem to give a cleaner looking solution for the second question.
The generating function for number of ways to sum to $k$ is
$$
\overbrace{\ \ \frac{x\vphantom{x^1}}{1-x}\ \ }^{y_1\gt0}\overbrace{\frac{x-x^{11}}{1-x}}^{0\lt y_2\le10}\overbrace{\frac{1-x^{18}}{1-x}}^{0\le y_3\le17}\overbrace{\frac{1-x^{19}}{1-x}}^{0\le y_4\lt19}
$$
which is
$$
\begin{align}
&\frac{x^2}{(1-x)^4}\left(1-x^{10}-x^{18}-x^{19}+x^{28}+x^{29}+x^{37}-x^{47}\right)\\
&=\left(x^2-x^{12}-x^{20}-x^{21}+x^{30}+x^{31}+x^{39}-x^{49}\right)\sum_{k=0}^\infty\binom{k+3}{k}x^k\\
&=\sum_{k=0}^\infty\left[{\scriptsize\binom{k+1}{k-2}-\binom{k-9}{k-12}-\binom{k-17}{k-20}-\binom{k-18}{k-21}+\binom{k-27}{k-30}+\binom{k-28}{k-31}+\binom{k-36}{k-39}-\binom{k-46}{k-49}}\right]x^k
\end{align}
$$
and the sum of the coefficients for $k\lt184$ is
$$
\begin{align}
&\sum_{k=0}^{183}\left[{\scriptsize\binom{k+1}{k-2}-\binom{k-9}{k-12}-\binom{k-17}{k-20}-\binom{k-18}{k-21}+\binom{k-27}{k-30}+\binom{k-28}{k-31}+\binom{k-36}{k-39}-\binom{k-46}{k-49}}\right]\\
&=\scriptsize\binom{185}{4}-\binom{175}{4}-\binom{167}{4}-\binom{166}{4}+\binom{157}{4}+\binom{156}{4}+\binom{148}{4}-\binom{138}{4}\\[6pt]
&=547200
\end{align}
$$
