I have been given the following problem:
Use generating functions to determine the number of 10-digit ternary $(0,1,2)$ sequences in which the digit $2$ occurs at least once, and the digit $0$ occurs an even number of times.
My work thus far:
I know that the general formula is
$$
r=t_0+t_1+t_2
$$
with $r=10$ and $t_0,t_1,t_2$ are just the number of occurrences for $0,1$ and $2$ respectively.
Next I have the following generating functions:
For ternary functions, the generating function is
$$
r=(u_0+u_1+u_2)^n
$$
with the digits $0,1,2$ being represented by $u_0,u_1,u_2$ and $n=10$.
For the constraint that there is an even number of $0-$digits, the formula is:
$$
\frac{1}{2}\left((u_0+u_1+u_2)^n+(-u_0+u_1+u_2)^n\right)
$$
I am however unsure as to how to implement the second constraint into the equation, namely that $1 \le u_2$, i.e. $1\le u_2 \le 10$
Firstly, is my work thus far correct?
Secondly, can anyone help me with the second constraint?