Discrete Maths | Generating Functions-Introduction and Prerequisites
Discrete Maths | Generating Functions-Introduction and Prerequisites
Prerequisite - Combinatorics Basics, Generalized PnC Set 1, Set 2
Definition: Generating functions are used to represent sequences efficiently by coding the terms of a sequence as coefficients of powers of a variable (say)
Now with the formal definition done, we can take a minute to discuss why should we learn this concept.
This concept can be applied to solve many problems in mathematics. There is a huge chunk of mathematics dealing with just generating functions.
- It can be used to solve various kinds of Counting problems easily.
- It can be used to solve recurrence relations by translating the relation in terms of sequence to a problem about functions.
- It can be used to prove combinatorial identities.
In simple words generating functions can be used to translate problems about sequences to problems about functions which are comparatively easy to solve using maneuvers.
Some basic prerequisites...
Before we start let's go through some basic Combinatorics formulas.
A generating function is a âformalâ power series in the sense that we usually regard x as a placeholder rather than a number. Only in rare cases will we actually evaluate a generating function by letting x take a real number value, so we generally ignore the issue of convergence.
Note: weâll indicate the correspondence between a sequence and its generating function with a double-sided arrow.
Some Important sequences and their results...
If you want to know more about the derivation of the given sequences you may refer here
Note that all the above series is infinite. There is one peculiar result of finite series which will be very handy so it's recommended to remember these results to solve problems quickly.
An important result:
We can use these operations to get new sequences from known sequences, and new generating functions from known generating functions.
Scaling:
Multiplying a generating function by a constant scales every term in the associated sequence by the same constant.
Addition:
Adding generating functions corresponds to adding the two sequences term by term.
Right Shifting:
Differentiation:
In general, 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.
Solved Examples
Example 1: Generating Function for a Simple Sequence
Problem: Find the generating function for the sequence {1,1,1,1,âĻ}.
Solution: G(x)=1+x+x2+x3+â¯Using the formula for an infinite geometric series: G(x)=11âxâ1
Example 2: Generating Function for an Arithmetic Sequence
Problem: Find the generating function for the sequence {0,1,2,3,âĻ}.
Solution: G(x)=0+1x+2x2+3x3+⯠Using the formula: G(x)=x(1âx)2xâ
Example 3: Generating Function for a Geometric Sequence
Problem: Find the generating function for the sequence {1,2,4,8,âĻ}.
Solution: G(x)=1+2x+4x2+8x3+⯠Using the formula for an infinite geometric series with ratio 2x2x: G(x)=11â2x1â
Example 4: Sum of Binomial Coefficients
Problem: Find the generating function for the sequence {(n0),(n1),(n2),âĻ}.
Solution: G(x)=âk=0n(nk)xk=(1+x)n
Example 5: Generating Function for a Shifted Sequence
Problem: Find the generating function for the sequence {0,1,1,1,âĻ}.
Solution: G(x)=x+x2+x3+â¯â¯ Using the formula: G(x)=x1âxâ
Practice Problems on Generating Functions
- Problem 1: Find the generating function for the sequence {1,2,3,4,âĻ}
- Problem 2: Determine the generating function for the sequence {1,â1,1,â1,âĻ}.
- Problem 3: Find the generating function for the sequence {1,0,1,0,1,0,âĻ}.
- Problem 4: Derive the generating function for the sequence {1,3,5,7,âĻ}.
- Problem 5: Determine the generating function for the sequence {1,4,9,16,âĻ}.
- Problem 6: Find the generating function for the sequence {0,1,0,1,0,1,âĻ}.
- Problem 7: Derive the generating function for the sequence {1,1/2,1/4,1/8,âĻ}.
- Problem 8: Find the generating function for the sequence {1,1,0,0,1,1,0,0,âĻ}.
- Problem 9: Determine the generating function for the sequence {1,2,1,2,1,2,âĻ.}.
- Problem 10: Derive the generating function for the sequence {1,3,6,10,15,âĻ}.