[Math] How many words of length n over the alphabet {a,b,c} such that the sub-word aa does not appear

combinatoricsrecurrence-relations

The question asks that it be solved as a recurrence relation, as in set up a recurrence relation then determine initial values to give a solution. However I am not really confident setting up recurrence relations. I know that there are $3^n$ different words over this alphabet but not how to determine how many do not contain the sub-word.

Best Answer

Hint: Let $a_n$ be the number of strings which satisfy the conditions of length $n$.

  • If a string begins with $b$ or $c$, then you are left with a string of length $n-1$, which can start with any character. How many strings are there of this type (it is related to $a_{n-1}$)?

  • If a string begins with $a$, then the second letter must be a $b$ or $c$, then you are left with a string of length $n-2$, which can start with any character. How many strings are there of this type (it is related to $a_{n-2}$)?