Difference between revisions of "Generating function"
Mathlegend27 (talk | contribs) |
Mathlegend27 (talk | contribs) |
||
Line 11: | Line 11: | ||
== Convolutions == | == Convolutions == | ||
Suppose we have the sequences <math>a_0, a_1, a_2, ...</math> and <math>b_0, b_1, b_2, ...</math>. We can create a new sequence, called the convolution of <math>a</math> and <math>b</math>, defined by <math>c_n = a_0b_n + a_1b_{n-1} + ... + a_nb_0</math>. Generating functions allow us to represent the convolution of two sequences as the product of two power series. If <math>A</math> is the generating function for <math>a</math> and <math>B</math> is the generating function for <math>b</math>, then the generating function for <math>c</math> is <math>AB</math>. | Suppose we have the sequences <math>a_0, a_1, a_2, ...</math> and <math>b_0, b_1, b_2, ...</math>. We can create a new sequence, called the convolution of <math>a</math> and <math>b</math>, defined by <math>c_n = a_0b_n + a_1b_{n-1} + ... + a_nb_0</math>. Generating functions allow us to represent the convolution of two sequences as the product of two power series. If <math>A</math> is the generating function for <math>a</math> and <math>B</math> is the generating function for <math>b</math>, then the generating function for <math>c</math> is <math>AB</math>. | ||
+ | |||
+ | == Simple Exercises == | ||
+ | |||
+ | 1. There are three baskets on the ground: one has 2 purple eggs, one has 2 green eggs, and one has 3 white eggs. Eggs of the same color are indistinguishable. In how many ways can I choose 4 eggs from the baskets? | ||
+ | |||
+ | Solution for problem 1: The generating function for the first basket is <math>1+x+x^2</math>, since there is one way to choose 0 purple eggs (do nothing), 1 way to choose 1 purple egg (since eggs are indistinguishable), and 1 way to choose 2 purple eggs. In a similar fashion the generating function for the green egg basket is <math>1+x+x^2</math> and the generating function for the white egg basket is <math>1+x+x^2+x^3</math>. Now to find the number of ways to pick eggs from multiple baskets, just simply multiply the functions together, getting <math>1+3x+6x^2+8x^3+8x^4+6x^5+3x^6+x^7</math>. We want the number of ways to choose 4 eggs, so we just need to look at the coefficient of <math>x^4</math> and see that there are 8 ways to choose 4 eggs. | ||
== See also == | == See also == |
Revision as of 09:55, 9 November 2017
The idea behind generating functions is to create a power series whose coefficients, , give the terms of a sequence which is of interest. Therefore the power series (i.e. the generating function) is and the sequence is .
Simple Example
If we let , then we have .
This function can be described as the number of ways we can get heads when flipping different coins.
The reason to go to such lengths is that our above polynomial is equal to (which is clearly seen due to the Binomial Theorem). By using this equation, we can rapidly uncover identities such as (let ), also .
Convolutions
Suppose we have the sequences and . We can create a new sequence, called the convolution of and , defined by . Generating functions allow us to represent the convolution of two sequences as the product of two power series. If is the generating function for and is the generating function for , then the generating function for is .
Simple Exercises
1. There are three baskets on the ground: one has 2 purple eggs, one has 2 green eggs, and one has 3 white eggs. Eggs of the same color are indistinguishable. In how many ways can I choose 4 eggs from the baskets?
Solution for problem 1: The generating function for the first basket is , since there is one way to choose 0 purple eggs (do nothing), 1 way to choose 1 purple egg (since eggs are indistinguishable), and 1 way to choose 2 purple eggs. In a similar fashion the generating function for the green egg basket is and the generating function for the white egg basket is . Now to find the number of ways to pick eggs from multiple baskets, just simply multiply the functions together, getting . We want the number of ways to choose 4 eggs, so we just need to look at the coefficient of and see that there are 8 ways to choose 4 eggs.