I have to find the number of solutions for: $$x_1 + x_2 + x_3 + x_4 = 42$$ when given: $$ (I) 12 <= x_1 <=13 $$ $$ (II) 3 <= x_2 <= 6 $$ $$ (III) 11 <= x_3 <= 18 $$ $$ (IV) 6 <= x_4 <= 10 $$
What I did so far, is define: $$ y_1 = x_1 - 12 $$ $$ y_2 = x_2 - 3 $$ $$ y_3 = x_3 - 11 $$ $$ y_4 = x_4 - 6 $$
Thus we get: $$ y_1 + y_2 + y_3 + y_4 = 10 $$ where $$ 0 <= y_1 <= 1 $$ $$ 0 <= y_2 <= 3 $$ $$ 0 <= y_3 <= 7 $$ $$ 0 <= y_4 <= 4 $$
now I defined: $\text{S = all solutions to}$ $y_1 + y_2 + y_3 + y_4 = 20$ $\text{where all}$ $y_i >=0$ $\text{without the upper limitation}$
and I know I have to subtract the rest of the cases, when $y_1 is >1$ and $y_2 is >3$ etc... but how do I count all those side cases that I should subtract?