0% found this document useful (0 votes)
13 views6 pages

Talk 7

The document discusses generating functions, a key concept in number theory used to solve recurrence relations, particularly focusing on the Fibonacci sequence. It introduces operations on generating functions such as scaling, addition, right shifting, and differentiation, and demonstrates how these operations can manipulate sequences. Additionally, it explores asymptotic approximations and closed forms for Fibonacci numbers derived from their generating function.

Uploaded by

taiyamxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

Talk 7

The document discusses generating functions, a key concept in number theory used to solve recurrence relations, particularly focusing on the Fibonacci sequence. It introduces operations on generating functions such as scaling, addition, right shifting, and differentiation, and demonstrates how these operations can manipulate sequences. Additionally, it explores asymptotic approximations and closed forms for Fibonacci numbers derived from their generating function.

Uploaded by

taiyamxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Generating Functions

Lily Anne Baker


February 2024

1 Introduction
Generating functions are a powerful tool in number theory that can be used to
solve recurrence relations. In this talk, I will discuss the purpose of generating
functions and how they are used. I will begin with a basic definition of
generating functions, introduce four operations on generating functions, and
explain how to find both generating and closed functions using the Fibonacci
sequence. Lastly, I will talk about asymptotic approximations of the Fibonacci
Sequence.

2 Generating Functions
Generating Functions transforms problems about sequences into problems about
functions. They do this by coding the terms of a sequence of real numbers as
coefficients of powers of a variable (for example, x) in a formal power series.
This transformation allows us to compute different operations on the formal
power series and solve problems related to the infinite sequence.

Let a0 , a1 x, a2 x2 ... be a sequence of real numbers. The generating function as-


sociated with this sequence is the formal power series:

P∞
[G(x) = n=0 an xn ]

Here are some basic examples of infinite series and their corresponding gener-
ating function.

⟨0, 0, 0, 0, ...⟩ ←→ 0 + 0x + 0x2 + 0x3 + ... = 0


⟨1, 0, 0, 0, ...⟩ ←→ 1 + 0x + 0x2 + 0x3 + ... = 1
⟨3, 2, 1, 0, ...⟩ ←→ 3 + 2x + 1x2 + 0x3 + ... = 3 + 2x + x2
Notice the pattern above.The i-th term in the sequence (indexing from 0) is the
coefficient of x in the generating function.

1
Recall that the sum of an infinite geometric series is:
1
1 + x + z 2 + z 3 + ... = 1−z

This equation does not hold when the absolute value of z ≥1.This formula gives
closed-form generating functions for a whole range of sequences. For example:

1
⟨1, 1, 1, 1, ...⟩ ←→ 1 + x + x2 + x3 + ... = 1−x
2 3 4 1
⟨1, −1, 1, −1, ...⟩ ←→ 1 − x + x − x + x − ... = 1+x
2 4 6 1
⟨1, 0, 1, 0, 1, 0, ...⟩ ←→ 1 + x + x + x + ... = 1−x2

3 Operations on Generating Functions


We can carry out all sorts of manipulations on sequences by performing math-
ematical operations on their associated generating functions. Let’s experiment
with four operations and characterize their effects in terms of sequences

3.1 Scaling

Multiplying a generating function by a constant scales every term in the asso-


ciated sequence by the same constant. For example, we noted above that:
1
⟨1, 0, 1, 0, 1, 0, ...⟩ ←→ 1 + x2 + x4 + x6 + ... = 1−x2

Multiplying the generating function by 2 gives:


2
1−x2 = 2 + 2x2 + 2x4 + 2x6 + ...
which generates the sequence:
⟨2, 0, 2, 0, 2, 0, ...⟩
In the example above, we followed the Scaling Rule:

If ⟨a0 , a1 , a2 ...⟩ ←→ F (x),


Then ⟨ca0 , ca1 , ca2 ...⟩ ←→ c · (F (x)),
Proof of Scaling Rule:
⟨ca0 , ca1 , ca2 ...⟩ ←→ ca0 + ca1 x, ca2 x2 + ...
= c · (a0 + a1 x + a2 x2 + ...)
= c · F (x)
3.2 Addition

2
Adding generating functions corresponds to adding the two sequences term by
term. For example, adding two of our earlier examples gives:
1
1, 1, 1, 1, 1, 1, ...⟩ ←→ 1−x
1
+⟨1, −1, 1, −1, 1, −1, ...⟩ ←→ 1+x

1 1 2
= ⟨2, 0, 2, 0, 2, 0, ...⟩ ←→ 1−x + 1+x = 1−x2

Proof of Addition Rule:


If:
⟨a0 , a1 , a2 ...⟩ ←→ F (x)
⟨g0 , g1 , g2 ...⟩ ←→ G(x)
Then:
⟨a0 + g0 , a1 + g1 , a2 + g2 ...⟩ ←→ F (x) + G(x)
Proof.
P∞
⟨a0 + g0 , a1 +P ←→ n=0 (an · gn )xn
g1 , a2 + g2 ...⟩ P
∞ ∞
= n=0 an xn + n=0 gn xn
=F (x) + G(x)
3.3 Right Shifting
Let’s use a simple sequence and its corresponding generating function:
1
⟨1, 1, 1, 1, ...⟩ ←→ 1−x

Now let’s right-shift the sequence by adding k leading zeros:


= ⟨0, 0, ..., 0, 1, 1, 1, 1, ...⟩ ←→ xk + xk+1 + xk+2 + xk+3 + ...
= xk · (1 + x + x2 + x3 + ...)
=xk 1−x
Evidently, adding k leading zeros to the sequence corresponds to multiplying the
generating function by xk . This holds true in general, as seen by the Right-Shift
Rule:
If
⟨a0 , a1 , a2 , ...⟩ ←→ F (x),
Then
⟨0, 0, ..., 0, a0 , a1 , a2 , ...⟩ ←→ xk · F (x)
Proof of Right-Shift Rule:
⟨0, 0, ..., 0, a0 , a1 , a2 , ...⟩ ←→ a0 xk + a1 xk+1 + a2 xk+2 + ...
=xk · (a0 + a1 x + a2 x2 + a3 x3 + ...)
=xk · F (x)
3.4 Differentiation

3
What happens when we take the derivative of a generating function? Let’s dif-
ferentiate the generating function for an infinite sequence of 1’s (as seen earlier):
d d 1
dx (1 + x + x2 + x3 + x4 + ...) = dx ( 1−x )
2 3 1
1 + 2x + 3x + 4x + ... = (1−x)2
1
⟨1, 2, 3, 4⟩ ←→ (1−x) 2

Above, we found the generating function for the sequence ⟨1, 2, 3, 4, ...⟩. In gen-
eral, differentiating a generating function has two effects on the corresponding
sequence: each term is multiplied by its index and the entire sequence is shifted
left one place.
Derivative Rule:
If

⟨a0 , a1 , a2 , a3 , ...⟩ ←→ F (x)


Then
⟨a1 , 2a2 , 3a3 , ...⟩ ←→ F ′ (x)
Proof of Derivative Rule:

⟨a1 , 2a2 , 3a3 , ...⟩ ←→ a1 + 2a2 x + 3a3 x2 + ...


d
= dx (a0 , a1 x, a2 x2 + a3 x3 + ...)
d
= dx F (x)
The Derivative Rule is very useful. In fact, there is a frequent, independent
need for each of differentiation’s two effects, multiplying terms by their index
and left-shifting one place. For example, let’s try to find the generating function
for the sequence of squares ⟨0, 1, 4, 9, 16, ...⟩. If we could start with the sequence
⟨1, 1, 1, 1, 1, ...⟩ and multiply each term by its index two times, then we’d have
the desired result. A challenge is that differentiation not only multiplies each
term by its index but also shifts the whole sequence left one place . However,
we can cancel this unwanted left shift using the following steps: Differentiate,
multiply by x, and then differentiate and multiply by x once more.

4 Fibonacci Sequence
Sometimes, we can find nice generating functions for more complicated se-
quences. For example, the Fibonacci numbers:
x
⟨0, 1, 1, 2, 3, 5, 8, 13, 21, ...⟩ ←→ 1−x−x2

We’re going to derive this generating function and then use it to find a closed
form for the n=Fibonacci number. The definition of a closed-form expression
is a mathematical process that can be completed in a finite number of operations.

4.1 Finding Generating Function

4
Let’s begin with the definition of the Fibonacci numbers (using f):
f0 = 0
f1 = 1
fn = fn−1 + fn−2 (f orn ≥ 2)
We can expand the final clause into an infinite sequence of equation. Thus, the
Fibonacci numbers are defined by:
f0 = 0
f1 = 1
f2 = f1 + f0
f3 = f2 + f1
.
.
.

We want to define a function F(x) that generates the sequence on the left side
of the equality symbols, which are the Fibonacci numbers. Then, we can derive
a function that generates the sequence on the right.
First lets define F(x):
F (x) = f0 + f1 x + f2 x2 + f3 x3 + x4 x4 + ...
Now we need to derive a generating function for the sequence:
⟨0, 1, f1 + f0 , f2 + f1 , f3 + f2 , ...⟩
One approach is to break this into a sum of three sequences, which we can do
using three different generating functions and applying the Addition Rule

After applying the addition rule, we get:


F (x) = x + xF (x) + x2 F (x)
x
=F (x) = 1−x−x 2

4.2 Finding a Closed form


If we can find a generating function for a sequence, then we can often find a
closed form for the n-th coefficient (not always), which can be very useful. For
x
example, a closed form for the coefficient of xn in the power series for 1−x−x 2

would be an explicit formula for the n-th Fibonacci number


There are several ways to extract coefficients from a generating function. For
a generating function that is a ratio of polynomials, we can use the method
of partial fractions. Let’s try this with the generating function for Fibonacci
numbers. First we factor the denominator:
1 − x − x2 = (1 − α1 x)(1 − α2 x)
√ √
where α1 = 12 (1 + 5) and α2 = 12 (1 − 5). Next, we find A1 and A2 which
satisfy:

5
x A1 A2
1−x−x2 = 1−α1 x + 1−α2 x

We do this by plugging in various values of x to generate linear equations in A1


and A2 . We can find A1 and A2 by solving a linear system. This gives:
1 √1
A1 = α1 −α2 = 5
−1 −1
A2 = α1 −α2 = √
5

Substituting into the equation above gives the partial fractions expansion of
F (x):
x √1 ( 1 1
1−x−x2 = 5 1−α1 x
− 1−α2 x )

Each term in the partial fractions expansion has a simple power series given by
the geometric sum formula:
1
( 1−α 1x
= 1 + α1 x + α12 x2 + ...
1
( 1−α2 x = 1 + α2 x + α22 x2 + ...
When we substitute the series from above into our generating function, we end
with:
√ √
F (x) = √1 (( 1+ 5 )n − ( 1−2 5 )n )
5 2

5 Asymptotic Approximations
Asymptotic approximations are a tool used to estimate the behavior of a func-
tion/sequence as a variable approaches a certain limit (usually infinity or 0).
It’s a way of examining the behavior of a function as it gets really close to a
certain value without evaluating it at that point. The Taylor series of a function
is a common example of how to obtain the asymptotic approximation.
x
For the Fibonacci numbers, we found that the generating series is 1−x−x 2 , and

from here, we can derive the exact formula for the Fibonacci numbers. However,
one could more easily make some analytic observations: 1 − x − x2 has zeros
at sqrt5±1
2 , so the generating function F(x) has poles at those two points. From
knowing about geometric series, we know that a simple function with a pole
1
at point c is c−x = 1c · 1−x/c
1
, which is the generating function of the sequence
( 1c , c12 , c13 ... i.e. the sequence an = c(−n) . This suggests that the nth Fibonacci

−n
number might be close to some combination of ( 5±1 2 ) . We only need to
observe that one of these zeros will give an increasing sequence. The first (+1)
tends to 0, while the second (-1) is increasing and will dominate, √so we expect
that asymptotically the n-th Fibonacci number should be about ( 5+1 n
2 ) up to
some scalar.

5+1
Note that 2 is the golden ratio.

You might also like