Principle of inclusion and exclusion How many integer solutions can we have for the equation $x_1 + x_2 + x_3 = 18$, if $0 \leq x_1 \leq 6$, $4 \leq x_2 \leq 9$ and $7 \leq x_3 \leq 14$?
Using the Principle of inclusion and Exclusion: I have found 
$S_0$ =  $\binom{9}{7} $ 
However, I am stuck as to how to go about calculating $S_1$, $S_2$ and $S_3$. I believe that there is no solution for $S_2$ and $S_3$. 

This is the stars and bars problem. You can set up an equivalent question. Subtract out $4$ from both sides so that $0 \leq x_{2} \leq 5$. Similarly, subtract out $7$ so $0 \leq x_{3} \leq 7$. This leaves us with $x_{1} + x_{2} + x_{3} = 7$.
We can use a generating function to give us our inclusion-exclusion formula. Note that for $x_{1}$, we have the generating function: $f(x) = 1 + x + x^{2} + ... + x^{6} = \frac{1 - x^{7}}{1 - x}$. 
Similarly, for $x_{2}, x_{3}$, we have the functions $g(x) = \sum_{i=0}^{5} x^{i} = \frac{1 - x^{6}}{1 - x}$ and $h(x) = \sum_{i=0}^{7} x^{i} = \frac{1 - x^{8}}{1 - x}$.
By rule of product, we multiply $f, g, h$ and are interested in the coefficient of $x^{7}$.
So our product is: 
$$k(x) = \frac{1 - x^{5} - x^{6} - x^{7} + x^{11} + x^{12} + x^{13} - x^{18}}{(1 - x)^{3}}$$
Now $\frac{1}{(1-x)^{3}} = \sum_{i=0}^{\infty} \binom{i + 3 - 1}{i} x^{i}$
And so we multiply the expansion of the denominator by the numerator, keeping only the terms where we have $x^{7}$:
$$\binom{7 + 3 - 1}{7} - \binom{2 + 3 - 1}{2} - \binom{1 + 3 - 1}{1} - 1$$
And this gives you your inclusion-exclusion formula very methodically. 
