<s>[INST] Finding the coefficient of $x^{10}$ in $(1+x^2-x^3)^8$ The coefficient of $x^{10}$ in $(1+x^2-x^3)^8$. I tried to factor it into two binomials but it became way to long to solve by hand.
 [/INST] More generally, the coefficient of  $x^{n}$ is given by
$$[x^{n}](1+x^2(1-x))^8=[x^{n}]\sum_{k=0}^8\binom{8}{k}x^{2k}(1-x)^k
=(-1)^n\sum_{n/3\leq k\leq \min(n/2,8)}\binom{8}{k}\binom{k}{n-2k}.$$
For $n=10$ we get
$$\sum_{4\leq k\leq 5}\binom{8}{k}\binom{k}{10-2k}=\binom{8}{4}\binom{4}{2}+\binom{8}{5}\binom{5}{0}=476.$$
</s>