$x_1 + x_2 + x_3 + x_4 = 28$ number of solutions How many solutions are there to the equation in the title with the following constraints:
$0 ≤ x_i, x_1 ≤ 6, x_2 ≤ 10, x_3 ≤ 15, x_4 ≤ 21?$
So, to do this I tried the following: 
(A) Total number is ${31 \choose 28}$ ways. 
(B) $x_1$ having $7$+ is ${24 \choose 21}$ ways. 
(C) $x_1$ having $7$+ and $x_2$ having $11$+ is ${13 \choose 10}$ ways.
There is no way that $x_3$ can have 15+ since $7 + 11 + 15 > 28$. 
Answer is $A - B + C = 2,757$ ways. 
Is this correct?
 A: This is how I would calculate it.
$T_1 = \binom{31}{3}$ 
ignores all upper constraints.
$T_2 = \binom{24}{3}$ 
$x_1 \geq 7.$
$T_3 = \binom{20}{3}$ 
$x_2 \geq 11.$
$T_4 = \binom{15}{3}$ 
$x_3 \geq 16.$
$T_5 = \binom{9}{3}$ 
$x_4 \geq 22.$
$L_1 = T_2 + T_3 + T_4 + T_5.$ 
$L_1$ represents # of ways that at at least one constraint violated.
Running total so far is $T_1 - L_1$.
$T_6 = \binom{13}{3}$ 
$x_1 \geq 7, x_2 \geq 11.$
$T_7 = \binom{8}{3}$ 
$x_1 \geq 7, x_3 \geq 16.$
$T_8 = 0$ 
$x_1 \geq 7, x_4 \geq 22.$ : impossible
$T_9 = \binom{4}{3}$ 
$x_2 \geq 11, x_3 \geq 16.$
$T_{10} = 0$ 
$x_2 \geq 11, x_4 \geq 22.$  : impossible
$T_{11} = 0$ 
$x_3 \geq 16, x_4 \geq 22.$  : impossible
$L_2 = T_6 + T_7 + T_8 + T_9 + T_{10} + T_{11}.$ 
$L_2$ represents # of ways that at at least two constraints violated.
Running total so far is $T_1 - L_1 + L_2$.
The above is the final total, because you can not have more than two constraints violated and still have the sum $\leq 28.$
A: Let
$$U=\{(x_1,x_2,x_3,x_4)\in \mathbb Z^4\mid x_1+x_2+x_3+x_4=28,\  x_i \geq 0,\  i=1,2,3,4 \},$$
$$A_k=\{(x_1,x_2,x_3,x_4)\in \mathbb Z^4\mid x_1+x_2+x_3+x_4=28,\ x_k\leq a_k,\  x_i \geq 0,\  i=1,2,3,4 \},$$ where $a_1=6$, $a_2 = 10$, $a_3 = 15$, $a_4 = 21$.
The number of solutions you want is
\begin{align}
|A_1\cap A_2 \cap A_3 \cap A_4| &= |U| -|(A_1\cap A_2 \cap A_3 \cap A_4)^c| \\
&= |U| - |A_1^c \cup A_2^c \cup A_3^c\cup A_4^c|\\
&= |U| - (|A_1^c|+|A_2^c|+|A_3^c|+|A_4^c|)\\ 
&+(|A_1^c\cap A_2^c|+|A_1^c\cap A_3^c|+|A_1^c\cap A_4^c|+|A_2^c\cap A_3^c|+|A_2^c\cap A_4^c|+|A_3^c\cap A_4^c|)\\ &-(|A_1^c\cap A_2^c\cap A_3^c|+|A_1^c\cap A_2^c\cap A_4^c|+|A_1^c\cap A_3^c\cap A_4^c|+|A_2^c\cap A_3^c\cap A_4^c|)\\ &+(|A_1^c\cap A_2^c\cap A_3^c\cap A_4^c|)
\end{align}
which follows from the inclusion-exclusion principle.
Note that $A_k^c =\{(x_1,x_2,x_3,x_4)\in \mathbb Z^4\mid x_1+x_2+x_3+x_4=28,\ x_k\geq a_k+1,\  x_i \geq 0,\  i=1,2,3,4 \}.$
I'll show how to calculate these on an example and leave the rest to you (note that lots of the above sets will be empty). Let's look at $|A_1^c\cap A_2^c|$. This is the number of nonnegative integer solutions of $$x_1+x_2+x_3+x_4 = 28,\ x_1 \geq 7,\ x_2\geq 11.$$
Now, $$x_1+x_2+x_3+x_4 = 28 \implies (x_1 - 7) + (x_2 -11) + x_3 + x_4 = 10,$$
so the number of solutions is $\binom {10+4-1}{4-1}$.
The rest can be calculated analogously.
