7

A recent question caused me to ponder Fibonacci sequences in $\mathbb{Z}_n$.

An immediate observation is that the sequence is determined by the current value and the previous. So, it could be considered as a finite state machine with $\mathbb{Z}_n^2$ as its state space. So, the period cannot be more than $n^2$. Actually, $n^2 - 1$ since $(0, 0)$ is an obvious fixed point. However, this only limits the period to a maximum of $n^2 - 1$.

Next, I realised that it was important to understand the prime cases and, in these cases, I am dealing with a field.

I'll say Fibonacci like sequence to mean a sequence which obeys the same recurrence relation but not necessarily the same initial values. These Fibonacci like sequences form a vector space of dimension $2$ over the field.

I can try to use Binet's formula. This seems to work well in most cases. Let's ignore some of the small ones at the moment so $\mathbb{Z}_p$ with $p \ge 7$. There are two cases;

  1. The field contains a square root of $5$. In this case, Binet's formula gives us two linearly independent Fibonacci like sequences and hence they span the whole space. The multiplicative group of a finite field is cyclic so these solutions have a period which divides $p - 1$. This is a considerably tighter limitation than my observation from the finite state machine.

  2. The field does not contain a square root of $5$. In this case, I can use a field extension of degree $2$. This is rather like the familiar case with $\mathbb{Z}$ or $\mathbb{Q}$. Again, I get two linearly independent solutions and hence they span the whole space. This time, I can only say that the period divides $p^2 -1$. This is still a tighter restriction.

Now the small cases. $\mathbb{Z}_2$ and $\mathbb{Z}_3$ feel a little odd since $5$ is not a canonical member of the field. Nonetheless, I can solve them in field extensions of degree $2$ and they are like case 2.

The most interesting case is $\mathbb{Z}_5$. Binet's formula works but only gives me only one solution which has period $4$. So, it does not span the space. Manual inspection shows that the period of the standard Fibonacci series is $20$. This does not contradict my initial observation that the period is $\le n^2 - 1$ but it does not fit cases 1 or 2 above. It is not a Binet like solution.

Finally my question: is there anything interesting going on here? Or, is it just that there is no guarantee that the Binet formula always gives us two independent solutions and we are just lucky that it does in most cases. When it does not then there may be another solution of a different form.

badjohn
  • 8,204
  • 2
    This article confirms your observation about $p=5$ and period $20$ (right after Theorem 2). The authors link the phenomenon to eigenvalues, if I understood correctly. – user3733558 Mar 30 '21 at 15:12
  • 3
    Is https://en.wikipedia.org/wiki/Pisano_period relevant to your problem? – thibo Mar 30 '21 at 15:12
  • 2
    @user3733558 I think the important fact here is that the matrix $M=\begin{pmatrix} 0 & 1\ 1 & 1\ \end{pmatrix}$ is invertible in $\mathbb{Z}/5\mathbb{Z}$ and has finite order (since the group is finite). As $(F_n,F_{n+1}) = M^n.(F_0,F_1)$, the sequence is periodic – thibo Mar 30 '21 at 15:15
  • @thibo I read that article but only after my own musings since the main purpose was some brain exercise rather than just finding the answer. It confirmed my calculations but I still wondered why the 5 case was exceptional. That is my real question: why is 5 different? – badjohn Mar 30 '21 at 15:21
  • @badjohn I don't quite understand why you say that 5 is a special case? – thibo Mar 30 '21 at 15:59
  • 1
    @thibo It's the only one when the period is not a factor of $p -1$ or $p^2 -1$. It is not one of my cases 1 or 2. – badjohn Mar 30 '21 at 16:01
  • 1
    Modulo a prime $p\neq5$ the smallest period is a factor of either $p-1$ or of $2(p+1)$. Depending on whether $5$ is a quadratic residue or a non-residue modulo $p$. See this answer for a related argument. I used the same idea here. Modulo prime powers we have this thread. More generally, Chinese remainder theorem is your friend. – Jyrki Lahtonen Mar 30 '21 at 19:24
  • @JyrkiLahtonen Thanks. I had figured out most of that but the $5$ case seemed interesting. It's the only one with a cycle whose period does not divide $p-1$ or $p^2 - 1$. – badjohn Mar 30 '21 at 23:03
  • 1
    One simple explanation is that Binet's formula calls for division by $\sqrt5$. In modulo five context this would amount to division by zero, and needs to be thrown out of the window. Another explanation comes from a comment of @thibo. Modulo five the characteristic equation of the matrix $M$ is $$\chi_M(x)=x^2-x-1=x^2+4x+4=(x+2)^2.$$ So in that case we have a doubled eigenvalue $\lambda=-2\equiv3$. The solution space of the Fibonacci recurrence relation is thus $$f(n)\equiv3^n(An+B)$$ with $A,B$ arbitrary from $\Bbb{Z}/5\Bbb{Z}$. – Jyrki Lahtonen Apr 01 '21 at 04:27
  • 1
    The presence of the $An$ term implies that the period is not determined solely by the (multiplicative) order of the eigenvalue $3$ (equal to $4\mid p-1$) but also by the period of $An$ (obviously equal to $5$). The least common multiple $20$ is thus the period except with those special solutions corresponding to $A\equiv0$. – Jyrki Lahtonen Apr 01 '21 at 04:39
  • @JyrkiLahtonen Thanks again. Indeed, the presence of the $\sqrt{5}$ explains why the $5$ case is exceptional and Binet's formula does not give two independent results as usual. It was the other solution that puzzled me. Your matrix explanation is good. If you convert your comments to an answer, I would accept it. – badjohn Apr 01 '21 at 13:02

0 Answers0