G-SETS AND LINEAR RECURRENCES MODULO
PRIMES
THOMAS MCKENZIE, SHANNON OVERBAY, AND ROBERT RAY
Abstract. Let p be a prime number with p 6= 2. We consider second
order linear recurrence relations of the form Sn = aSn−1 + bSn−2
over the finite field Zp (we assume b 6= 0). Results regarding the
period and distribution of elements in the sequence {S0 , S1 , . . .} are
well-known (see for example [2, 3, 4, 5]). We examine these second
order recurrences using matrices, groups, and G-sets.
1. Introduction
Let p > 2 be a prime number and let Sn = aSn−1 + bSn−2 be a second
order linear recurrence with a, b ∈ Zp and b 6= 0. Since Zp ⊕ Zp has a
finite number of elements, it is clear that any such second order linear
recurrence with initial conditions S0 , S1 ∈ Zp will eventually repeat itself.
The sequence is called uniformly distributed if each element of Zp appears
the same number of times within a repeated period of the sequence.
The case where a = b = 1 is the general Fibonacci sequence whose period
was first studied by Wall [4]. The distribution properties of the Fibonacci
sequence were explored by Kuipers and Shiue [2]. Webb and Long [5]
studied both the period and distribution properties of general second order
linear recurrences, providing a complete characterization of such sequences
over Zpk . Niederreiter and Shiue [3] extend the distribution results to finite
fields. We examine these second order recurrences over Zp using matrices,
groups, and G-sets.
The sequences defined by the recurrence relation Sn = aSn−1 + bSn−2
can be generated by the matrix relation
0 1 Sn−2
Sn−1
.
=
b a Sn−1
Sn
Or equivalently,
n
0 1
Sn
S0
.
=
b a
S1
Sn+1
MISSOURI J. OF MATH. SCI., SPRING 2013
27
T. MCKENZIE, S. OVERBAY, AND R. RAY
0 1
Let A =
. Since b 6= 0, A is a unit in the ring of 2 × 2 matrices
b a
over Zp (i.e. A ∈ GL2 (Zp )). Further, since the group of invertible 2 × 2
matrices is finite, A generates a finite cyclic group of order m, for some
natural number m. We will denote this group by
G = Ai | 0 ≤ i ≤ m − 1 .
Left multiplication of matrices
on vectors defines a map from G × (Zp ⊕
Zp ) to Zp ⊕ Zp . Since Aj Ai v = (Aj Ai )v, Zp ⊕ Zp is a G-set (see page 176
of [1]). If a subset U of Zp ⊕ Zp is closed under this action of G and has the
property that for all u′ , u ∈ U there exists a g ∈ G such that gu = u′ , then
we call U a transitive G-set. In other words, the transitive G-sets are just
the orbits of the elements of Zp ⊕ Zp under repeated left multiplication by
A.
2. Transitive G-sets
If we select an arbitrary element v from Zp ⊕ Zp , the orbit of v under
the action of G is the transitive G-set containing v. These transitive G-sets
partition Zp ⊕ Zp .
Example 2.1. Consider the standard Fibonacci sequence defined by Sn =
Sn−1 +
Sn−2 , taken over Z5 . The action of the group generated by A =
0 1
partitions the G-set Z5 ⊕ Z5 into the following 3 transitive G-sets
1 1
(orbits):
H1 =
0
,
0
0
1
1
2
3
0
3
3
1
4
H2 =
,
,
,
,
,
,
,
,
,
,
1
1
2
3
0
3
3
1
4
0
0
4
4
3
2
0
2
2
4
1
,
,
,
,
,
,
,
,
,
,
4
4
3
2
0
2
2
4
1
0
1
3
4
2
H3 =
,
,
,
.
3
4
2
1
Example 2.2. Consider the sequence defined by Sn = 3Sn−1 +4Sn−2,
0 1
taken over Z5 . Under the action of the group generated by A =
,
4 3
the G-set Z5 ⊕ Z5 can be partitioned into the following 5 transitive G-sets
(orbits):
28
MISSOURI J. OF MATH. SCI., VOL. 25, NO. 1
G-SETS AND LINEAR RECURRENCES MODULO PRIMES
0
,
0
0
1
3
3
1
0
4
2
2
4
G2 =
,
,
,
,
,
,
,
,
,
,
1
3
3
1
0
4
2
2
4
0
0
2
1
1
2
0
3
4
4
3
G3 =
,
,
,
,
,
,
,
,
,
,
2
1
1
2
0
3
4
4
3
0
1
4
G4 =
,
,
4
1
2
3
G5 =
,
.
3
2
G1 =
To further study the structure of the transitive G-sets, we turn to the
eigenvalues and eigenvectors associated with the matrix A. If λ ∈ Zp is
a root of the characteristic polynomial C(x) = x2 − ax − b, then we will
denote the associated eigenspace by Eλ . The dimension of Eλ must be one
or two. We note that by its construction,
A 6= λI, so Eλ must be one
1
dimensional. It can be verified that
is an eigenvector in Eλ . Thus,
λ
0
1
2
3
p−1
Eλ =
,
,
,
,··· ,
.
0
λ
2λ
3λ
(p − 1)λ
0
It is easy to check that
will always be a transitive G-set under
0
the action of G on Zp ⊕ Zp . It is also easy to see that if a transitive G-set
contains an eigenvector, all the other vectors in that transitive G-set must
also be eigenvectors. Therefore, for any transitive G-set, there are three
mutually exclusive possibilities:
0
(1) it is the transitive G-set
,
0
(2) it consists entirely of eigenvectors,
(3) it consists entirely of nonzero noneigenvectors.
In Example 2.2, the characteristic polynomial C(x) has repeated root
λ = 4 with associated eigenspace
0
1
2
3
4
E4 =
,
,
,
,
.
0
4
3
2
1
In this example, G4 and G5 are comprised only of eigenvectors, G2 and G3
are comprised only of nonzero noneigenvectors, and G1 is of course, just
MISSOURI J. OF MATH. SCI., SPRING 2013
29
T. MCKENZIE, S. OVERBAY, AND R. RAY
0
. Additionally, if we let S0 = 0 and S1 = 1, the sequence generated
0
by Sn = 3Sn−1 + 4Sn−2 is
0, 1, 3, 3, 1, 0, 4, 2, 2, 4, 0, 1, 3, 3, . . .
which repeats after the tenth term and corresponds to the elements of the
transitive G-set G2 . If we choose different starting conditions, e.g. S0 = 0
and S1 = 4, we get a similar, shifted sequence that also corresponds to G2 .
In Example 2.1, the characteristic polynomial C(x) has a repeated root
λ = 3, with corresponding eigenspace
0
1
2
3
4
E3 =
,
,
,
,
.
0
3
1
4
2
We note that the transitive G-set H3 contains only eigenvectors and H2
consists entirely of nonzero noneigenvectors. Furthermore, every set of
initial conditions outside the eigenspace E3 lies within the single transitive
G-set H2 . Choosing the initial starting values S0 = 0 and S1 = 1, the
Fibonacci sequence over Z5 , generated by Sn = Sn−1 + Sn−2 , is
0, 1, 1, 2, 3, 0, 3, 3, 1, 4, 0, 4, 4, 3, 2, 0, 2, 2, 4, 1, 0, . . ..
This sequence repeats after 20 terms and corresponds to the elements of
the transitive G-set H2 . If, instead, we take the initial starting values of
S0 = 2 and S1 = 1, we will generate the Lucas numbers over Z5 . The
corresponding sequence is
2, 1, 3, 4, 2, 1, 3, 4, . . . .
2
In this case, the initial conditions correspond to the eigenvector
, so
1
the sequence corresponds to H3 . We note that in the Fibonacci sequence
over Z5 , each element of Z5 appears the same number of times before the
sequence repeats, while the element 0 does not appear in the sequence of
Lucas numbers over Z5 . The distribution properties of these sequences will
be discussed in greater detail in the next section.
3. Distribution of Elements
In Example 2.2, the initial starting conditions S0 = 0 and S1 = 1 produce
the uniformly distributed repeated sequence 0, 1, 3, 3, 1, 0, 4, 2, 2, 4; whereas
the initial conditions S0 = 1 and S1 = 4 result in the nonuniformly distributed repeated sequence 1, 4.
As we noted
above,
each element of
the eigenspace associated with λ
1
0
is a multiple of
, so the vector
will be the only vector within an
λ
0
30
MISSOURI J. OF MATH. SCI., VOL. 25, NO. 1
G-SETS AND LINEAR RECURRENCES MODULO PRIMES
0
lies within its
0
own
transitive G-set. Thus, the sequences generated by initial conditions
S0
taken from an eigenspace will not be uniformly distributed. Hence,
S1
we will focus our attention on the transitive G-sets comprised of nonzero
noneigenvectors. We first show that each of these transitive G-sets have
equal size.
0
Theorem 3.1. If the order of A is m and v ∈ Zp ⊕ Zp −
is not
0
an eigenvector of A, then the transitive G-set generated by v has exactly m
elements.
eigenspace that contains a zero entry. But, we know that
Proof. Let n ∈ {1, . . . , m} with An (v) = v. Applying A to both sides of
the last equality yields An (A(v)) = A(v). Since v is a noneigenvector, v
and A(v) are linearly independent, forming a basis for Zp ⊕ Zp . But, An
fixes both v and A(v), thus An is the identity, so n = m. This gives the
result.
The characteristic polynomial C(x) of A, has one repeated root, two
distinct roots, or no roots in Zp . Then the discriminant of C(x) is a2 + 4b.
We noted above that if λ is a root of C(x) then Eλ has exactly p elements.
We make the following observations.
(1) If A has exactly one eigenvalue in Zp , then A has exactly p2 − p
nonzero noneigenvectors. This corresponds to the case where a2 +
4b = 0.
(2) If A has exactly two eigenvalues in Zp , then A has exactly p2 −2p+1
nonzero noneigenvectors. This corresponds to the case where a2 +4b
is a nonzero square (quadratic residue) in Zp .
(3) If A has no eigenvalues in Zp , then A has exactly p2 − 1 nonzero
noneigenvectors. This corresponds to the case where a2 + 4b is not
a square in Zp .
Now the following corollary is clear.
Corollary 3.2.
(i) If A has exactly one eigenvalue in Zp , then the number of elements
in any transitive G-set of nonzero noneigenvectors divides p2 − p.
(ii) If A has exactly two eigenvalues in Zp , then the number of elements
in any transitive G-set of nonzero noneigenvectors divides p2 − 2p+
1.
(iii) If A has no eigenvalues in Zp , then the number of elements in any
transitive G-set of nonzero noneigenvectors divides p2 − 1.
MISSOURI J. OF MATH. SCI., SPRING 2013
31
T. MCKENZIE, S. OVERBAY, AND R. RAY
Proof. This follows immediately from the last theorem and the above observation.
Corollary 3.3. If A does not have exactly one eigenvalue in Zp and if v is
a nonzero noneigenvector
of A, then the sequence generated by the initial
S0
= v is not uniformly distributed.
conditions
S1
Proof. Zp has p elements, but by parts (ii) and (iii) of the last Corollary, p
cannot divide the number of elements in this sequence.
4. Uniform Distribution
Now we focus our attention on the case where the characteristic polynomial has a repeated eigenvalue λ. Let r be the order of λ in the multiplicative group Zp∗ .
Theorem 4.1. If the second order recurrence Sn = aSn−1 + bSn−2 has
characteristic polynomial C(x) = x2 − ax − b with a repeated root λ and
the initial conditions are S0 = 0 and S1 = t, then the general term of the
sequence is given by Sn = tnλn−1 .
Proof. It is well-known that the general solution to this type of second
order recurrence with a repeated root has the form Sn = (α + βn)(λn ).
Using the initial conditions S0 = 0 and S1 = t, we have: 0 = S0 = α and
t = S1 = βλ, which gives us α = 0 and β = tλ−1 . Plugging these values in
for α and β gives us the desired result.
The form, Sn = tnλn−1 , gives us some useful information. First, we
recall that the p − 1 nonzero elements of Zp form the multiplicative group
Zp∗ . Since λ 6= 0, by Lagrange’s Theorem, r must divide p−1. In particular,
λp−1 = 1 and λp = λ. Also, since Zp has characteristic p, it follows that
every pth term of Sn = tnλn−1 will be 0. Furthermore, if t 6= 0, we see
that the terms S1 , S2 , . . . , Sp−1 are not zero. The term Sp = tpλp−1 = 0
and the term Sp+1 = t(p + 1)λp = tλ, which gives us our initial conditions,
multiplied by λ. This means that the next p terms of the sequence will
be the same as the first p terms multiplied by λ. Similarly, S2p = 0 and
S2p+1 = t(2p + 1)λ2p = tλ2 . So, again, the next p terms are attained by
multiplying the previous p terms by λ. This will continue until we reach the
order of λ. Since λr = 1, Srp = 0 and Srp+1 = t(rp + 1)λrp = tλr = t, so we
return to the initial starting conditions. Thus, the period of the sequence
must divide rp. Since t 6= 0, and λ, λ2 , . . . , λr−1 are distinct, then the first
time the initial conditions are repeated is when n = rp, thus the period is
equal to rp.
32
MISSOURI J. OF MATH. SCI., VOL. 25, NO. 1
G-SETS AND LINEAR RECURRENCES MODULO PRIMES
We also note that each of the rp pairs of consecutive elements Sn−1 , Sn ,
where n = 1, 2, . . . , rp are distinct since
0
Sn
=
b
Sn+1
1
a
n
0
.
t
If we had repeated elements, then
n
n
0 1 1 0
0 1 2 0
=
b a
t
b a
t
for some integers n1 and n2 with 0 < n1 < n2 < rp. Since the matrix is
invertible, this would give us:
n −n
0 1 2 1 0
0
=
,
b a
t
t
which would mean we would repeat the initial conditions before rp, so
the period would be smaller than rp. Thus, the
list of rp vectors in the
0
corresponding transitive G-set, starting with
will all be distinct. Now
t
we can generate
the remaining transitive G-sets by starting with a vector
0
of the form
, where s 6= 0, that does not appear in the first transitive Gs
set. This transitive G-set will also have size rp. Continue until all p(p − 1)
of the nonzero noneigenvectors are accounted for.
Now we have the following theorem.
Theorem 4.2. If the second order recurrence Sn = aSn−1 + bSn−2 has
characteristic polynomial C(x) = x2 − ax − b with a repeated root λ of order
r, then every transitive G-set associated with a vector outside the eigenspace
has size rp.
Theorem 4.3. Let λ be a repeated root
of the characteristic polynomial
0 1
2
C(x) = x −ax−b associated with A =
. If Eλ is the eigenspace genb a
1
0
erated by
, then each coset of the form
+Eλ , where t = 1, 2, . . . , p−1,
λ
t
will lie within a single transitive G-set.
Proof. We will show that the subgroup of G generated by Ar acts transitively on each of these cosets. Hence, each coset will reside in a single
transitive G-set induced by left multiplication by A. We first note that
the characteristic polynomial of A can be written as x2 − ax − b or as
x2 − 2λx + λ2 . As such, a = 2λ and b = −λ2 , so the matrix A can also be
MISSOURI J. OF MATH. SCI., SPRING 2013
33
T. MCKENZIE, S. OVERBAY, AND R. RAY
written as
1
. It is easily shown by induction that
2λ
n
0
1
(1 − n)λn
nλn−1
An =
=
.
−λ2 2λ
−nλn+1 (n + 1)λn
0
−λ2
If v is any vector in Zp ⊕ Zp , we can show that Ar v − v is in Eλ by showing
that it is in the null space of A − λI. By direct calculation it is easily
verified that
[A − λI] [Ar − I]v = 0
since
−λ
−λ2
1 (1 − r)λr − 1
λ
−rλr+1
rλr−1
0 0
v
=
v.
(r + 1)λr − 1
0 0
Since Ar v and v differ
by an eigenvector, they are in the same coset. In
0
particular, if v =
, where t 6= 0, v is not an eigenvector, so Akr v are
t
distinct
vectors for 0 ≤ k ≤ p − 1 (see Theorem 4.2). Consequently, we
have Akr v | 0 ≤ k ≤ p − 1 = v + Eλ .
1
Since Eλ is generated by
, every element of Zp appears in the top
λ
entry exactly once and in the lower entry exactly once in the vectors of Eλ .
In other words, the elements of Zp are distributeduniformly
in the rows of
0
the vectors of Eλ . The cosets formed by adding
to the vectors in Eλ
t
merely shift the lower entries of Eλ by t, so the distribution of elements
of Zp remains uniform in the rows of the vectors in each of these cosets.
Since a particular coset of this form lies entirely within a single transitive
G-set, each such transitive G-set is the union of r of these cosets. Hence,
the transitive G-sets associated with nonzero noneigenvectors are uniformly
distributed. This leads us to the following theorem.
Theorem 4.4. Let A be the matrix associated with second order recurrence
Sn = aSn−1 + bSn−2 . If the characteristic polynomial C(x) = x2 − ax − b
has a repeated root λ then the transitive G-set induced by left multiplication
S
by A will be uniformly distributed if and only if the initial vector v = 0
S1
is not an element of the eigenspace Eλ .
In Example 2.2, the characteristic polynomial had one repeated root,
λ = 4, of order 2 in Z5 . The associated eigenspace is:
0
1
2
3
4
E4 =
,
,
,
,
.
0
4
3
2
1
34
MISSOURI J. OF MATH. SCI., VOL. 25, NO. 1
G-SETS AND LINEAR RECURRENCES MODULO PRIMES
0
, where t = 1, 2, 3, 4, to each element of the eigenspace,
t
we obtain four additional cosets of five vectors:
0
1
2
3
4
,
,
,
,
;
1
0
4
3
2
0
1
2
3
4
,
,
,
,
;
2
1
0
4
3
0
1
2
3
4
,
,
,
,
;
3
2
1
0
4
0
1
2
3
4
,
,
,
,
.
4
3
2
1
0
The twenty vectors in these four cosets, along with the original eigenspace,
cover all of Z5 ⊕ Z5 .
Note that G2 and G3 are the two transitive G-sets of nonzero noneigenvectors. Each has size 10 = 2(5) = rp. In this example, each transitive
G-set formed with vectors outside the eigenspace consists of two complete
cosets and every other element of each such transitive G-set comes from the
same coset. Since each coset is uniformly distributed, so is each corresponding transitive G-set. Thus we see that any pair of starting conditions, other
than those in the eigenspace, results in a uniformly distributed sequence
with period rp.
0
In Example 2.1, the cosets of the form
+ E3 , where t = 1, 2, 3, 4,
t
all lie within the transitive G-set H2 . In this case, the repeated eigenvalue
λ = 3 has order r = 4. This single set of nonzero noneigenvectors has
20 = 4(5) = rp elements. Any pair of initial conditions taken from H2
will yield a uniformly distributed sequence which repeats after 20 terms,
whereas sequences with initial contitions taken from H1 or H3 will produce
nonuniformly distributed sequences.
Adding the vector
5. Acknowledgments
We would like to thank the referee for a careful reading of this paper
and valuable suggestions. We would also like to thank Dr. John Burke
for introducing us to this problem several years ago. It has led to many
interesting new discoveries which we hope to continue to explore.
References
[1] M. Artin, Algebra, Prentice Hall, New Jersey, 1991.
[2] L. Kuipers and J. S. Shiue, A distribution property of the sequence of Fibonacci
numbers, The Fibonacci Quarterly, 10.4 (1972), 375–392.
MISSOURI J. OF MATH. SCI., SPRING 2013
35
T. MCKENZIE, S. OVERBAY, AND R. RAY
[3] H. Niederreiter and J. S. Shiue, Equidistribution of linear recurring sequences in
finite fields, Indag. Math., 80 (1977), 397–405.
[4] D. D. Wall, Fibonacci series modulo m, The American Mathematical Monthly, 67
(1960), 525–532.
[5] W. A. Webb and C. T. Long, Distribution modulo p of the general second order
recurrence, Atti Accad. Lincei, 58 (1975), 92–100.
MSC2010: 11B50
Key words and phrases: matrix groups, linear recurrences over Zp
Department of Mathematics, Gonzaga University, Spokane, WA
E-mail address:
[email protected]
Department of Mathematics, Gonzaga University, Spokane, WA
E-mail address:
[email protected]
Department of Mathematics, Gonzaga University, Spokane, WA
E-mail address:
[email protected]
36
MISSOURI J. OF MATH. SCI., VOL. 25, NO. 1