[Math] Inclusion-exclusion principle: Number of integer solutions to equations

discrete mathematicsinclusion-exclusionnumber theory

The problem is:

Find the number of integer solutions to the equation
$$
x_1 + x_2 + x_3 + x_4 = 15
$$
satisfying
$$
\begin{align}
2 \leq &x_1 \leq 4, \\
-2 \leq &x_2 \leq 1, \\
0 \leq &x_3 \leq 6, \text{ and,} \\
3 \leq &x_4 \leq 8 \>.
\end{align}
$$

I have read some papers on this question, but none of them explain clearly enough. I am especially confused when you must decrease the total amount of solutions to the equation—with no regard to the restrictions—from the solutions that we don't want. How do we find the intersection of the sets that we don't want? Either way, in helping me with this, please explain this step.

Best Answer

Let $y_1 = x_1-2$, $y_2 = x_2+2$, $y_3 = x_3$ and $y_4 = x_4-3$. Then you want to find the number of integer solutions to $y_1+y_2+y_3+y_4 = 12$ where $0 \leq y_1 \leq 2$, $0 \leq y_2 \leq 3$, $0 \leq y_3 \leq 6$ and $0 \leq y_4 \leq 5$. Let $A_1$ be the set of solutions such that $y_1 \geq 3$, $A_2$ be the set of solutions such that $y_2 \geq 4$, $A_3$ be the set of solutions such that $y_3 \geq 7$ and $A_4$ be the set of solutions such that $y_4 \geq 6$. Let $S$ be the total number of non-negative solutions with no restrictions. Then $|S|= \binom{15}{3}$. So you want to find $|S \ \backslash \ (A_1 \cup A_2 \cup A_3 \cup A_4)|$. So you use inclusion-exclusion to get $|A_1 \cup A_2 \cup A_3 \cup A_4|$.

Related Question