# combinatorics- r-digit ternary sequences

• August 4th 2008, 07:57 PM
dixie
combinatorics- r-digit ternary sequences
Hi, I have found some examples online of ternary sequences but still don't understand how to do

how many r-digit ternary sequences are there with:
a) and even # of 0s?
b) and even # of 0s and even # of 1s?
c) at least one 0 and at least one 1?

thanks for any help
• August 5th 2008, 04:32 PM
Plato
Quote:

Originally Posted by dixie
how many r-digit ternary sequences are there with:
a) and even # of 0s?
b) and even # of 0s and even # of 1s?
c) at least one 0 and at least one 1?

I understand that the reply is really late but I was stopped by part (b).
The other two parts have rather simple solutions.
But I found no simple way to model part (b).
(a) $\sum\limits_{k = 0}^{\left\lfloor {\frac{r}{2}} \right\rfloor } {\left( {\begin{array}{c} r \\ {2k} \\ \end{array} } \right)} \left( {2^{r - 2k} } \right)$.

(b) $\sum\limits_{k = 0}^{\left\lfloor {\frac{r}{2}} \right\rfloor } {\sum\limits_{j = 0}^{\left\lfloor {\frac{r}{2}} \right\rfloor - 2k} {\left( {\begin{array}{c}
r \\ {2k} \\ \end{array} } \right)\left( {\begin{array}{c} {r - 2k} \\
{2j} \\ \end{array} } \right)} }$

This beautifully simple.
(c) $3^r - 2^{r + 1} + 1$.
• August 6th 2008, 02:29 PM
awkward
If the previous reply was late then this one is really, really late, but I can't resist applying some exponential generating functions to these problems. I don't know Dixie's background, so he/she may not be able to follow the generating functions, but maybe the final answers will be useful anyway. In what follows, $a_r$ is the number of r-digit ternary sequences and $f(x) = \sum_{r=0}^\infty \frac{a_r}{ r!} x^r$ is the associated exponential generating function.

a) $f(x) = (e^x + e^{-x}) \, e^{2x} / 2$
$a_r = (3^r + 1) /2$

b) $f(x) = [(e^x + e^{-x}) / 2]^2 \, e^x$
$a_r = (3^r + 2 + (-1)^r) / 4$

c) $f(x) = (e^x - 1)^2 \, e^x$
$a_r = 3^r - 2^{r+1} + 1$

I haven't attempted to figure out if the answers to a) and b) are actually different than Plato's answers, or simply the same answers written in a different form.