Generating function of $\sum_{i=1}^8 a_i=n$ with $\sum_{i=1}^4 a_i$ even and $\sum_{i=5}^8 a_i$ odd For each $n$, find the generating function of number of non-negative  integer solutions to $x_1+x_2+x_3+x_4+x_5+x_6+x_7+x_8=m$ with $x_1+x_2+x_3+x_4$ even and $x_5+x_6+x_7+x_8$ odd.
Claim: If $m=2n$ is even, the coefficient is $0$ because there’s no way for odd+even=even, and if $m=2n+1$ is odd, the coefficient is $\frac{1}{2}\binom{2n+8}{7}$. Therefore the generating function of $(0,\frac{1}{2}\binom{8}{7},0,\frac{1}{2}\binom{10}{7},0,\frac{1}{2}\binom{12}{7}\dots)$ is $$\frac{\frac{1}{(1-x)^8}-\frac{1}{(1+x)^8}}{4}$$
My attempt: We are done with the $m$ is even case. Suppose $m=2n+1$ is odd, there are $n+1$ cases, $(0,2n+1),(2,2n-1),(4,2n-3),\dots,(2n,1)$.
So using stars and bars we have the number of solutions
\begin{align*}
\sum_{r=0}^n \binom{4+2r-1}{4-1} \binom{4+(2n+1-2r)-1}{4-1}
\end{align*}
My difficulty: How to show this expression equals $\frac{1}{2}\binom{2n+8}{7}$?
 A: Without the even restriction, the generating function for $x_1,x_2,x_3,x_4$ is 
$$
(1+x+x^2+\dots)^4=(1-x)^{-4}
$$
To get rid of the odd solutions, we use the standard trick which zeroes the odd coefficients of any generating function. If $f(x)$ is a generating function, then $(f(x)+f(-x))/2$ has a coefficient of $0$ for odd powers, and the same coefficient of $f$ otherwise. Therefore, the generating function for the first four variables is
$$
\frac12\big((1-x)^{-4}+(1+x)^{-4}\big)
$$
Similarly, the generating function for the last four variables is
$$
\frac12\big((1-x)^{-4}-(1+x)^{-4}\big)
$$
We finally multiply these together to get the total generating function of
$$
\frac12\cdot \color{blue}{\frac12\big((1-x)^{-8}-(1+x)^{-8}\big)}
$$
The $\color{blue}{\text{blue}}$ part is the result of applying the trick which zeroes the even coefficients to $(1-x)^{-8}$. Therefore, when $n$ is even, the coefficient of the above is $0$, and when $n$ is odd, it is $\frac12$ times the coefficient of $(1-x)^{-8}$, which is $\frac12(-1)^n\binom{-8}n=\frac12\binom{7+n}7$.

Finally, in retrospect, there is a rather obvious combinatorial proof of the result of $\frac12\binom{7+n}7$. The total number of solutions, without the even/odd conditions, is $\binom{n+7}7$ by stars and bars. Exactly half of those solutions have $x_1+\dots+x_4$ even (and therefore $x_5+\dots+x_8$ odd, since $n$ is odd). Why? To every solution $$(x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8)$$ with the sum of the first four variables even, there is exactly one corresponding solution $$(x_5,x_6,x_7,x_8,x_1,x_2,x_3,x_4)$$ with the first four variables odd. Therefore, exactly half of the solutions are in the first category.
