How can I find the number of solutions to the equation $$x_1+x_2+x_3+x_4+x_5=23$$ for positive integers, so that two of the variables will be even and the other three odd?
Attempt:
Based on the equation of the geometric series formula an even variable generating function is $\frac{1}{(1-x^2)}$. As for an odd variable, the generating function is $\frac{x}{(1-x^2)}$.
Then the generating function of this equation is $\left(\frac{1}{(1-x^2)}\right)^2 \cdot\left(\frac{x}{(1-x^2)}\right)^3 = \frac{x^3}{(1-x^2)^5}$
But I don't know how to continue from here to find the number of solutions.
Suppose that $x_1$, $x_2$ are even and $x_3$, $x_4$, $x_5$ are odd.
Let $x_1=2(y_1+1)$, $x_2=2(y_2+1)$, $x_3=2y_3+1$, $x_4=2y_4+1$ and $x_5=2y_5+1$.
The given equation is equivalent to
$$2(y_1+1)+2(y_2+1)+(2y_3+1)+(2y_4+1)+(2y_5+1) =23 $$
$$y_1+y_2+y_3+y_4+y_5 =8 $$
where $y_i$, $i=1,2,...,5$ are non-negative integers.
By Stars and Bars method, the standard solution of the above problem is ${12 \choose 8}$.
Since above consideration corresponds to only one pair of numbers ($x_1$ and $x_2$) to be even, and there are ${5 \choose 2}$ possible ways to choose two even numbers.
Thus the final answer should be $${5 \choose 2}\cdot {12 \choose 8}$$
Alternate approach by generating function:
The generating function for positive even $x$ is $$x^2+x^4+x^6+\dots = \frac{x^2}{1-x^2}$$
The generating function for positive odd $x$ is $$x+x^3+x^5+\dots = \frac{x}{1-x^2}$$ Thus the generating function for 2 even $x$ and 3 odd $x$ is
$$\left (\frac{x^2}{1-x^2} \right)^2 \cdot \left (\frac{x}{1-x^2}\right)^3=\frac{x^7}{(1-x^2)^5} $$
We are finding the coefficient of $x^{23}$ in the expansion of $\frac{x^7}{(1-x^2)^5}$ which is the same as the coefficient of $x^{16}$ in the expansion of $\frac{1}{(1-x^2)^5}$
This is equal to $${-5 \choose 8}={12 \choose 8}$$
But the above considerations have no regard to which 2 are even and which 3 are odd. Since there are ${5 \choose 2}$ ways of choosing 2 numbers to be even, the final answer is $${5 \choose 2} \cdot {12 \choose 8} $$