Computer algebra systems can be powerful tools for working with generating functions. In addition to stand-alone applications that run on your computer, the website WolframAlpha is capable of finding general forms of some power series representations and specific coefficients for many more. However, unless an exercise specifically suggests that you use a computer algebra system, we strongly encourage you to solve the problem by hand. This will help you develop a better understanding of how generating functions can be used.

For all exercises in this section, “generating function” should be taken to mean “ordinary generating function.” Exponential generating functions are only required in exercises specifically mentioning them.

##### 1

For each finite sequence below, give its generating function.

1. $1, 4, 6, 4, 1$

2. $1,1,1,1,1,0,0,1$

3. $0,0,0,1,2,3,4,5$

4. $1,1,1,1,1,1,1$

5. $3,0,0,1,-4,7$

6. $0,0,0,0,1,2,-3,0,1$

##### 2

For each infinite sequence suggested below, give its generating function in closed form, i.e., not as an infinite sum. (Use the most obvious choice of form for the general term of each sequence.)

1. $0,1,1,1,1,1,\dots$

2. $1,0,0,1,0,0,1,0,0,1,0,0,1,\dots$

3. $1,2,4,8,16,32,\dots$

4. $0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,\dots$

5. $1,-1,1,-1,1,-1,1,-1,1,-1,\dots$

6. $\displaystyle 2^8,2^7\binom{8}{1}, 2^6\binom{8}{2},\dots,\binom{8}{8},0,0,0,\dots$

7. $1,1,1,0,0,1,1,1,1,1,1,1,1,1,\dots$

8. $0,0,0,1,2,3,4,5,6,\dots$

9. $3,2,4,1,1,1,1,1,1,\dots$

10. $0,2,0,0,2,0,0,2,0,0,2,0,0,2,\dots$

11. $6,0,-6,0,6,0,-6,0,6,\dots$

12. $\displaystyle 1,3,6,10,15,\dots,\binom{n+2}{2},\dots$

##### 3

For each generating function below, give a closed form for the $n^{\text{th} }$ term of its associated sequence.

1. $(1+x)^{10}$

2. $\displaystyle \frac{1}{1-x^4}$

3. $\displaystyle \frac{x^3}{1-x^4}$

4. $\displaystyle \frac{1-x^4}{1-x}$

5. $\displaystyle \frac{1+x^2-x^4}{1-x}$

6. $\displaystyle \frac{1}{1-4x}$

7. $\displaystyle \frac{1}{1+4x}$

8. $\displaystyle \frac{x^5}{(1-x)^4}$

9. $\displaystyle \frac{x^2+x+1}{1-x^7}$

10. $\displaystyle 3x^4 + 7x^3 -x^2 + 10 + \frac{1}{1-x^3}$

##### 4

Find the coefficient on $x^{10}$ in each of the generating functions below.

1. $(x^3+x^5+x^6)(x^4+x^5+x^7) (1+x^5+x^{10}+x^{15}+\cdots)$

2. $(1+x^3) (x^3+x^4+x^5+\cdots)(x^4+x^5+x^6+x^7+x^8+\cdots)$

3. $(1+x)^{12}$

4. $\displaystyle\frac{x^5}{1-3x^5}$

5. $\displaystyle\frac{1}{(1-x)^3}$

6. $\displaystyle\frac{1}{1-5x^4}$

7. $\displaystyle\frac{x}{1-2x^3}$

8. $\displaystyle\frac{1-x^{14}}{1-x}$

##### 5

Find the generating function for the number of ways to create a bunch of $n$ balloons selected from white, gold, and blue balloons so that the bunch contains at least one white balloon, at least one gold balloon, and at most two blue balloons. How many ways are there to create a bunch of $10$ balloons subject to these requirements?

##### 6

A volunteer coordinator has $30$ identical chocolate chip cookies to distribute to six volunteers. Use a generating function (and computer algebra system) to determine the number of ways she can distribute the cookies so that each volunteer receives at least two cookies and no more than seven cookies.

##### 7

Consider the inequality \begin{equation*} x_1+x_2+x_3+x_4\leq n \end{equation*} where $x_1,x_2,x_3,x_4,n\geq 0$ are all integers. Suppose also that $x_2\geq 2\text{,}$ $x_3$ is a multiple of $4\text{,}$ and $0\leq x_4\leq 3\text{.}$ Let $c_n$ be the number of solutions of the inequality subject to these restrictions. Find the generating function for the sequence $\{c_n\colon n\geq 0\}$ and use it to find a closed formula for $c_n\text{.}$

##### 8

Find the generating function for the number of ways to distribute blank scratch paper to Alice, Bob, Carlos, and Dave so that Alice gets at least two sheets, Bob gets at most three sheets, the number of sheets Carlos receives is a multiple of three, and Dave gets at least one sheet but no more than six sheets of scratch paper. Without finding the power series expansion for this generating function (or using a computer algebra system!), determine the coefficients on $x^2$ and $x^3$ in this generating function.

##### 9

What is the generating function for the number of ways to select a group of $n$ students from a class of $p$ students?

##### 10

Using generating functions, find a formula for the number of different types of fruit baskets containing of $n$ pieces of fruit chosen from pomegranates, bananas, apples, oranges, pears, and figs that can be made subject to the following restrictions:

• there are either $0$ or $2$ pomegranates,
• there is at least $1$ banana,
• the number of figs is a multiple of $5\text{,}$
• there are at most $4$ pears, and
• there are no restrictions on the number of apples or oranges.

How many ways are there to form such a fruit basket with $n=25$ pieces of fruit?

##### 11

Using generating functions, find the number of ways to make change for a $$100$ bill using only dollar coins and$$1\text{,}$ $$2\text{,}$ and$$5$ bills.

Hint
##### 12

A businesswoman is traveling in Belgium and wants to buy chocolates for herself, her husband, and their two daughters. A store has dark chocolate truffles (€ 10/box), milk chocolate truffles (€ 8/box), nougat-filled chocolates (€ 5/box), milk chocolate bars (€ 7/bar), and 75% cacao chocolate bars (€ 11/bar). Her purchase is to be subject to the following:

• Only the daughters like dark chocolate truffles, and her purchase must ensure that each daughter gets an equal number of boxes of them (if they get any).

• At least two boxes of milk chocolate truffles must be purchased.

• If she buys any boxes of nougat-filled chocolates, then she buys exactly enough that each family member gets precisely one box of them.

• At most three milk chocolate bars may be purchased.

• There are no restrictions on the number of 75% cacao chocolate bars.

Let $s_n$ be the number of ways the businesswoman can spend exactly € $n$ (not buy $n$ items!) at this chocolate shop. Find the generating function for the sequence $\{s_n\colon n\geq 0\}\text{.}$ In how many ways can she spend exactly € 100 at the chocolate shop? (A computer algebra system will be helpful for finding coefficients.)

##### 13

Bags of candy are being prepared to distribute to the children at a school. The types of candy available are chocolate bites, peanut butter cups, peppermint candies, and fruit chews. Each bag must contain at least two chocolate bites, an even number of peanut butter cups, and at most six peppermint candies. The fruit chews are available in four different flavors—lemon, orange, strawberry, and cherry. A bag of candy may contain at most two fruit chews, which may be of the same or different flavors. Beyond the number of pieces of each type of candy included, bags of candy are distinguished by using the flavors of the fruit chews included, not just the number. For example, a bag containing two orange fruit chews is different from a bag containing a cherry fruit chew and a strawberry fruit chew, even if the number of pieces of each other type of candy is the same.

1. Let $b_n$ be the number of different bags of candy with $n$ pieces of candy that can be formed subject to these restrictions. Find the generating function for the sequence $\{b_n\colon n\geq 0\}\text{.}$

2. Suppose the school has $400$ students and the teachers would like to ensure that each student gets a different bag of candy. However, they know there will be fights if the bags do not all contain the same number of pieces of candy. What is the smallest number of pieces of candy they can include in the bags that ensures each student gets a different bag of candy containing the same number of pieces of candy?

##### 14

Make up a combinatorial problem (similar to those found in this chapter) that leads to the generating function \begin{equation*} \frac{(1+x^2+x^4)x^2}{(1-x)^3(1-x^3)(1-x^{10})}. \end{equation*}

##### 15

Tollbooths in Illinois accept all U.S. coins, including pennies. Carlos has a very large supply of pennies, nickels, dimes, and quarters in his car as he drives on a tollway. He encounters a toll for $$0.95$ and wonders how many different ways he could use his supply of coins to pay the toll without getting change back. (A computer algebra system is probably the best way to get the required coefficient once you have a generating function, since you're not asked for the coefficient on $x^n\text{.}$) 1. Use a generating function and computer algebra system to determine the number of ways Carlos could pay his$$0.95$ toll by dropping the coins together into the toll bin. (Assume coins of the same denomination cannot be distinguished from each other.)

2. Suppose that instead of having a bin into which motorists drop the coins to pay their toll, the coins must be inserted one-by-one into a coin slot. In this scenario, Carlos wonders how many ways he could pay the $$0.95$ toll when the order the coins are inserted matters. For instance, in the previous part, the use of three quarters and two dimes would be counted only one time. However, when the coins must be inserted individually into a slot, there are $10=C(5,2)$ ways to insert this combination. Use an exponential generating function and computer algebra system to determine the number of ways that Carlos could pay the$$0.95$ toll when considering the order the coins are inserted.

##### 16

List the partitions of $9\text{.}$ Write a D next to each partition into distinct parts and an O next to each partition into odd parts.

##### 17

Use generating functions to find the number of ways to partition $10$ into odd parts.

##### 18

What is the smallest integer that can be partitioned in at least $1000$ ways? How many ways can it be partitioned? How many of them are into distinct parts? (A computer algebra system will be helpful for this exercise.)

##### 19

What is the generating function for the number of partitions of an integer into even parts?

##### 20

Find the exponential generating function (in closed form, not as an infinite sum) for each infinite sequence $\{a_n\colon n\geq 0\}$ whose general term is given below.

1. $a_n = 5^n$

2. $a_n = (-1)^n2^n$

3. $a_n = 3^{n+2}$

4. $a_n = n!$

5. $a_n = n$

6. $a_n = 1/(n+1)$

##### 21

For each exponential generating function below, give a formula in closed form for the sequence $\{a_n\colon n\geq 0\}$ it represents.

1. $e^{7x}$

2. $x^2 e^{3x}$

3. $\displaystyle \frac{1}{1+x}$

4. $e^{x^4}$

##### 22

Find the coefficient on $x^{10}/{10!}$ in each of the exponential generating functions below.

1. $e^{3x}$

2. $\displaystyle\frac{e^x-e^{-x}}{2}$

3. $\displaystyle\frac{e^x+e^{-x}}{2}$

4. $xe^{3x}-x^2$

5. $\displaystyle\frac{1}{1-2x}$

6. $e^{x^2}$

##### 23

Find the exponential generating function for the number of strings of length $n$ formed from the set $\{a,b,c,d\}$ if there must be at least one $a$ and the number of $c$'s must be even. Find a closed formula for the coefficients of this exponential generating function.

##### 24

Find the exponential generating function for the number of strings of length $n$ formed from the set $\{a,b,c,d\}$ if there must be at least one $a$ and the number of $c$'s must be odd. Find a closed formula for the coefficients of this exponential generating function.

##### 25

Find the exponential generating function for the number of strings of length $n$ formed from the set $\{a,b,c,d\}$ if there must be at least one $a\text{,}$ the number of $b$'s must be odd, and the number of $d$'s is either $1$ or $2\text{.}$ Find a closed formula for the coefficients of this exponential generating function.

##### 26

Find the exponential generating function for the number of alphanumeric strings of length $n$ formed from the $26$ uppercase letters of the English alphabet and $10$ decimal digits if

• each vowel must appear at least one time;

• the letter $T$ must appear at least three times;

• the letter $Z$ may appear at most three times;

• each even digit must appear an even number of times; and

• each odd digit must appear an odd number of times.

##### 27

Consider the inequality \begin{equation*} x_1+x_2+x_3+x_4\leq n \end{equation*} where $x_1,x_2,x_3,x_4,n\geq 0$ are all integers. Suppose also that $x_2\geq 2\text{,}$ $x_3$ is a multiple of $4\text{,}$ and $1\leq x_4\leq 3\text{.}$ Let $c_n$ be the number of solutions of the inequality subject to these restrictions. Find the generating function for the sequence $\{c_n\colon n\geq 0\}$ and use it to find a closed formula for $c_n\text{.}$

Hint