Discrete numeric
function and
Generating function
Discrete Numeric Function
Generating Function
Generating function provide an alternative way for representing and studying numeric
functions and for solving recurrence relations as well as combinatorial problems.
Let (𝒂𝟎 , 𝒂𝟏 , 𝒂𝟐 , ….. 𝒂𝒓 , …) be a numeric function a. Then the infinite series in terms of a
parameter z,
𝐀 𝒛 = 𝒂𝟎 + 𝒂𝟏 𝒛 + 𝒂𝟐 𝒛𝟐 ….. 𝒂𝒓 𝒛𝒓 + ……. (1)
Is called generating function of the numeric function a.
or
If (𝒂𝟎 , 𝒂𝟏 , 𝒂𝟐 , ….. 𝒂𝒓 , …) is a sequence of real or complex numbers, then the power series
given by
𝐀 𝒛 = σ∞ 𝒂
𝒓=𝟎 𝒓 𝒛𝒓 = 𝒂 + 𝒂 𝒛 + 𝒂 𝒛𝟐 ….. 𝒂 𝒛𝒏 + ……. ..
𝟎 𝟏 𝟐 𝒏
Is called the Generating function for the given sequence.
Example: the generating function of the numeric function (1, 21 , 22 , 23 ,……..)
𝐀 𝒛 = σ∞ 𝒓 𝟐 𝒏
𝒓=𝟎 𝒂𝒓 𝒛 = 𝒂𝟎 + 𝒂𝟏 𝒛 + 𝒂𝟐 𝒛 ….. 𝒂𝒏 𝒛 + ……. ..
= 1+2𝑧 + 22 𝑧 2 …..2𝑟 𝑧 𝑟 + …… (2)
Since the series (2) can be written as
1
1−2𝑧
Therefore the numeric function (1, 21 , 22 , 23 ,……..) can be represented as
1
1 − 2𝑧
Geometric Series
Gn ::= 1+ x + x2 + …… + xn-1 + xn + ……
What is the closed form expression of Gn?
Gn ::= 1+ x + x2 + …… + xn-1 + xn + ……
xGn = x+x +x +2 3 …… +x + x
n n+1
+ ……
Gn−xGn= 1
1-x n+1
Gn =
1-x
More Examples
These are all closed form generating functions.
Theorem: Let a, b and c be numeric functions and let A(z), B(z) and C(z) be respectively
the generating functions of a, b and c then
(i) If 𝑏𝑟 = 𝛼𝑎𝑟 , for some constant 𝛼, then B(z) =𝛼 A(z)
(ii) If 𝑐𝑟 = 𝑎𝑟 + 𝑏𝑟 , then C(z) = A(z)+B(z)
(iii) If c is the convolution of a and b; i.e. c = a*b, then C(z) = A(z)B(z)
(iv) If 𝑏𝑟 = 𝛼 𝑟 𝑎𝑟 , where is a constant, then B(z) = A(𝛼z)
Theorem: Let A(z) be the generating function of the numeric function a=
1
(𝑎0 , 𝑎1 , 𝑎2 , ….. 𝑎𝑟 , …). Then A(z) is the generating function of the numeric function
(1−𝑧)
b which is accumulated sum of a.
Example: Find the generating function of the following series 1, 1, 1, 1, 1, 1, 1.
Solution: The given series is directed as
𝑎0 = 1, 𝑎1 = 1, 𝑎2 = 1, 𝑎3 = 1, 𝑎4 = 1, 𝑎5 = 1, 𝑎6 = 1.
The required generating function is given by
a 𝑧 = σ∞ 𝑎
𝑟=0 𝑟 𝑧 𝑟 = 𝑎 + 𝑎 𝑧 + 𝑎 𝑧2 + 𝑎 𝑧3+ 𝑎 𝑧4+ 𝑎 𝑧5 + 𝑎 𝑧6
0 1 2 3 4 5 6
= 1+𝑧 + 𝑧 2 + 𝑧 3 + 𝑧 4 + 𝑧 5 + 𝑧 6
1−𝑧 7
=
1−𝑧
Example: Find the generating function of the following series
1, -1, 1, -1, 1, -1,………………..
Solution: The given series is directed as
𝑎0 = 1, 𝑎1 = −1, 𝑎2 = 1, 𝑎3 = −1, …………………..
The required generating function is given by
a 𝑧 = σ∞
𝑟=0 𝑎𝑟 𝑧 𝑟 = 𝑎 + 𝑎 𝑧 + 𝑎 𝑧 2 + 𝑎 𝑧 3 + 𝑎 𝑧 4 +……………………
0 1 2 3 4
1
= 1−𝑧 + 𝑧 2 − 𝑧 3 +…………………..=
1+𝑧
=(1 + 𝑧)−1
GENERATING
FUNCTION FOR
THE SEQUENCE
OF REAL
NUMBERS
If (𝑎0 , 𝑎1 , 𝑎2 , ….. 𝑎𝑟 , …) is a sequence of real or complex numbers, then the power series
given by
A z = σ∞ 𝑎
𝑟=0 𝑟 𝑧 𝑟 = 𝑎 , +𝑎 𝑧 + 𝑎 𝑧 2 ….. 𝑎 𝑧 𝑛 + ……. ..
0 1 2 𝑛
Is called the Generating function for the given sequence.
Multiplying a generating function by a constant
=> scales every term in the associated sequence by the same constant.
Multiply the generating function by 2 gives
which generates the sequence:
Addition
Adding generating functions corresponds to adding sequences term by term.
The same result as in the previous slide.
Right Shift
How to generate the sequence <0, 0, …, 0, 1, 1, 1, 1, 1…>?
k zeros
k zeros
Adding k zeros multiplying xk on the generating function.
Example: Find the generating function of the following numeric function.
𝑎𝑟 = 7. 3𝑟
Solution:
The required generating function of given series 𝑎𝑟 = 7. 3𝑟 is
A 𝑧 = σ∞
𝑟=0 𝑎𝑟 𝑧 𝑟 = σ∞ 7. 3𝑟 𝑧 𝑟
𝑟=0
= 7{1+3𝑧 + (3𝑧)2 +(3𝑧)3 +…………….}
1 7
=7. =
1−3 𝑧 1−3 𝑧
Example: Determine the numeric function corresponding to the following generating
function.
2
A(z)= 2 1−4𝑧
2 2 1 1
Solution: We have A(z) = = = +
1−4𝑧 2 (1−2𝑧)(1+2𝑧) (1−2𝑧) (1+2𝑧)
The required generating function corresponding to A(z) is given by
𝑎𝑟 = 2𝑟 + (-2)𝑟 , 𝑟 ≥ 0
0, 𝑟 𝑖𝑠 𝑜𝑑𝑑
=ቊ
2𝑟+1 , 𝑟 𝑖𝑠 𝑒𝑣𝑒𝑛