Recursive formula for alternating sequence.

71 Views Asked by At

We will say that a sequence composed of the digits $0,1,2,3,4$ is alternating if, after the occurrence of a positive digit, no positive digit of the same parity appears, and after the occurrence of $0$, no $0$ appears. Let $a_n$ denote the number of alternating sequences of length $n$. Find $$ \lim_{{n\to\infty}} \frac{a_{n+1}}{a_n} $$

My solution: Let $z_n$ be the sequence ending in zero, and $e_n$ be the sequence ending in something else.

Then $$a_n = z_n + e_n$$ where $z_n = e_{n-1}$, since a sequence ending in zero can be created from a sequence one shorter ending in $1,2,3$ or $4$ by simply adding $0$.

And $e_n = 4z_{n-1} + 2e_{n-1}$ because we can take a sequence one shorter and ending in zero and then append to it $1,2,3$ or $4$. Or take a sequence ending in something positive and append one of the two possible positive numbers to it.

So $a_n = 3e_{n-1} + 4e_{n-2}$, and $$ \lim_{{n\to\infty}} \frac{a_{n+1}}{a_n} = 3 $$

Is my solution correct? The limit calculation is not important to me, it's about the recursive equation.

1

There are 1 best solutions below

1
On BEST ANSWER

Your recurrences all look correct. I don't think your limit is correct.

Once we have the recurrences for $z_n$ and $e_n$, we can substitute $z_n=e_{n-1}$ into the recurrence for $e_n$ to get $$e_n=2e_{n-1}+4e_{n-2}$$ Combining these two together gives, as you wrote, $$a_n=3e_{n-1}+4e_{n-2}$$ For the limit, all we really care about is that $a_n$ is some linear combination of $e_{n-k}$ terms. We know that generally for a linear recurrence $e_n\sim Cr^n$ for constants $C,r$ so $\frac{a_{n+1}}{a_n}\sim r$. We can calculate $r$ by finding the roots of the characteristic polynomial of $e_n$ which is $$x^2-2x-4=0$$ The roots are $1\pm\sqrt{5}$. This means $e_n$ can be expressed as a linear combination of powers of $1-\sqrt{5}$ and $1+\sqrt{5}$. Since $e_n$ is an integer, and both of these roots are not, we can see that the coefficient of $1+\sqrt{5}$ is nonzero. Since it is the root of larger magnitude, the powers of the smaller term will vanish accordingly so $r=\boxed{1+\sqrt{5}}$