<s>[INST] Find the number of solutions of x+y+z=17? Find the number of solutions of $x+y+z=17$ where $2\le x\le 5, 3\le y \le 6, 4\le z\le7$.
My approach:
The number of solutions with the indicated constraints is the coefficient of $x^{17}$ in the expansion of 
($x^2+x^3+x^4+x^5)(x^3+x^4+x^5+x^6)(x^4+x^5+x^6+x^7)$
I have changed the above polynomial to 
$x^9(1+x+x^2+x^3)^3$
Now $x^{17}=x^9*x^8$  
So I must now find the coefficient of $x^8$ in the expansion of ($1+x+x^2+x^3)^3$
$x_1+x_2+x_3=8$
This is equal to $C(3+8-1,8)=45$
However it takes into values of $x,y,z$ greater than $3$.
So I must subtract those combinations where either of $x_1,x_2,x_3$ is greater than $3$.
Let's suppose $x_1\ge 4$.Then 
$x_1+x_2+x_3=4$
Solutions=$15$.
Similarly for $x_2,x_3$ we get $15$ solutions each. 
Total=$45$.
Now we must consider the case when more than one of $x_1+x_2+x_3\ge 4$.
For this we have $3$ solutions.
Total solutions=$48$.
Now I must subtract these from original solutions of $45$. This gives answer $=-3$.
But the correct answer is $3$.
What is wrong in this approach?
 [/INST] I double counted some solutions. The 3 solutions which I added to 45 to get 48 must be subtracted from 45 to get 42. This is because these 3 solutions were counted twice.
</s>