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.
- PDNF and PCNF in Discrete Mathematics
- Generating regular expression from Finite Automata
- Mathematics | Generating Functions - Set 2
- Linear Congruence method for generating Pseudo Random Numbers
- Multiplicative Congruence method for generating Pseudo Random Numbers
- Additive Congruence method for generating Pseudo Random Numbers
- Discrete Mathematics | Types of Recurrence Relations - Set 2
- Discrete Mathematics | Representing Relations
- Discrete Mathematics | Hasse Diagrams
- Last Minute Notes – Discrete Mathematics
- Maths Commands in LaTeX
- Univariate, Bivariate and Multivariate data and its analysis
- Difference between Stop and Wait, GoBackN and Selective Repeat
- Difference between Stop and Wait protocol and Sliding Window protocol
- Stop and Wait protocol, its problems and solutions
- Analysis and Design of Combinational and Sequential circuits
- Data Structures and Algorithms | Set 1
- Data Structures and Algorithms | Set 3
- Data Structures and Algorithms | Set 2
- Data Structures and Algorithms | Set 5
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : VaibhavRai3