# Combinations (counting sequence) of words

I've been working on these two practice problems, I'm not really sure whether my solutions are right or not.

1. What is the counting sequence for all words on the $\{a, b, c\}$ that contain exactly one $a$?

For this question I've come to the conclusion that the sequence is $\binom{n}{1}\cdot2^{n-1}$

2. We have $\{a, b\}$, no consecutive "b"s are allowed.

How does the counting sequence begin (at least up to size $6$)?

I think I should take the combination with no repetition approach, but I have no idea where to begin with.

A step by step guide for this problem is appreciated.

• @bburGsamohT: The original question stated "2^n-1", which I have fixed to $2^n-1$. I think your fix is not aligned with OP's intention. – barak manos Jan 14 '16 at 8:05
• bburGsamohT's fix is the right version. Yours would be wrong. Thanks for reformatting it though, couldn't find the ones for combinatorics. – Andrew Jan 14 '16 at 23:47
• No problem, but when you say "Yours would be wrong", keep in mind that it is in fact yours, not mine. – barak manos Jan 15 '16 at 11:08

For part 2: let $c_n$ denote the number of $n$ letter words satisfying your restraints. Let $w=l_1l_2\dots l_n$ be such a word, where $l_i\in\{a,b\}$ for $1\leq i\leq n$. If $l_1=a$, then this induces no restrictions on the remaining letters $l_2\dots l_n$. This means that $l_2\dots l_n$ is a word of length $n-1$ satisfying the repetition requirements, i.e. there are exactly $c_{n-1}$ words of length $n$ which satisfy the rules and whose first letter is $a$. Now if $l_1=b$, we must have that $l_2=a$, otherwise we would have two consecutive $b$'s. Once we place the $a$, there are no other affects that $l_1$ has on the rest of your word. This means that $l_3\dots l_n$ is a word of length $n-2$ satisfying your requirements. So there are $c_{n-2}$ words of length $n$ which have no consecutive $b$'s and whose first letter is a $b$. As each word can only start with $a$ or $b$, we have exhausted all possibilities. Thus we have the recurrence $$c_n=c_{n-1}+c_{n-2},$$ with the obvious initial conditions $c_1=2$ given by the words $a$ and $b$, and $c_2=3$ given by the words $aa$, $ab$, and $ba$. Can you go from here?