Combinatorics Question Asking How Many Integer Solutions Given Different Restrictions
Your solution to the first question is completely correct.
How many integer solutions of the equation $x_1 + x_2 + x_3 + x_4 = 28$ are there with $-10 \leq x_i \leq 20$ for $1 \leq i \leq 4$?
Let $x_i' = x_i + 10$ for $1 \leq i \leq 4$. Since $-10 \leq x_i \leq 20$, $0 \leq x_i' \leq 30$. Substituting $x_i' - 10$ for $x_i$, $1 \leq i \leq 4$ and simplifying gives $$x_1' + x_2' + x_3' + x_4' = 68$$ which is an equation in the nonnegative integers, which we must solve subject to the restrictions that $x_i \leq 30$ for $1 \leq i \leq 4$. This is an Inclusion-Exclusion Principle problem analogous to the one you solved. Notice that at most two of the variables can simultaneously violate the restriction since $2 \cdot 31 = 62 < 68 < 93 = 3 \cdot 31$.
Applying the Inclusion-Exclusion Principle as above yields $$\binom{68 + 4 - 1}{4 - 1} - \binom{4}{1}\binom{37 + 4 - 1}{4 - 1} + \binom{4}{2}\binom{6 + 4 - 1}{4 - 1} = \binom{71}{3} - \binom{4}{1}\binom{40}{3} + \binom{4}{2}\binom{9}{3}$$
The last problem is a bit tedious. Let's see if we can save you some work.
How many nonnegative integer solutions of the equation $x_1 + x_2 + x_3 + x_4 = 28$ are there such that $x_1 \leq 6$, $x_2 \leq 10$, $x_3 \leq 15$, $x_4 \leq 21$?
Let $A$ be the event that $x_1 > 6$, $B$ be the event that $x_2 > 10$, $C$ be the event that $x_3 > 15$, and $D$ be the event that $x_4 > 21$. Without those restrictions, there are $$\binom{28 + 4 - 1}{4 - 1} = \binom{31}{3}$$ solutions, as you found. From these, we must subtract those solutions that violate one or more of the restrictions. To do so, we use the Inclusion-Exclusion Principle. The number of cases that violate one or more of the restrictions is $$|A \cup B \cup C \cup D| = |A| + |B| + |C| + |D| - |A \cap B| - |A \cap C| - |A \cap D| - |B \cap C| - |B \cap D| - |C \cap D| + |A \cap B \cap C| + |A \cap B \cap D| + |A \cap C \cap D| + |B \cap C \cap D| - |A \cap B \cap C \cap D|$$ It is possible to violate each of the restrictions. It is also possible to simultaneously violate the first and second restrictions, first and third restrictions, and second and third restrictions. However, it is not possible to simultaneously violate the first and fourth restrictions, second and fourth restrictions, or third and fourth restrictions, nor it is possible to simultaneously violate any three or four of the restrictions simultaneously. Hence, $$|A \cap B \cap C \cap D| = |A| + |B| + |C| + |D| - |A \cap B| - |A \cap C| - |B \cap C|$$ as all the remaining terms are equal to zero. Can you proceed?