How to find the number of combinations of $x,y,z$ that satisfy an equation The equation is $x + y + z = 18$,
with the constraints:
$2 \leq x \leq 8$
$1 \leq y \leq 7$
$1 \leq z \leq 6 $
First I solved it so the lower bounds where zero, by substituting the following:
$x' = x - 2$, $y' = y - 1$, $z'= z - 1$.
Which gave me the combination of $16,2 = 120$, now I have to subtract the number of combination of $x,y,z$ that are over, so $x'\geq7$, $y'\geq7$, or $z'\geq6$. The problem is when I plug those into the equation I end up with a negative answer and do not know how to deal with the problem.
 A: Hint: Your answer will be equal to the coefficient of $x^{18}$ in $$(x^{2}+x^{3}+\cdots +x^{8})(x+x^{2}+\cdots +x^{7})(x+x^{2}+\cdots +x^{6})$$
Which is equal to the coefficient of $x^{14}$ in $$(1+x+\cdots +x^{6})(1+x+\cdots +x^{6})(1+x+x^{2}+\cdots x^{5})=(1-x^{7})^{2}(1-x^{6})(1-x)^{-3}$$
A: Since $x+y \leq 8+7 = 15$ we must have $z \geq 3$ while $x+y \geq 2+1 = 3$ tells us that $z \leq 15$
Do something similar to establish bounds for $x$ and $y$ and compare to the originally set bounds.
A: Brute force yields the following 10 combinations:
$$
(8,4,6),(7,5,6),(6,6,6),(5,7,6), \\
(8,5,5),(7,6,5),(6,7,5), \\
(8,6,4),(7,7,4),\\
(8,7,3) \\
$$
A: As you say, you need to count the solutions in non-negative integers to $x'+y'+z'=14$ that violate at least one of the constraints $x'\le 6$, $y'\le 6$, and $z'\le 5$. This is an inclusion-exclusion argument.
First count the solutions with $x'\ge 7$. That’s the number of solutions in non-negative integers to $x''+y'+z'=7$, where $x''=x'-7$. You know how to compute this: it’s $$\binom{7+3-1}{3-1}=\binom92=36\;.$$
Similarly, you find that there are $\dbinom92=36$ solutions with $y'\ge 7$ and $\dbinom{10}2=45$ with $z'\ge 5$. These all have to be subtracted from $120$, leaving $120-36-36-45=3$ valid solutions. 
However, some invalid solutions were removed twice, because they violated two constraints; these must be added back in once. 


*

*How many solutions to $x'+y'+z'=14$ have $x'\ge 7$ and $y'\ge 7$?  

*How many have $x'\ge 7$ and $z'\ge 6$?  

*How many have $y'\ge 7$ and $z'\ge 6$?


All of those must be added back in. If there were any solutions that violated all three constraints, they would now have been counted once in the $120$, subtracted $3$ times in the initial correction, and added back in $3$ times in the second correction, so they would be included in the total and would need to be subtracted. However, there are none, so no further correction is needed.
A: Hint: as $x' = x-2$, it follows that $x' \leq 6$ rather than $x' \leq 8$. Similar for $y'$ and $z'$.
