Definition : Generating functions are used to represent sequences efficiently by coding the terms of a sequence as coefficients of powers of a variable (say) in a formal power series.
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 formula.
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.
of real numbers is the infinite series:
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:
- Operation on generating Functions:
- Right Shift
We can use these operations to get new sequences from known sequences, and new generating functions from known generating functions.
Multiplying a generating function by a constant scales every term in the associated sequence by the same constant.
Adding generating functions corresponds to adding the two sequences term by term.
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.
What sequence is represented by the following series :
SolutionBy now you must have got this, the coefficient of a0 = 1, a1 = 0, a2 = 4, a3 = 0, a4 = 1, a5 = 1/999, a6 = 100.
So sequence is:
From the perspective of GATE CS examination, problems from this topic are asked almost every year and the problems can easily be solved just by knowing the basics.
So, with this done, from the next post, we may start with some interesting Counting Problems and solve them with this approach. We will also see some previous GATE problems.
Next, we’ll see some problems based on counting and some problems based on coefficient extraction.
Kenneth H Rosen: Discrete Mathematics and Its Applications 6th [Chapter 2.4, 6.4]
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.