Number of integer solutions w/ given eq. recently in our discrete maths course we had this question. Any help is appreciated!
How many integer solutions does belove equation have?
$x_1+x_2+x_3+x_4+x_5+x_6=25$
with given constraints:
$-2\le x_1 \le 5$ 
$1\le x_2 \le 4$
$-2\le x_3 \le 6$
$3\le x_4 \le 7$
$2\le x_5 \le 8$
$3\le x_6 \le 7$
SOME PEOPLE CLAIM ITS DUPLICATE, WITH BRIEF OVERVIEW ONE CAN EASILY GET THAT IT AINT
 A: HINT: Let $y_1=x_1+2$, $y_2=x_2-1$, $y_3=x_3+2$, $y_4=x_4-3$, $y_5=x_5-2$, and $y_6=x_6-3$. Do you see why the answer to your question is the number of solutions to the equation
$$y_1+y_2+y_3+y_4+y_5+y_6=20\tag{1}$$
in non-negative integers $y_1\le 7$, $y_2\le 3$, $y_3\le 8$, $y_4\le 4$, $y_5\le 6$, and $y_6\le 4$?
One way to calculate this is to use an inclusion-exclusion argument. Start with the usual stars and bars calculation of the number solutions to $(1)$ in non-negative integers; this is
$$\binom{20+6-1}{6-1}=\binom{25}5\;.$$
Now subtract the number of solutions with $y_1\ge 8$; this is simply the number of solutions in non-negative integers to
$$z_1+y_2+y_3+y_4+y_5+y_6=20-8=12\;.$$
Similarly, subtract the numbers of solutions with $y_2\ge 4$, the number with $y_3\ge 9$, and so on.
Unfortunately, you’ve now subtracted too much: any solution with $y_1\ge 8$ and $y_2\ge 4$, for instance, has been subtracted twice and therefore should be added back in. Thus, you need to add back in the number of solutions in non-negative integers to
$$z_1+z_2+y_3+y_4+y_5+y_6=20-8-4=8\;.$$
And you need to do the same thing for each pair of variables.
But now any solution that exceeds the upper bound for three variables has been counted once in the original $\binom{25}5$; subtracted $3$ times, once for each variable; and added back in $\binom32=3$ times, once for each pair of variables. This means that it’s been counted a net of one time, which is wrong: it shouldn’t be counted at all. Thus, we need to subtract the numbers of solutions in non-negative integers to
$$z_1+z_2+y_3+z_4+y_5+y_6=20-8-4-5=3\;,$$
and similarly for every set of three variables. It turns out that at this point we’re done, since there is no solution to $(1)$ in non-negative integers such that more than four of the variables exceed their upper bounds.
It is also possible to use generating functions.
A: The way these problems work is always the same:
Make every constraint of the form $0 \leq y_i \leq k_i$ or of the form $0 \leq y_i < k_i$ (note that you can always pick any of the two because the $y_i$ are integers) and then proceed as usual.
They way you go about changing the constraints is by adding or subtracting to each variable the right number to make the lower bound go to 0.
For example, you have $-2 \leq x_1 \leq 5$. If you add 2, you get $0 \leq x_1 + 2 \leq 7$. Call $y_1$ to $x_1 + 2$.
In your initial equation $x_1+x_2+x_3+x_4+x_5+x_6=25$ you add 2 on both sides, to get $x_1+2+x_2+x_3+x_4+x_5+x_6=25+2 \iff y_1+x_2+x_3+x_4+x_5+x_6=27$ with the $x_i$ satisfying your inequalities and with $0 \leq y_1 \leq 7$. If you add/subtract the right numbers to each $x_i$, you can get a new equation with all $y_i$ having $0 \leq y_i \leq k_i$ for some $k_i$ you are to find. After that, the usual procedures work just fine.
A: Hint:
By a change of variables, letting:
$$\begin{cases}y_1=x_1+2\\ y_2=x_2-1\\ y_3=x_3+2\\ y_4=x_4-3\\ y_5=x_5-2\\ y_6=x_6-3\end{cases}$$
we have now the new system:
$$\begin{cases} y_1+y_2+y_3+y_4+y_5+y_6=\square\\ 0\leq y_1\leq \square\\ 0\leq y_2\leq \square\\ 0\leq y_3\leq \square\\ 0\leq y_4\leq \square\\ 0\leq y_5\leq \square\\ 0\leq y_6\leq \square\end{cases}$$
where I leave it to you to figure out what the missing values are for each of the $\square$'s.
This should have converted the problem into a format that you are more familiar with and you can use the usual methods to continue to solve.
