Find the number of integer solutions to $x_1 + x_2 + x_3 + x_4 = 25$ with $ 1 \leq x_1 \leq 6, 2 \leq x_2 \leq 8, 0 \leq x_3 \leq 8, 5 \leq x_4 \leq 9.$
Firstly, I defined $y_i = x_i - lower bound$ so for example $y_1 = x_1 - 1$ This gives $y_1 + y_2 + y_3 + y_4 = 17$ with $$0 \leq y_1 \leq 5, 0 \leq y_2 \leq 6, 0 \leq y_3 \leq 8, 0 \leq y_4 \leq 4$$ Next I applied Inclusion-Exclusion Principle;
Total number of ways = $17+3 \choose 3$
Number of ways with just $y_i$ breaking upper bound;
$y_1;$$11+3 \choose 3$
$y_2;$ $10+3 \choose 3$
$y_3;$ $8+3 \choose 3$
$y_4;$ $12+3 \choose 3$
Similarly I calculated the number of ways with $y_i$ and $y_j$ breaking upper bound at the same time. And since there is no way in which 3 of them break their upper bounds simultaneously I was left with ;
$${20 \choose 3} - {14 \choose 3} - {13 \choose 3} - {11 \choose 3} - {15 \choose 3} + {7\choose 3} + {5 \choose 3} + { 9 \choose 3} + {4 \choose 3} + {8 \choose 3} + {6 \choose 3} $$
as my final answer.
Is this solution correct and is there a nicer way of solving it/ any insights about this type of problem?
Note, this problem is from 'An Introduction to Combinatorics and Graph Theory'