Counting 4-words with a restriction by using EGF

74 Views Asked by At

$Problem:$ Let $q_n$ be the number of $n$-words containing letters from the set $\{a, b, c, d\}$ in which there is odd number of letters $b$. Find recursive relations for $q_n$, generating function and, lastly, find $q_n$.

What I've managed to do is to get system of recurrence relations, solve the system and, thus, determine that $q_{n+1} = 6q_n - 8q_{n-1}$, i.e. $q_n = \frac142^n + \frac784^n$, while $q_1 = 4, q_2 = 15$.

I've encountered problems when trying to solve it with generating functions. As far as I got it, because in this problem arrangement matters, I will exponential generating functions. After some work with the series I got the $E(x) = \frac{e^x - e^{-x}}2e^{3x} = \frac12\sum_{n = 0}^\infty(4^n - 2^n)\frac{x^n}{n!}$.

So, where am I doing it wrong? Any help is appreciated.

1

There are 1 best solutions below

1
On BEST ANSWER

Let $q_n$ denote the number of words of length $n$ with an odd number of $b's$ and let $p_n$ denote the number of words of length $n$ with an even number of $b's$. They satisfy the following recurrence relations \begin{eqnarray*} q_{n+1}=3 q_n +p_n \\ p_{n+1}=3 p_n +q_n. \end{eqnarray*} It is easy to show $q_{n+1}= 6q_{n}-8q_{n-1}$ (which you did in the question). We get the following initial condtions $\color{red}{q_0=0}$, $\color{red}{q_1=1 }$ ,($p_1=3$). So $q_n = \frac{1}{2} 4^n - \frac{1}{2} 2^n$ and the normal and exponential generating functions are \begin{eqnarray*} \sum_{n=0}^{\infty} q_{n} x^n =\frac{1}{2} \left( \frac{1}{1-4x} - \frac{1}{1-2x} \right) \\ \sum_{n=0}^{\infty} q_{n} \frac{x^n}{n!} =\frac{1}{2} \left( e^{4x} - e ^{2x} \right) . \end{eqnarray*}