How many strings of length $n$ from symbols $\{0, 1\}$ do not contain the substring $101$?
Please, give me a hint.
How many strings of length $n$ from symbols $\{0, 1\}$ do not contain the substring $101$?
Please, give me a hint.
This is a finite automaton accepting the strings of such language:
with the following transition matrix: $$ M = \begin{pmatrix}1 & 1 & 0 \\ 0 & 1 & 1 \\ 1 & 0 & 0\end{pmatrix} $$ having characteristic polynomial $x^3-2x^2+x-1$. By denoting the number of strings with length $n$ of such language as $L_n$, the Cayley-Hamilton theorem ensures that the characteristic polynomial of $\{L_n\}_{n\geq 0}$ is the same as the characteristic polynomial of $M$, hence
$$ L_{n+3} = 2 L_{n+2} - L_{n+1} + L_n,\quad L_0=1,L_1=2,L_2=4 $$
$$ L_n = A \alpha^n + B \beta^n + C \gamma^n $$ where $\alpha\approx 1.75$ is the only real root of $x^3-2x^2+x-1$ and $\beta,\gamma$ are the complex roots (having modulus $\approx 0.75$). The constants $A,B,C$ can be found by interpolation and the generating function of $L_n$ is given by
$$ \text{GF}(z) = \sum_{n\geq 0}L_n z^n = \frac{1+z^2}{1-2 z+z^2-z^3} $$ and for large values of $n$ we have $$ L_n \approx 1.26724 \cdot 1.75488^n. $$