Combinatorics
2.6 Generating Functions
2.6.5 Recurrence Relations
(a) Find generating functions in the form of rational functions for the Perrin sequence and the Padovan sequence.
(b) Prove thatak=rk+αk+αk, wherer,α, andαare the three complex roots ofx3−x−1. Conclude thatak∼rk.
The Perrin sequence has an interesting property: Ifpis a prime number, then pdivides thepth term in the Perrin sequence,p| ap. This was first noted by Lucas in 1878 [192–194] (perhaps Lucas would have been interested in Exercise 6 of Section 2.6.3). Thus we obtain a test for composite numbers:
Ifndoes not dividean, thennis not prime. Unfortunately, the converse is false: There are infinitely many compositenwith the property thatn|an. This was proved by Grantham [137].
10. In the children’s game of hopscotch, a player hops across an array of squares drawn on the ground, landing on only one foot whenever there is just one square at a position, and landing on both feet when there are two. If ev- ery position has either one or two squares, how many different hopscotch games have exactlyn squares? Figure 2.3 shows the five different hop- scotch games having four squares.
FIGURE 2.3. Hopscotch games with four squares.
11. Use a combinatorial argument and Exercise 10 to prove that Fn =
k
n−k−1 k
.
1. Only one disk may be moved at a time.
2. Disks can be placed only on one of the three poles.
3. A larger disk cannot be placed on a smaller one.
How many moves are required to move the entire stack ofkdisks onto another pole? Letak denote this number. Clearly,a1= 1. To movekdisks, we must first move thek−1top disks to one of the other poles, then move the bottom disk to the third pole, then move the stack ofk−1disks to that pole, soak= 2ak−1+ 1 fork≥1. Thus,a2= 3,a3= 7,a4= 15, and it appears thatak= 2k−1.
We can certainly verify this formula by induction, but we wish to show how recurrences of this form can be solved by using generating functions. Consider the more general recurrence
ak =bak−1+c, k≥1,
wherebandcare constants. This is a linear recurrence relation, sinceakis a linear function of the preceding values of the sequence. (The Fibonacci recurrence is also a linear recurrence relation.) Ifcis zero, we call the recurrence homogeneous;
otherwise, it is inhomogeneous.
LetG(x)be the generating function for{ak}. Then G(x) =
k≥0
akxk
=a0+
k≥1
bak−1xk+cxk
=a0+bx
k≥0
akxk+cx
k≥0
xk
=a0+bxG(x) + cx 1−x, and so
G(x) = cx
(1−bx)(1−x)+ a0
1−bx. Assumingb= 1, we compute
cx
(1−bx)(1−x) = c b−1
1
1−bx− 1 1−x
,
so
G(x) =
a0+ c b−1
1 1−bx
− c b−1
1 1−x
=
a0+ c b−1
k≥0
bkxk− c b−1
k≥0
xk,
and therefore
ak=
a0+ c b−1
bk− c
b−1. (2.42)
For example, to find the number of moves needed to solve the Tower of Hanoi puzzle, we seta0 = 0,b = 2, andc = 1to obtainak = 2k−1. Also, if we set b=−12 andc= 2, we find thatak = (−1)k(a0−43)/2k+43, soak approaches
4
3 askgrows large, independent of the initial valuea0.
We conclude with a short list of useful generating functions. Since 1
1−x=
k≥0
xk, (2.43)
we differentiate both sides to find that 1
(1−x)2 =
k≥1
kxk−1,
and so x
(1−x)2 =
k≥0
kxk. (2.44)
Thus we obtain a closed form for the generating function of the identity sequence {k}. We take up the problem of determining a generating function for{kn}, for any fixed positive integern, in Section 2.8.5.
Finally, we integrate both sides of (2.43) to obtain the generating function for {1/k}:
−ln(1−x) =
k≥1
xk
k . (2.45)
Exercises
1. Find a recurrence relation for the maximal number of regions of the plane separated bykstraight lines, then solve it.
2. Solve forakin terms ofa0and the other parameters in each of the following recurrence relations.
(a) ak=ak−1+c.
(b) ak=bak−1+cbk.
(c) ak=bak−1+crk, assumingb=r.
(d) ak=bak−1+crk+d, assumingb∈ {1, r}.
(e) ak=bak−1+ck, assumingb= 1.
(f) ak=bak−1+ck+d, assumingb= 1.
3. Find a closed form for the generating function of the sequence{k2}k≥0.
4. Letvndenote the number of ways that3ndifferent people can split up into nthree-person teams for a volleyball tournament, and letv0 = 1. Assume that team members are unordered, so the team{a, b, c}is the same as the team{c, a, b}, and assume that the teams are unordered, so putting{a, b, c} on the first team and{d, e, f}on the second is the same as putting{d, e, f} on the first team and{a, b, c}on the second. Determine a recurrence rela- tion forvn, then use it to computev4.
5. Letdkdenote the minimal degree of a polynomial with{0,1}coefficients that is divisible by(x+ 1)k. For example, certainlyd1= 1, sincef1(x) = x+ 1has the required properties, andd2≤4, sincef2(x) = (x+ 1)(x3+ 1) =x4+x3+x+ 1is permissible (in fact,d2= 4).
(a) Determine an upper bound ond3 by multiplyingf2(x)by a suitable binomial of the formxr+ 1, choosingras small as possible. Then iterate this process to obtain upper bounds ford4andd5.
(b) Observe that one can obtain an upper bound ondkin general by con- structing a polynomial of the form
fk(x) = k i=1
(xri+ 1)
for a judiciously selected sequence{ri}. Describe how to calculate {ri}, and compute the values of this sequence fori≤7.
(c) Determine a linear, homogeneous recurrence relation for the sequence {ri}.
(d) Compute a closed formula forri. (e) Determine an upper bound fordk.
6. A binary sequence is a sequence in which each term is0or1. Determine a recurrence relation for the number of binary sequences of lengthnthat do not contain two adjacent1s, then find a simple expression for this number.
7. Lettndenote the number of binary sequences of lengthnthat do not con- tain three adjacent 1s.
(a) Determine a recurrence relation fortn, and enough initial values to generate the sequence.
(b) Determine a closed form for the generating function T(x) =
n≥0
tnxn.
(c) Definet∗n by t∗0 = t∗1 = 0,t∗2 = 1, and t∗n = tn−3 forn ≥ 3.
Determine a closed form forT∗(x) =
n≥0t∗nxn. The numbers{t∗n} are known as the tribonacci numbers.
8. For a fixed positive integerm, letsm,ndenote the number of binary se- quences of lengthnthat do not containmadjacent1s.
(a) Determine a recurrence relation innforsm,n, and enough initial val- ues to generate the sequence.
(b) Show that the generating functionSm(x)for{sn,m}n≥0is Sm(x) = 1−xm
xm+1−2x+ 1.
Hint: First define a sequences∗m,nfromsm,nin the same manner as Exercise 7c. Then find its generating functionS∗m(x), and use this to determineS(x). The numbers{s∗m,n}n≥0are known as the general- ized Fibonacci numbers of orderm, or them-generalized Fibonacci numbers.