# 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) 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:

- Scaling
- Addition
- Right Shift
- Differentiation

**Operation on generating Functions:**

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.

**Example:**

What sequence is represented by the following series :

**Solution**By now you must have got this, the coefficient of a_{0} = 1, a_{1} = 0, a_{2} = 4, a_{3} = 0, a_{4} = 1, a_{5} = 1/999, a_{6} = 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.

__REFERENCES:__

Kenneth H Rosen: Discrete Mathematics and Its Applications 6^{th} [Chapter 2.4, 6.4]

## Recommended Posts:

- Mathematics | Generating Functions - Set 2
- Generating regular expression from Finite Automata
- Discrete Mathematics | Representing Relations
- Discrete Mathematics | Hasse Diagrams
- Last Minute Notes – Discrete Mathematics
- PDNF and PCNF in Discrete Mathematics
- Discrete Mathematics | Types of Recurrence Relations - Set 2
- Concept Of Address Split in OS
- Concept behind Multiple Booting Guide
- Formation Of Process from Program
- Two Level Paging and Multi Level Paging in OS
- Magnetic Random Access Memory (M-RAM)
- Closure properties of Regular languages
- Basics of Signed Binary numbers of ranges of different Datatypes

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.