Find the generating function for the number of solutions (a) Find the generating function for the number of solutions to
$x_1+x_2+x_3+x_4+x_5+x_6=n$ where $x_1,x_2,x_3$ are even $x_4,x_5,x_6$ are odd 
(b) Find the generating function for the number of solutions  to
$x_1+x_2+x_3+x_4+x_5=n$
subject to the condition that $0\leq x_i \leq 12$. answer in the closed form..
As i know that the number solution for the equation $x_1+x_2+x_3+x_4+...+x_k=n$ is C(n+k-1 , k)
 A: Hint: Start by finding the generating functions $O(z)$ and $E(z)$ that represent
$$
[z^k]O(z)=\begin{cases}1 & \text{for $k$ odd}\\0 & \text{for $k$ even}\end{cases}
$$
and
$$
[z^k]E(z)=\begin{cases}0 & \text{ for $k$ odd}\\1 & \text{ for $k$ even}\end{cases}.
$$
How could you write the generating function for the sums of two even numbers?  Of three?  What about odd numbers?  How can you combine these results?
For the second, try to see how you could replace the even and odd conditions above with something more appropriate to the problem.
A: Here is a slightly different approach.   

Ad Problem  (a):
  
  
*
  
*Since even  $x_j, 1\leq j\leq 3$ may have values $0,2,4,\ldots$ we encode candidates for even $x_j$ via $t^0+t^2+t^4+\cdots$
  
*Since odd $x_j, 4\leq j\leq 6$ may have values $1,3,5,\ldots$ we encode candidates for odd $x_j$ via $t^1+t^3+t^5+\cdots$
The contribution  of even  $x_1,x_2,x_3$ is
  \begin{align*}
 (1+t^2+t^4+\cdots)^3=\frac{1}{\left(1-t^2\right)^3}
 \end{align*}
The contribution of odd $x_4,x_5,x_6$is
  \begin{align*}
 (t^1+t^3+t^5+\cdots)^3=t^3(1+t^2+t^4+\cdots)^3=\frac{t^3}{\left(1-t^2\right)^3}
 \end{align*}
Here we apply the geometric series expansion.

It is convenient to use the coefficient of operator $[t^n]$ to denote the coefficient of $t^n$ of a series.

We conclude: A generating  function $A(t)$ providing with $[t^n]A(t)$ the number of wanted solutions is
   \begin{align*}
 A(t)=\frac{t^3}{\left(1-t^2\right)^6}
 \end{align*}

$$ $$

Ad Problem  (b):
  
  
*
  
*Since  $x_j,1\leq j\leq 5$ may have values $0\leq x_j\leq 12$ we encode the contribution of $x_j$ via $t^0+t^1+t^2+\cdots+t^{12}$.
  
  
  So,  the contribution of  each  $x_j$ can be encoded as
   \begin{align*}
 1+t^1+t^2+\cdots+t^{12}=\frac{1-t^{13}}{1-t}
 \end{align*}
Here we apply the formula for the finite geometric series.
We conclude: A generating function $B(t)$ providing with $[t^n]B(t)$ the number of wanted solutions is
   \begin{align*}
 B(t)=\left(\frac{1-t^{13}}{1-t}\right)^5
 \end{align*}

Hint: If additionally the number of solutions, i.e. the coefficient of the generating functions $A(t)$, resp. $B(t)$ is to extract, it is again convenient to apply the coefficient of operator as well as the Iverson bracket.
