Generating Function
Generating Function
Wiki: Generating function utilizes a power series to contain information about a certain sequence. Mathematical manupulation on the generating function can provide information of the sequence.
Refer to excellent video on Youtube.
Let's first consider about the below generating function which stores the information of the power series \(\{a_1,a_2,\cdots,a_n\}\):
We can retrieve the value of \(a_m\) by performing:
We can obtain all the possible combination of sequence for a given power by multiplying two generating function:
We can see that the sumation of the subscript is equilavent to the power of x.
Take the dice for example, we store the probability \(p_i\) of getting \(i\) in the generating function:
And so the multiplication of two generating function leads to:
And we are lucky to find that the coefficient of this function gives us the all the possible cases at a given summation of two indices.
Another example to search all the possible combination of candies:
To solve this, just multiply the above polynomials and we can deduce the combination from the coefficients.
For more intepretation, refer to video1 and its sequel. And also refer to wiki for example apart from the generating function.
More example:
The normal generating function stores the sequence \(\{1,1,1,\cdots,1\}\):
The more general generating function stores the sequence \(\{1,a,a^2,\cdots\}\):
When \(a=1\), the above becomes the following which stores the sequence \(\{1,-1,1,-1,\cdots\}\)
The derivative of normal generating function \(\frac{1}{1-x}\) stores the sequence of \(\{1,2,3,4,\cdots\}\):
The mulplication of \(x^3\) with the normal generating function stores the sequence \(\{0,0,0,1,1,\cdots,1\}\):