Mistake using inclusion exclusion to count solutions to $x_1+x_2+x_3+x_4=26$ Consider the equation $x_1+x_2+x_3+x_4=26$. How many solutions are there with $2≤x_i≤7$ for all $i∈\{1,2,3,4\}$?
Let $y_i=x_i-2$, $0≤x_i≤5$ for all $i∈\{1,2,3,4\}$. The equation becomes
$y_1+y_2+y_3+y_4=18$.
Let $|S|$ as set of all non-negative solutions of $y_1+y_2+y_3+y_4=18$, $|S|= C(21,18)=1330.$
Let $|A|$ as subset of $|S|$ that $y_i≥6$ for all $i∈\{1,2,3,4\}$
$A_1,A_2,A_3,A_4=(z_1-6)+z_2+z_3+z_4=12$..
$4\cdot C(15,12)=455\cdot 4=1820$.
To find the solution, we need to take $C(21,18)-4\cdot C(15,12)$, which would result in a negative number. I could not figure out what's wrong.
 A: That is not the correct application of Principle of Inclusion Exclusion. Applying Principle of Inclusion Exclusion, the number of solutions to
$y_1 + y_2 + y_3 + y_4 = 18, 0 \leq y_i \leq 5$ is given by,
$ \displaystyle {21 \choose 3} - {4 \choose 1} \cdot {15 \choose 3} + {4 \choose 2} {9 \choose 3} - {4 \choose 3} $
You stopped at $ \displaystyle {21 \choose 3} - {4 \choose 1} \cdot {15 \choose 3} ~ $ but note that when you subtract cases where one of $y_i$ is at least $6$, it also counts cases where two of them are at least $6$ and they get subtracted twice. For example $ \{y_1 \geq 6, y_2 \geq 6 \} $ will be counted when we choose $y_1$ as part of ${4 \choose 1}$ and apply stars and bars and also when we choose $y_2$ as part of ${4 \choose 1}$ and apply stars and bars. So we add back cases where two of them are at least $6$ but that leads to overcounting cases where three of them are at least $6$ so we finally subtract them.

Also note that it is not necessary to apply P.I.E in this case as counting permissible cases are straightforward. At least two of them must be $5$ each. So the only solutions are $ \{5 ~ 5 ~ 5 ~ 3 \}$ and $ \{5 ~ 5 ~ 4 ~ 4 \}$. That leads to $ \displaystyle {4 \choose 1} + {4 \choose 2} = 10$ solutions.
A: I will begin with your simplification.
"Let $y_i=x_i-2$, $0≤y_i≤5$ for all $i∈\{1,2,3,4\}$.
The equation becomes $y_1+y_2+y_3+y_4=18$."
Note that the maximum value of $y_i$ is $5$ and $4 \times 5 = 20 > 18$.
Further, there are no combinations including any $0≤y_i≤2$ that can sum to $18$.
The only combinations of four constrained values summing to $18$ are arrangements of $(3 \times 5) + (1 \times 3)$ and $(2 \times 5) + (2 \times 4)$.
The answer to the number of solutions is $4\choose1$ + $4\choose2$ = 10.
where $4\choose1$ represents the arrangements of one $3$ amongst three $5$'s and $4\choose2$ represents the arrangement of two $4$'2 amongst two $5$'s.
