an introduction to ordinary generating...

26
An Introduction to Ordinary Generating Functions David Ward December 2014 1 Introduction This is a guide to help teachers introduce students to Ordinary Generating Functions (OGFs). It is written with undergraduate level student in mind who are unfamiliar with OGFs. While only minimal familiarity with polynomials and power series is required, many students find the idea of generating functions unin- tuitive. The math necessary to manipulate polynomials has been included in the appropriate sections. It is, however, not the intent of this work to teach this math in depth but rather present it in an organized fashion where it is helpful. In section 3.3 we will see the particular way in which OGFs can be used to count combinatorically. The main focus of this work is directed toward the understanding of this counting style and how it may be applied to solve many types of counting problems. It reveals a way in which many distribution, selection, and partition problems are similar. It is this insight that allows the student the finesse required to model many counting problems with OGFs. Central to this modeling process is Bracket Line counting which is introduced in section 3.1. Bracket Line counting is intuitive and visual, allowing it to clearly models counting problems. Because it also counts the same way OGFs count, we are able to stick it in-between the problem and the OGF. Basically we use Bracket Line counting to understand, set up and model the problem and then the OGF to crunch the numbers. Section 3.3 demonstrates how it is that the OGF counts the same as Bracket Line. In section 5 we apply our understanding of just how OGF count to attack several dierent types of count- ing problems. In doing so, we unearth the similarity of many wildly dierent counting problems. In short, this oers students a first way to approach and think about previously impenetrable counting problems and a good shot at modeling and solving them with OGF. This is the aim of this work. Thought-provoking questions and exercises highlighted in gray boxes are most important. They guide students to think about the core ideas of this work; what to look for to successfully model a counting problem for using OGFs. Areas nicely suited for students to explore and make their own discoveries are also pointed out. The Appendix: OGFs as Rational Functions, is included for completeness sake and as a steppingstone to further study of OGFs. It includes various helpful closed forms of power series which are useful ways to express the typical unwieldy polynomials of OGFs. 1

Upload: others

Post on 30-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • An Introduction to Ordinary Generating Functions

    David Ward

    December 2014

    1 IntroductionThis is a guide to help teachers introduce students to Ordinary Generating Functions (OGFs). It is writtenwith undergraduate level student in mind who are unfamiliar with OGFs. While only minimal familiaritywith polynomials and power series is required, many students find the idea of generating functions unin-tuitive. The math necessary to manipulate polynomials has been included in the appropriate sections. Itis, however, not the intent of this work to teach this math in depth but rather present it in an organizedfashion where it is helpful.

    In section 3.3 we will see the particular way in which OGFs can be used to count combinatorically. Themain focus of this work is directed toward the understanding of this counting style and how it may beapplied to solve many types of counting problems. It reveals a way in which many distribution, selection,and partition problems are similar. It is this insight that allows the student the finesse required to modelmany counting problems with OGFs.

    Central to this modeling process is Bracket Line counting which is introduced in section 3.1. BracketLine counting is intuitive and visual, allowing it to clearly models counting problems. Because it also countsthe same way OGFs count, we are able to stick it in-between the problem and the OGF. Basically we useBracket Line counting to understand, set up and model the problem and then the OGF to crunch thenumbers. Section 3.3 demonstrates how it is that the OGF counts the same as Bracket Line.

    In section 5 we apply our understanding of just how OGF count to attack several different types of count-ing problems. In doing so, we unearth the similarity of many wildly different counting problems. In short,this offers students a first way to approach and think about previously impenetrable counting problems anda good shot at modeling and solving them with OGF. This is the aim of this work.

    Thought-provoking questions and exercises highlighted in gray boxes are most important. They guidestudents to think about the core ideas of this work; what to look for to successfully model a countingproblem for using OGFs. Areas nicely suited for students to explore and make their own discoveries arealso pointed out.

    The Appendix: OGFs as Rational Functions, is included for completeness sake and as a steppingstoneto further study of OGFs. It includes various helpful closed forms of power series which are useful ways toexpress the typical unwieldy polynomials of OGFs.

    1

  • 2 An Ordinary Generating Function in ActionIn how many ways can you pick three different numbers between 1 and 10 such that no two are consecutive?

    The Ordinary Generating Function G(x) that models this problem is:

    G(x) = (1 + x+ x2 + x3 + x4 + x5)2(x+ x2 + x3 + x4 + x5 + x6)2

    Expanding G(x):G(x) = x2 + 4x3 + 10x4 + 20x5 + 35x6 + 56x7...

    The solution is 56, the coefficient of x7. Amazing! Shortly we will understand why this works, but itwill still be magical.

    3 Problem ! Model ! OGFAn OGF is a polynomial with a remarkable feature; its coefficients tell you the number of ways somethingcan be done. The details of exactly how many ways WHAT can be done depend on which problem the OGFis modeled after. In this section we will build our first OGF by modeling the distribution problem, "Howmany ways can you distribute 5 identical balls into three distinct boxes such that no more than two ballsare in box one, between 1 and 3 balls in box two and either 0 or 3 balls in box three?" We will first inventthe Bracket Line counting process and convince ourselves that it is capable of counting in a particular way.We will then show that this is the way our distribution problem can be counted and that it is also the sameway OGFs count. Both Bracket Line counting and OGFs can be used to solve exactly the same countingproblems. It is advantageous to model the problem with Brackets Line and crunch the numbers with OGFs.

    3.1 A Counting Process

    The Bracket Line counting process is simply a set of brackets containing numbers. Note that these are notvectors. In Bracket Line counting we count how many ways there are to select one number from eachbracket such that they sum to a given number. Consider the following set of brackets:

    2

    4012

    3

    5

    2

    4123

    3

    503

    Exercise 1: In how many ways can you take one number from each bracket such that they sum to 5?Try by drawing lines through the brackets for each possible way.

    2

    4012

    3

    5

    2

    4123

    3

    503

    How about the number of ways to sum to 7? Try it.2

    4012

    3

    5

    2

    4123

    3

    503

    How about the number of ways to sum to 4? You know you want to try it!2

    4012

    3

    5

    2

    4123

    3

    503

    Shortly we will understand what it all means but for now it is helpful to just get a feel for this type ofcounting. The following exercise is somewhat long but very helpful.

    2

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

  • Exercise 2: Develop a systematic method by which every possible combination is found by drawing linesthrough the brackets as we did in exercise 1. For each line include the sum of that combination. Hint: Thenumber of possible combinations is the product of the number of entries in each bracket. (3)(3)(2) = 18.

    Perseverance in this exercise will pay off. Remember that the goal is to develop a systematic way to ensureall 18 combinations are found. The brackets should be big enough to allow the 18 possible combinations beclearly indicated. It is sometimes helpful to do this work in stages as demonstrated below.

    Combinations beginning with 0:

    2

    6666664

    012

    3

    7777775

    2

    6666664

    123

    3

    7777775

    2

    66403

    3

    775

    sum321654

    Combinations beginning with 1:

    2

    6666664

    012

    3

    7777775

    2

    6666664

    123

    3

    7777775

    2

    66403

    3

    775

    sum432765

    Combinations beginning with 2:

    2

    6666664

    012

    3

    7777775

    2

    6666664

    123

    3

    7777775

    2

    66403

    3

    775

    sum543876

    The systematic search above can be summarized:

    1 way to sum to 1 or 8 2 ways to sum to 2 or 7 3 ways to sum to 3, 4, 5 or 6.

    3

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

  • Students will develop systematized search methods that are different. This is OK as long as everycombination is indicated by its own line through the brackets. It is important that the students convincethemselves that a systematized search of such brackets is in fact a sure-fire method to find the numberof ways to pick one entry from each bracket such that their sum is a given number. This is our BracketLine counting process.Q: What alternative counting method could be used to find all combinations of one number from eachbracket?Q: What are the advantages and disadvantages of this system?A: This system is visual and intuitive but slow and not reasonable when the number of combinations islarge. One has to also do a lot of adding throughout this process.Q: Consider what is being counted: The number of ways to pick one number from each bracket suchthat they add up to a given number. What could this count in the real world?A: It is only important that the students start thinking about the fact that the Bracket Line process doescount in this particular way. Exactly what it counts will become clearer shortly. We will see that thiscounting process corresponds to both this distribution problem and the way polynomials can be used tocount.

    3.2 Distribution Problem

    Exercise 3: How many ways can you distribute 5 identical balls into three distinct boxes such that no morethan 2 balls are in box one, between 1 and 3 balls in box two and either 0 or 3 balls in box three?

    We immediately see a connection between our brackets in Exercise 1 and this distribution problem.2

    4012

    3

    5

    2

    4123

    3

    503

    Box 1 Box 2 Box 3

    The brackets even look like boxes and the numbers in brackets one, two, three, correspond to the possiblenumber of balls allowed to be in box one, two, three, after any single distribution is made. Each possibledistribution only allows one choice from each box which is analogous to picking only one number from eachbracket. Each possible distribution of balls can be represented by a line drawn through the brackets. Thenumber of lines that sum to a given number is the same as the number of ways to distribute that givenamount of balls. Our brackets represent a picture version of our distribution problem and we can use ourBracket Line counting process to count the number of ways to make the distribution of balls in this problem.

    Q. Using Bracket Line counting, how many lines sum to 5? What does this mean.A. Three lines sum to 5 indicating that there are three ways to distribute 5 identical balls under the

    conditions stated in the problem.

    Exercise 4: Using the Bracket Line counting process, find the number of ways you can distribute 5identical balls into two distinct boxes such that each box gets at least one ball and there is an even numberof balls in the first box and an odd number of balls in the second box?

    24

    � 2

    4135

    3

    5

    Even Box Odd Box

    4

    David Ward

    David Ward

  • Q: Does the order of the brackets matter? Why or why not? How does the order of the brackets relateto the distribution problem?A: One could think of it this way. Drawing a line from left to right, first through the even bracket andthen through the odd bracket, is equivalent to distributing the balls first to the box labeled even andthen to the box labeled odd. Clearly the same distribution done in reverse would not affect the fact thatthis still counts as one of the possible distributions.Q: What do the numbers in each bracket represent in this distribution problem. Does the order of thenumbers in each bracket matter?A: The numbers in each bracket represent the choices for the number of balls allowed to be put into thatbox during any one distribution of the balls. We refer to the numbers in the brackets as entries. Thebrackets along with their entries embody the constraints posed by the problem. The order the entriesappear in the brackets does not matter.

    Exercise 5: Using Bracket Line, find the number of ways to distribute 2 identical balls into 3 distinctboxes.

    2

    4012

    3

    5

    2

    4012

    3

    5

    2

    4012

    3

    5 6 ways to distribute 2 balls

    Box 1 Box 2 Box 3

    Exercise 6: Make up a similar distribution problem and find the answer for distributing 4 balls usingBracket Line counting.

    3.3 Counting With Polynomials

    We see that our distribution problem meshes well with the Bracket Line counting process. A solution toour distribution problem required exactly the kind of counting that our Bracket Line counting process does.That is, to counts the number of ways to pick one number from each bracket such that they sum to a givenamount. In this section we will see that multiplying polynomials together can do exactly this same typeof counting. This is truly a fabulous piece of mathematics. We will soon be able to replace our BracketLine counting process and all it’s limitations with slick polynomial functions, along with all the benefits offunctions. First a demonstration.

    Consider our brackets we performed Bracket Line counting on in Exercise 2. We then used these samebrackets to model the distribution problem in Exercise 3. Once again consider these brackets and thefollowing product of polynomials: 2

    4012

    3

    5

    2

    4123

    3

    503

    (x0 + x1 + x2)(x1 + x2 + x3)(x0 + x3)

    It is obvious that these polynomial factors model, is some way, the brackets above them. We simplyused the entries of each bracket as the exponents in the polynomials. It is not so clear why one would dothis. Let’s continue. Remember, x0 = 1. Upon expanding these polynomial factors we get:

    1x1 + 2x2 + 3x3 + 3x4 + 3x5 + 3x6 + 2x7 + 1x8

    We see something curious upon comparing this expanded polynomial with the results of performingBracket Line counting on these same brackets from Exercise 2.

    1 way to sum to 1 or 8 2 ways to sum to 2 or 7 3 ways to sum to 3,4,5 or 6.

    5

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

  • It would seem that the number of ways to take one number from each bracket such that their sum is 5is equal to the coefficient of x5. Likewise the number of ways to take one number from each bracket suchthat their sum is 7 or 8 is equal to the coefficient of x7 and x8 respectively.

    In fact all the coefficients exactly correspond to the Bracket Line counting we found for these bracketsin Exercise 2!

    Q: What could it mean if this were always the case?Q: Assuming this is true, how could it be useful?Exercise 7: Lets repeat the experiment. Make up your own brackets with entries. Model polynomialsfor each bracket as we did above. Take their product and combine like terms. Now use the Bracket Linecounting process to check several coefficients.

    A simple example may look like this:

    12

    � 12

    � 01

    �3 ways to sum to 4

    (x+ x2)(x+ x2)(1 + x)

    x

    2 + 3x3 + 3x4 + x5 The coefficient of x4 is 3.

    Multiplying polynomials can get messy quickly. Smaller and few brackets work fine to illustrate thispoint.

    It seems that the coefficient of xn is, in fact, the number of ways to take one entry from each bracketsuch that they sum to n. This is truly amazing!

    Let’s take a look at why this is true.Everyone has multiplied polynomials together before, probably without much thought. This time we

    will pay special attention to the exponents throughout the multiplication process. Making the followingsubstitutions in our polynomial factors allows us to follow the exponents.

    let :(x0 + x1 + x2)(x1 + x2 + x3)(x0 + x3) = (xa1 + xa2 + xa3)(xb1 + xb2 + xb3)(xc1 + xc2).

    We now expand:(xa1 + xa2 + xa3)(xb1 + xb2 + xb3)(xc1 + xc2)

    x

    a1x

    b1x

    c1 + xa1xb1xc2 + xa1xb2xc1 + xa1xb2xc2 + xa1xb3xc1 + xa1xb3xc2+

    x

    a2x

    b1x

    c1 + xa2xb1xc2 + xa2xb2xc1 + xa2xb2xc2 + xa2xb3xc1 + xa2xb3xc2+

    x

    a3x

    b1x

    c1 + xa3xb1xc2 + xa3xb2xc1 + xa3xb2xc2 + xa3xb3xc1 + xa3xb3xc2

    x

    a1+b1+c1 + xa1+b1+c2 + xa1+b2+c1 + xa1+b2+c2 + xa1+b3+c1 + xa1+b3+c2+

    x

    a2+b1+c1 + xa2+b1+c2 + xa2+b2+c1 + xa2+b2+c2 + xa2+b3+c1 + xa2+b3+c2+

    x

    a3+b1+c1 + xa3+b1+c2 + xa3+b2+c1 + xa3+b2+c2 + xa3+b3+c1 + xa3+b3+c2

    What we have here is wonderful! Notice that the exponents in every term are of the form a+ b+ c. Thismeans that each exponent is a combination of one exponent from each polynomial factor. We can think ofeach of the polynomial factors as one of the brackets in our Bracket Line counting process. Also notice thatevery possible combination of taking the sum of one exponent from each of our three polynomial factorsis represented in these 18 terms. We can observe this or reason that there are only (3)(3)(2)=18 possiblecombinations and of the 18 combinations that we have, none are the same. Each of these 18 terms can bethought of representing one of the possible lines drawn in the Bracket Line process. By adding together oneexponent from each polynomial factor we see that these polynomials are acting on their exponents in thesame way our Bracket Line process acts on its bracket entries.

    6

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

  • Now we will substitute back the original values for exponents a, b, c so that we may sum them.

    x

    0+1+0 + x0+1+3 + x0+2+0 + x0+2+3 + x0+3+0 + x0+3+3+

    x

    1+1+0 + x1+1+3 + x1+2+0 + x1+2+3 + x1+3+0 + x1+3+3+

    x

    2+1+0 + x2+1+3 + x2+2+0 + x2+2+3 + x2+3+0 + x2+3+3

    x

    1 + x4 + x2 + x5 + x3 + x6+

    x

    2 + x5 + x3 + x6 + x4 + x7+

    x

    3 + x6 + x4 + x7 + x5 + x8

    The coefficients of each term is produced when we combine like terms. Like terms are terms with thesame power of x. In this way the coefficient tells how many terms above had their exponents sums to a givennumber. This is similar to counting up the number of ways to sum to a given number with the Bracket Lineprocess.

    x+ 2x2 + 3x3 + 3x4 + 3x5 + 3x6 + 2x7 + x8

    In the end is this hidden gem, polynomials can count the way our Bracket Line process counts. Our BracketLine process counts the number of ways to take one entry from each bracket such that they sum to a givennumber. Multiplying polynomials counts the number of ways to take one exponent from each factor suchthat they sum to a given number.

    The takeaway is this: The Bracket Line process and multiplying polynomials together can count thesame way. This means that we can replace our somewhat clumsy and limited Bracket Line process witha polynomial function that can generate in its coefficients the solutions to many distribution problems.This polynomial product is know as an Ordinary Generating Function or OGF and often written G(x).Q: How would you describe the role of the polynomial factors? How do they carry the combinatorics ofthe brackets to a solution? Is it fair to describe the combinatorics as piggybacking on the polynomialsas they are expanded? Granted it is strange math. Have you ever seen math used in this way? Napier’sinvention of multiplication by using logarithm shares a bit of this strangeness.

    Lets look at a few examples of our Bracket Line process and OGF in action.Exercise 8: In how many ways can we distribute 7 identical balls to Max and Anna such that Max gets

    an even number of balls and the Anna gets an odd number of balls but both get at least one ball?

    2

    4246

    3

    5

    2

    664

    1357

    3

    775 3 ways to sum to 7

    Max Anna

    G(x) = (x2 + x4 + x6)(x1 + x3 + x5 + x7)

    G(x) = x3 + 2x5 + 3x7 + 3x9 + 2x11 + x13

    The solution is 3, the coefficient of x7.

    7

    David Ward

    David Ward

    David Ward

  • Exercise 9: How many ways can we roll one die three times such that the sum is 5?2

    6666664

    123456

    3

    7777775

    2

    6666664

    123456

    3

    7777775

    2

    6666664

    123456

    3

    7777775

    Roll 1 Roll 2 Roll 3

    Here each bracket refers to one of the rolls. The entries in the bracket are all the possible outcomes ofthat roll.

    G(x) = (x+ x2 + x3 + x4 + x5 + x6)3

    We are interested only the three rolls summing to 5 but we can see that cubing this polynomial will result inmany terms with degrees higher than 5. If we were to expand this by hand, the amount of work is reducedby continuously dropping any terms as they became greater than degree 5.

    G(x) = (x+ x2 + x3 + x4 + x5 + x6)(x+ x2 + x3 + x4 + x5 + x6)(x+ x2 + x3 + x4 + x5 + x6) =

    x

    3 + x4 + x5 + x4 + x5 + x5 + x4 + x5 + x5 + x5 + ... =

    G(x) = x3 + 3x4 + 6x5 + ...

    The answer is 6, the coefficient of x5.Here the expansion of G(x) has 63 = 216 terms of which we only had to compute 10.Note: OGFs will always be of the form of the product of polynomials when developed from a bracket

    model. These products must be expanded and like terms combined to yield solutions in the form of thecoefficients of powers of x. Computer algebra systems are extremely useful, even necessary, for many ofthese computations. In the following exercise we make use of this technology.

    Exercise 10: How many ways can you distribute 8 copies of Lockhart’s "A Mathematicians Lament" tothree different classrooms?

    2

    666666666664

    012345678

    3

    777777777775

    2

    666666666664

    012345678

    3

    777777777775

    2

    666666666664

    012345678

    3

    777777777775

    Room 1 Room 2 Room 3

    Using Bracket Line counting we would find that 45 of the possible 83 = 512 lines sum to 8.Notice that while using brackets is a nice way to model this problem, using Bracket Line counting is a

    painful way to solve it! We will let the OGF do this work.

    OGF: G(x) = (x0 +x1 +x2 +x3 +x4 +x5 +x6 +x7 +x8)(x0 +x1 +x2 +x3 +x4 +x5 +x6 +x7 +x8)(x0 +x1 +x2 +x3 +x4 +x5 +x6 +x7 +x8)

    Or simply: G(x) = (x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8)3

    Thanks to today’s many computer algebra systems, I used Wolfram|Alpha Widget: Multiplying Polyno-mials Calculator, we get the incredible solution:

    G(x) = x0 + 3x1 + 6x2 + 10x3 + 15x4 + 21x5 + 28x6 + 36x7 + 45x8 + 52x9 + 57x10+

    +60x11 + 61x12 + 60x13 + 57x14 + 52x15 + 45x16 + 36x17 + 28x18 + 21x19+

    15x20 + 10x21 + 6x22 + 3x23 + x24

    The solution is 45, the coefficient of x8.Exercise (for teacher): Read "A Mathematicians Lament"!

    8

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

  • 4 The Entire OGFOnce a problem is modeled with brackets, one can stop thinking combinatoricaly, kick back, and let theOGF and computer algebra system do their magic! Well, almost. OGF are often quite long and can containlots of good as well as useless information in their coefficient. A combinatorial sense of both the problemand its model is still required to fully utilize this information.

    Consider the OGF just calculated in Exercise 10:

    G(x) = x0 + 3x1 + 6x2 + 10x3 + 15x4 + 21x5 + 28x6 + 36x7 + 45x8 + 52x9 + 57x10+

    +60x11 + 61x12 + 60x13 + 57x14 + 52x15 + 45x16 + 36x17 + 28x18 + 21x19+

    15x20 + 10x21 + 6x22 + 3x23 + x24

    We were interested in distributing 8 books so each bracket needed the entries from 0 to 8. If we wereinterested in distributing only 3 books, brackets with entries 0 to 3 would work.

    Q: Could one use the brackets for distributing 8 books if interested in distributing only 3 books? Why?Q: Could one use the brackets for distributing 8 books if interested in distributing more than 8 books?Hint: Think about lines drawn in the Bracket Line process that show combinations that sum to 3. Arethey affected by any entries greater than 3?A: The brackets for distributing 8 books will produce all the combinations that sum to 8 as well as all thecombinations that sum to all numbers between 0 and 8 as well. It is inherent in Bracket Line countingthat all combinations be produced. OGFs cannot be made to produce single solutions. Any line thatsums to 3 cannot go through any entry greater than 3 and is therefore unaffected by entries >3. In thiscase, we can use the brackets modeled to distribute 8 books to find the number of ways to distribute 3.Any brackets used to model the distribution of more than 8 balls must consider the additional bracketentries that would be necessary. To distribute 9 books would require the entry of 9 in all the brackets aswell.Q: What information is in the coefficients of G(x) modeled for the distribution of 0 to 8 books?A: The number of ways to distribute n books where n 8, is the coefficient of xn. All coefficients ofpowers of x that are > 8 are meaningless in this case.Q: How could you change the original problem so that all 24 coefficients are meaningful?A: One way would be to distribute 24 books with the condition that each room can not get more than8 books. This would be modeled with the same brackets but all the coefficient of xn of the OGF wouldrepresent the number of ways to distribute n books.

    Consider this slightly different versions of exercise 9 and 10.How many ways can we roll one die three times?How many ways can you distribute 6 copies of Lockhart’s "A Mathematicians Lament" to three differentclassrooms such that each room gets at least one copy?Both these problems are modeled with the exact same set of brackets and entries and therefore share thesame OGF.

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    G(x) = x3 + 3x4 + 6x5 + 10x6 + 15x7 + 21x8 + 25x9 + 27x10+

    27x11 + 25x12 + 21x13 + 15x14 + 10x15 + 6x16 + 3x17 + x18

    Q: What do the coefficients mean in each problem? A: In the die rolling problem the coefficient of xn isthe number of ways to sum to n. In the book distribution problem the coefficient of xn, for n 6, is thenumber of ways to distribute 6 books.

    9

  • Notice that all the coefficients of G(x) are meaningful for the die rolling problem whereas many aremeaningless for the book distribution problem.Q: Why is this true for these particular problems? It may be helpful to think about what causes certaincombinations (lines through the brackets) to become invalid in the book distribution problem. Thinkabout how we rewrote the similar version of this problem in order to make all the coefficients meaningful.Q: Can you form a conjecture as to why this book distribution problem creates some meaningless coeffi-cients in its OGF?Q: Can this conjecture be applied to distribution problems in a more general way?Q: Can you form a conjecture as to why all the coefficients for the die rolling problem are meaningful?Can this be made more general in any way?

    OGFs can produce a tremendous amount of combinatorial information without having to resolve theproblem each time. Lets take a look.

    Exercise 11: In how many ways can we roll one die three times such that the sum is odd? What wouldyou expect the answer to be?

    The students may suspect that the answer is half the time, out of 63 = 216 this would be 108 ways.Reasoning about the number of ways to throw three dice, each of which could be equally even or odd, wouldconfirm 108.

    How would one use OGFs to confirm that there are 108 ways? This is an important feature of OGFfor students to grasp. The OGF is unique in its power to produce every answer at once. G(x) gives usthe number of ways to sum to every possible sum for three dice, that is 3,4,5,...18. In this case we have toexpand G(x), combine like terms, and sum all the coefficients of xodd, that is x with odd exponents.

    G(x) = x3 + 3x4 + 6x5 + 10x6 + 15x7 + 21x8 + 25x9 + 27x10 + 27x11+

    25x12 + 21x13 + 15x14 + 10x15 + 6x16 + 3x17 + x18

    Here we see that the sum of the coefficients of the xodd is indeed 108.

    Q. Why are OGF well suited for this problem?In this case, the OGF gives us the number of ways to sum to every possible sum for three dice, that is3,4,5,...18. Knowing all the coefficients of xodd was necessary information to solve this problem.Q. What does the sum of all of the coefficients of G(x) represent?A: The total number of ways to do something. Here the sum of the coefficients of G(x) represents the63 = 216 possible ways to roll one die three times.Exercise 12: Make up a counting problem that requires the use of this powerful trait of OGFs.Hint: Think of a problem requiring the information of two coefficients of the OGF.For this dice problem we may ask: How often would your sum be 11 compared to 4? What are yourchances of summing to either 10 or 11? It is possible to answer these questions knowing: G(x) =x

    3+3x4+6x5+10x6+15x7+21x8+25x9+27x10+27x11+25x12+21x13+15x14+10x15+6x16+3x17+x18.The point here is for the student to make use of the fact that the OGF produce valuable combinatorialinformation in many of it’s coefficients.

    Exercise 13: Create a distribution problem with three brackets that allows for the distribution of 1 to10 balls, but not for 7 balls.

    Hint: What would this mean about the term with x7 in the expanded OGF?Hint: Start with the brackets.

    10

  • A: By playing with the bracket entries to ensure no combinations sum to 7, we find one possible set ofbrackets is:

    2

    4013

    3

    518

    � 2

    4014

    3

    5

    G(x) = (1 + x+ x3)(x+ x8)(1 + x+ x4)

    Dropping powers of x greater than 10 gives us the OGF:G(x) = x+2x2+x3+x4+2x5+x6+2x8+2x9+x10Notice that there is no x7 term because its coefficient is 0.The distribution problem may read: With 10 balls to give away, what number of balls could not be given

    to three different children under the following conditions. Bill can get either 0, 1 or 3 balls, Tom can get 1or 8 balls, and Anna can get 0, 1 or 4 balls?

    Note: Because this OGF displays the distribution information for any number of balls up to 10, it is asimple matter to see what distributions are not possible. This is a powerful way OGFs can be used, onedoes not have to calculate every possible case separately.

    Inverting a counting problem, that is working with the brackets or the OGF first, is enlightening. Thinkabout this. G(x) = (1+x+x3)(x+x8)(1+x+x4) = (1+x+x3)(x+x2 +x5 +x8 +x9 +x12). This means

    that G(x) also models the brackets2

    4013

    3

    5

    2

    666664

    1258912

    3

    777775. This is very interesting. The number of ways to distribute 1 to

    10 balls under the different conditions of these two different bracket sets is exactly the same.Q: What parallel effect did multiplying the two polynomials together have on their brackets?

    Hint: Bracket Line counting.A: Multiplying the two polynomial factors together had the same effect as combining the two boxes they

    represented as if they were one. Combining the two boxes in the sense that any combination of the oldbrackets (the sum of one entry from each bracket), is an entry in the new bracket. The new brackets countsthe number of ways the balls can be distributed to two rooms; in room one is box 1 and in room two areboxes 2 and 3.

    In its expanded form or as the product of polynomials, G(x) describes only one solution set. Combiningor factoring the polynomials of G(x) will, however, create new sets of brackets for this same solution set.Q: Could this idea be useful? How could different sets of brackets for the same solution set be interesting?Q: Is it easier to multiply polynomials together than to find different bracket sets for the same OGF? Ifone is easier than the other, could brackets and their OGFs be somehow used in security?Q: Could brackets be used in some way to factor polynomials?

    Challenge: We know that an OGF is closely related to the distribution problem it is modeled after.Q: What does it say about the distribution problem if we are able to factor an x3 out of the OGF?Q: What does it say about the OGF if the distribution problem requires at least two balls in 6 of itsboxes?Q: What do these two questions say about their respective brackets?Tweak either the problem, the brackets or the OGF and guessing at its parallel effect on the other two.This is a great exercise for the student to experiment on their own.

    Challenge Problem: With the idea of inverting the process, lets start with the following OGF: G(x) =(1 + x)n.Q: Solve your way back to a possible counting problem for G(x).A: This process should produce the following set of brackets:

    01

    � 01

    � 01

    �......

    01

    �, where we have n brackets.

    The student may end this inverted process by posing the problem: In how many ways can you distributeidentical balls into n distinct boxes where no box gets more than one ball?The challenge now is to get the student to understand the following. Distributing a ball to a bracket

    11

  • can be considered equivalent to selecting that bracket. Each bracket either gets a ball or does not geta ball, in each possible combination. The number of ways to select 5 brackets out of the n brackets isthe number of ways to distribute 5 balls to the n brackets and is the coefficient of x5 in G(x). Now thenumber of ways to distribute m balls to the n brackets is the same as the number of ways to select mbrackets out of the n brackets. This is simply n choose m and is the coefficient of xm in G(x) = (1+x)n.This is a step away from the full Binomial Theorem but clearly indicates the origin of its famouscoefficients.

    Starting with a OGF and working back to two different sets of brackets, and finally to two differentdistribution problems with the same solution set, is a wonderful way for students to make their owndiscoveries. These discoveries may not all be as grand as the Binomial Theorem but many will beinteresting, revealing and quite possibly never seen before! The student could enjoy the honor of naminga discovery.

    5 Other Counting ProblemsNow that we understand OGFs and the Bracket Line process count the same thing, it is advantageous touse both. The Bracket Line process is simple and intuitive and is best for understanding and setting up amodel of a counting problem. An OGF will be used to actually crank out an answer. Once the OGF isgleaned from our bracket model it will carry all the combinatoric information throughout the calculation ofits expansion. In short, most of the combinatorial thinking is done once we model the problem with brackets..

    So far we have intentionally stuck to one type of distribution problem where the brackets have mostlyrepresented boxes and the bracket entries represented the number of identical balls allowed in each box.This assignment of brackets and entries was somewhat intuitive, allowing the student to focus instead onhow Bracket Line and likewise OGF count. "The number of ways to select one entry from eachbracket such that they sum to a given number." It is this understanding that allows the finesse todecide exactly what in the problem the brackets and their entries should represent. In this section we willconcentrate on the art of creating the right brackets and entries to model a particular counting problem.

    Many counting problems do a good job at disguising just what the brackets and their entries shouldrepresent. A revisit to Exercise 2 will help us see two traits that all brackets and entries share. Recall thatfor any set of brackets and entries, we can systematically find all combinations of taking one entry fromeach bracket and each one of these combinations will sum to some number. Clearly this implies that theentries be numbers. It is the entries that become the exponents of x in the OGF so again, they must benumbers. In addition the bracket entries must have the same units because we need to add them together.So far we have seen the entries represent identical balls, dots on dice and identical books. Each bracketmakes a contribution to every possible combination according to its entries. This is insured in that everycombination (line through the brackets) is made up of one entry from each bracket. In short, each bracketrepresents a distinct part of every possible combination and its entries are numbers. Get it, got it, good!

    That being said, it is best to consider an example. Lets first consider our somewhat intuitive distributionproblem.

    Exercise 8 (revisit): In how many ways can we distribute 7 identical balls to Max and Anna such thatMax gets an even number of balls and Anna gets an odd number of balls, but both get at least one ball?

    Picture one of the possible combinations, that is any line through the brackets that sum to 7. Lets sayMax gets 2 balls and Anna gets 5 balls.

    O O O O O O OMax’s Balls Anna’s Balls

    The balls Max receives is a distinct piece of this combination as it is with every possible combination,even the combinations that do not sum to 7. He is only allowed even numbers of balls which the entries inhis bracket ensure. Similarly, the balls Anna receives is a distinct piece of each possible combination. Thissuggest a bracket to represent the balls Max receives and a bracket to represent the balls Anna receives.

    12

  • The entries are counting identical balls and reflect the constraints in the distribution, Max gets only evenand Anna only odd.

    2

    4246

    3

    5

    2

    664

    1357

    3

    775

    Max Anna

    Now lets look at a more involved problem.Exercise 14: In how many ways can you make change for a quarter with nickels and dimes?It is always a good idea to make a picture of one, or several, possible combination.

    5c 5c 5c 10cWe see that the combinations are made up of so many nickels and so many dimes. The only entities

    that make up the combinations are nickels and dimes. One bracket will represent nickels while another willrepresent dimes. Entries of at least five nickels and two dimes are needed to ensure our brackets will produceall possible combinations that can sum to a quarter.

    2

    6666664

    0 nickels1 nickel2 nickels3 nickels4 nickels5 nickels

    3

    7777775

    2

    40 dimes1 dime2 dimes

    3

    5

    nickels dimes

    The entries in each bracket are the allowable multiples of the entities that the bracket represents. Ourentries must share a common unit of measure so we convert to cents.

    2

    6666664

    0510152025

    3

    7777775

    2

    401020

    3

    5

    G(x) = (1 + x5 + x10 + x15 + x20 + x25)(1 + x10 + x20)

    G(x) = 1 + x5 + 2x10 + 2x15 + 3x20 + 3x25 + 2x30 + 2x35 + x40 + x45

    Our Bracket Line model will produce all possible combinations of 5 nickels and two dimes, it is only thenumber of combinations that sum to 25 that we are interested in. The answer is 3, the coefficient of x25 inour OGF.

    Note: The Problem was originally posed with nickels, dimes and quarters. It became necessary to convertto a common unit of measure (cents) for the addition of our bracket entries to make any sense. The typesof brackets are often different in a problem making some conversions necessary.Q: Think of a similar problem requiring conversions because of different bracket types?Hint: Think about packaging.A: Possible problem: How many ways can you buy 8 bars of soap if Dove soap sells as single bars, IrishSpring sells in twin packs and CVS soap sells in a four pack?

    Q: If someone said, "Distribute balls please". You might have some questions, such as:Who should I distribute them to? This is what the brackets represent.How should I give them out or in what fashion should I allocate the balls to different people? This is

    13

    David Ward

    David Ward

    David Ward

  • what the entries represent.In total, how many balls should I distribute? This is the number that the bracket entries should sum to.It is also the power of x whose coefficient is our solution.The brackets and entries together embody the information necessary to model the problem.

    The following question is the most important of this work.Q: What do distinct brackets with numbers as entries relate to in a counting problem?A: A bracket represents a distinct entity which makes up a part of every possible combination. Note thata bracket may represent no part of a particular combination if the bracket has a 0 entry). The entriesare the allowable multiples of the entity of its bracket and are converted if necessary to the same unitsas the entries of all the brackets.

    Our Quest: We are looking for ways that the brackets can represent a distinct part of every possiblecombination. We are looking for ways that the entries reflect the constraints imposed on each bracket type.Understanding this, we boldly go forward in search of brackets and their entries.

    5.1 Brackets

    There are a multitude of ways counting problems possess, and often hide, what is equivalent to distinctbrackets. To illustrate this, we will look at three different types of brackets. In the next three problems wewill see brackets that represent candies, summands and rolls of a die.

    CandyWe can think of distinct brackets as boxes, each containing a different type of candy. Box one has

    lollipops, box two has gum and box three has licorice. It is the contents of the box that makes it distinct.We can now think of the numbers in each bracket as the number of each kind of candy we are allowed totake out of the box.

    Exercise 15: The problem may look like this: In how many ways can you select 15 pieces of candy froma box of lollipops, a box of gum and a box of licorice such that you get at least 4 lollipops, at least 3 but notmore than 8 pieces of gum, and an odd number pieces of licorice? This is an example of a selection problem.

    A possible combination:

    LP LP LP LP LP G G G G G G G L L L

    We see that possible combinations are made of three types of parts, these will be our brackets.2

    666666666666666664

    456789101112131415

    3

    777777777777777775

    2

    666664

    345678

    3

    777775

    2

    6666666664

    13579111315

    3

    7777777775

    Lollypops Gum Licorice

    G(x) = (x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15)(x3 + x4 + x5 + x6 + x7 + x8)(x1 + x3 + x5 + x7 + x9 + x11 + x13 + x15)

    G(x) = x8 + 2x9 + 4x10 + 6x11 + 9x12 + 12x13 + 15x14 + 18x15 + 21x16 + 24x17 + 27x18 + 30x19 + 32x20 + 34x21 + 35x22 + 36x23+

    35x24 + 34x25 + 32x26 + 30x27 + 27x28 + 24x29 + 21x30 + 18x31 + 15x32 + 12x33 + 9x34 + 6x35 + 4x36 + 2x37 + x38

    The solution is 18, the coefficient of x15.

    14

  • Notice that in this problem we had success thinking of the brackets as containers of different candies.The brackets were given their distinction by representing a different type of candy.

    Note: We could have used this Licorice bracket,

    2

    664

    1357

    3

    775.

    Q: Why?A: At least 7 candies must be selected from the Lollipop and Gum boxes. This leaves the maximumof 8 pieces of licorice allowed in any combination. Since the number of licorice pieces must be odd, the

    bracket

    2

    664

    1357

    3

    775 will work.

    SummandWe can think of distinct brackets as summands in an integer solution problem.Exercise 16: How many ways can you add four positive numbers, A, B, C, D, such that their sum is 7?A possible combination is, 1+3+2+1=7, where: A=1, B=3, C=2, D=1. Note that this combination is

    different than, 3+1+2+1, where A=3, B=1, C=2, D=1.

    2

    66666664

    1234567

    3

    77777775

    2

    66666664

    1234567

    3

    77777775

    2

    66666664

    1234567

    3

    77777775

    2

    66666664

    1234567

    3

    77777775

    First Second Third Fourthsummands summands summands summands

    G(x) = (x+ x2 + x3 + x4 + x5 + x6 + x7)4

    G(x) = x4 + 4x5 + 10x6 + 20x7...

    The solution is 20, the coefficient of x7. Notice that in expanding G(x) we can simply omit terms withpowers higher than x7 because we are only interested in the coefficient of x7.

    Q: What makes the brackets distinct from one another?A: The brackets are given their distinction by their positional relationship to each other. This representsthis integer solution problem in that the order of the summands matters.

    Dice rollUnderstanding that the brackets represent something distinct in the counting problem is necessary to

    correctly model it for OGFs. Consider what the brackets represent in the following three similar problems:

    Exercise 17:17a: How many ways can you roll one die three times such that the sum is 5? Here the brackets represent

    the different rolls.2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    Roll 1 Roll 2 Roll 3

    15

  • 17b: How many ways can you roll three dice, one red, one white and one blue, such that they sum to 5?2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    Red White Blue

    Here the brackets represent the different die.

    Q: Notice that the previous two dice problems are modeled by the same set of brackets. What does thismean?A. Identical sets of brackets lead to identical OGFs and therefore will have the same solution set.

    17c: How many ways can we roll three dice in a single roll, such that the sum is 5?For example, because the dice are considered indistinguishable, the single roll of two 1s and a 3 would

    be considered as only one combination that sums to 5. If the dice are considered distinguishable this com-bination could be rolled in three different ways as shown in the brackets bellow:

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775Sum to 5

    Red White Blue

    Each brackets must represent something distinct in each possible combination. In this case there is onlyone roll so the brackets cannot represent the rolls. The brackets cannot represent the dice either, becausethey are indistinguishable. We are unable to apply OGFs in this case because there is nothing distinct forthe brackets to represent.

    Let’s revisit exercise 8: In how many ways can we distribute 7 identical balls to Max and Anna such thatMax gets an even number of balls and Anna gets an odd number of balls, but both get at least one ball?

    2

    4246

    3

    5

    2

    664

    1357

    3

    775

    Max Anna

    Q: How is the following version of this problem different: In how many ways can we distribute 7 identicalballs to two different children such that one gets an even number of balls and the other gets an oddnumber of balls, but both get at least one ball? What is not considered combinatoricaly by modelingthis version of the Max and Anna problem with the original brackets?A. The original version does not allow for Max to ever get the odd number of balls and for Anna to getthe even number of balls, this case is allowed by the wording of this version. This would in effect doubleany solution of the original version.Q. Why can our brackets not model this version?A. Max’s and Anna’s bracket would have to allow them to receive both even and odd numbers ofballs to cover both cases. This would make any selection from Anna’s bracket dependent upon whatwas selected from Max’s bracket. Drawing every possible line through the brackets, as Bracket Line

    16

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

  • counting demands, would produce invalid combinations. For example, both Max and Anna could nowhave an even number of balls. Once the brackets are set up to model a problem, they will produceevery combination possible, all of which, must be valid to successfully model the problem. Bracket Linecounting simply represents what polynomials do when multiplied together. What the polynomial factorsof an OGF can not do is change depending on what the other polynomial factors are. That is, thepolynomial representing the child getting even number of balls can not change to cover the cases whenthe child gets odd number of balls.

    We are simply unable to use OGFs to solve this problem. The brackets used to model a problem mustrepresent something distinct that does not need to change to cover all cases.

    This is a good time to point out a whole class of counting problems for which OGFs do not work.

    Consider how to model this problem: How many ways can you arrange 5 colored blocks in a row. Theblocks are red, blue, orange, yellow and black.Q: What do you realize when you try to model this problem with brackets and entries?A: Brackets that represent the different colored blocks would have what kind or entries? Maybe entriesthat represent that colored block’s position in the row. These numbers, however, would be meaninglessas would the sum of any combination. Consider brackets representing positions in the row and possiblecolors as entries. Such brackets would require all five colors as entries. A line through these bracketscould produce arrangements that are not allowed such as; red, red, blue, red, yellow. In addition, anyOGF formed from these brackets would have colors as exponents. This would be meaningless.

    We are simply unable to use OGFs to solve arrangement or permutation problems.

    What would the brackets represent in each of the following problems.Exercise 18:Q: In how many ways can you make a 25 piece fruit basket with apples, oranges or bananas?A: The brackets represent the different fruits.Q:How many ways can an election turn out if there are three candidates and 50 voters?A: The brackets represent the different candidates.

    5.2 Bracket Entries

    Deciding what the brackets represent is the trick. Once we know what each bracket represents it is oftena simpler task to assign its entries based on the restrictions posed in the problem. We will now considerexamples that illustrate what the bracket entries represent. It helps to always think of the entries as thenumbers to be summed, one from each bracket, to a given number.

    Make a bracket which represents each of the following combinatoric phrases. Many of these may beself-evident by now. Feel free to make infinite brackets. Infinite polynomials are often easier to work withand can be easily expressed as rational functions. See Appendix: Rational Functions.Exercise 19:a. Any number of balls.b. More than 5 balls.c. At least 6 balls.d. Less than 5 balls.e. No more than 4 balls.f. At least 3 but no more than 7 balls.g. An odd number of balls.h. An even number of balls.i. Multiples of 3.

    17

  • Solution: a.

    2

    666666664

    0123.

    .

    .

    3

    777777775

    b.

    2

    6666664

    678.

    .

    .

    3

    7777775c.

    2

    6666664

    678.

    .

    .

    3

    7777775d.

    2

    66664

    01234

    3

    77775e.

    2

    66664

    01234

    3

    77775f.

    2

    66664

    34567

    3

    77775g.

    2

    6666664

    135.

    .

    .

    3

    7777775h.

    2

    666666664

    0246.

    .

    .

    3

    777777775

    i.

    2

    666666664

    0369.

    .

    .

    3

    777777775

    The next example is a little tricky and will require what we know about brackets and their entries.Taking it step by step, we will see how understanding what the brackets and their entries represent, willhelp lead us to a model.

    Exercise 20:In how many ways can you divide 20 beans into piles? This is an example of a partition problem.

    Q. What do we know from the problem as stated?A: 20 identical beansBeans get divided into pilesThe number of beans in each pile, when added together should sum to 20Q: What does this statement imply?: "The number of beans in each pile, when added together shouldsum to 20".A: The entries in the brackets are ’numbers of beans’.It is often helpful to draw a picture.Q: What picture would be helpful?

    A: A picture of one possible combination of bean piles is helpful. Drawing several pictures of possiblecombinations may be necessary at times.

    B BB BBB BB BB BBBBBBBB

    BB

    .This sample combination is illustrated in the brackets on page 25.

    Q: What do you notice? What does this picture make you realize about the piles?A: Piles of all types are needed. That is 1 beanpiles, 2 beanpiles, 3 beanpiles, all the way up to a 20beanpiles. Our picture includes 1 bean, 2 bean and an 8 bean piles.Also combinations may include multiples of a particular type of pile. Our picture has two 1 bean pilesand five 2 bean piles.Q: Knowing that brackets must be distinct, what would you relate the brackets to at this point?A: The only distinction we have uncovered so far is the type of piles. We could let the brackets somehowrepresent the type of piles.Recall that every combination is made up by picking only one entry from each bracket and summingthem together.Q: How can a brackets allow for multiples of a pile to be picked. What might the 2 bean bracket looklike?

    18

  • A: 2

    66666666664

    1(2 beanpile)2(2 beanpile)3(2 beanpile)4(2 beanpile)

    .

    .

    .

    3

    77777777775

    2 beanpile bracket

    Recall from our earlier observations that the bracket entries must be in ’number of beans’.

    Q: What does the bracket look like with ’number of bean’ entries?A: 2

    6666664

    246.

    .

    .

    3

    7777775

    2 beanpile bracketQ: What is missing from our bracket? Hint: Consider combinations that have no piles of two beans.A: The bracket is missing a 0 entry. 2

    666666664

    0246.

    .

    .

    3

    777777775

    2 beanpile bracket

    Q: How would you extent this idea to the other brackets?A:

    2

    666666666664

    012345.

    .

    .

    3

    777777777775

    2

    666666666664

    0246810.

    .

    .

    3

    777777777775

    2

    666666666664

    03691215.

    .

    .

    3

    777777777775

    .........

    2

    666666666664

    0816243240.

    .

    .

    3

    777777777775

    .........

    2

    666666666664

    020406080100.

    .

    .

    3

    777777777775

    Our Sample Combination

    1 beanpiles 2 beanpiles 3 beanpiles 8 beanpiles 20 beanpiles

    Q: What is the OGF?A: G(x) = (1 + x + x2 + x3 + ...)(1 + x2 + x4 + x6 + ...)(1 + x3 + x6 + x9 + ...)(1 + x4 + x8 + x12 + ...)......(1 + x20 + x40 + x60 + ...)Q: What would the coefficient of x7 represent in the expanded form of G(x)?A: The number of ways to divide seven beans into piles.Q: What would the coefficient of x21 represent.A: The coefficients of any power of x greater than 20 are meaningless. G(x) was modeled with 20 beansin mind and no bean piles with more than 20 beans were considered.Challenge Problem: How could you change the brackets of this partition problem that would allow onlyone pile at most of each size?

    19

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

    David Ward

  • We are ready to take another look at the original problem we used to demonstrate how amazing OGFs arein section 2. It is a challenging problem to model and a nice example of clever bracket and entry assignments.

    Exercise 21:In how many ways can you pick 3 different numbers between 1 and 10 such that no two are consecutive?Hint: Is it possible to let the brackets represent the three different numbers?Hint: Draw a picture of a possible combination. This is always helpful. Include spaces to represent the

    numbers not in the combination.Hint: Consider the possible spaces around each selected number.

    Solution: It is reasonable to first try to let the brackets represent the three different numbers in some way.After some thought it is clear there is no way to distinctly represent these numbers with brackets. Boththe numbers and their location relative to each other changes for each possible combination. As hinted,we will let the brackets represent the four distinct gaps about the three possible numbers. Consider thisrandom example of one of the possible combination we could have.

    * * 3 * * * 7 * 9 *1stgap 2ndgap 3rdgap 4thgap

    With some thought, it is clear that a possible combination could have 0 to 5 spaces before the first num-ber (gap 1), 1 to 6 in the middle two gaps (gap 2 & gap 3), and 0 to 5 spaces after the third number (gap 4).

    2

    666664

    012345

    3

    777775

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    2

    666664

    012345

    3

    777775Our Sample Combination

    1stgap 2ndgap 3rdgap 4thgap

    G(x) = (1 + x+ x2 + x3 + x4 + x5)(x+ x2 + x3 + ...x6)(x+ x2 + x3 + ...x6)(1 + x+ x2 + x3 + x4 + x5) =

    (1 + x+ x2 + x3 + x4 + x5)2(x+ x2 + x3 + x4 + x5 + x6)2

    G(x) = x2 + 4x3 + 10x4 + 20x5 + 35x6 + 56x7 + ...

    Q: What coefficient are we interested in? What do the brackets and entries represent?A: The solution is 56, the coefficient of x7. The brackets represent a particular gap. The entries representthe number of spaces, or skipped numbers, in that gap. The sum of one entry from each bracket is thetotal number of spaces or skipped numbers in any combination and must equal 7. We find the solutionin the coefficient of x7 which is the total number of ways to skip 7 of the 10 numbers with the givenconstraints which ensures a space between the first and second number, and a space between the secondand third number.Q: What insures a space between the first and second number, and a space between the second and thirdnumber?A: There is no zero in the middle two brackets.Challenge Problem: In the challenge problem on page 11, we worked form OGF to two different set ofbrackets and then to two different distribution problems. These two problems share the same solution set.For this challenge, work back from an OGF to a distribution and a partition problem. Before you startyour work, try to guess how these problems would relate to one another. Try other types of problemsas well. Work from OGF made up of several simple polynomial factors. Make any observations you canabout your two different counting problems that share the same solution set. Were any of your guessescorrect?

    20

  • 6 Next StepCongratulations, we can now use OGFs to solve counting problems of several types. Many of these problemswould have been quite elusive without OGFs in our toolkit. We have successfully modeled several distribu-tion, selection and partition problems with OGFs. What allows this one fit approach to these different typesof problems is the inherent similarity they share with the process of multiplying polynomials. It is wild thatit works and amazing that someone ever thought of it in the first place.

    The story now continues. OGFs can be expressed as rational functions allowing them to be manipulatedin ways that polynomials do not directly allow. See appendix on rational functions. Incredible methods fordetermining the coefficients of OGFs are then possible without expanding or long division of polynomials.Different types of power series allow for other kinds of generating functions such as exponential generatingfunctions, EGFs. The EGF counts in a different way than the OGF allowing it to model counting problemsthat OGFs cannot. Generating functions of all types can be used to find explicit formulas for many countingproblems and recurrent relations. Finding explicit formulas for sequences is a generating functions speciality.The use of OGFs to find a formula for the Fibonacci Numbers is just beautiful math. So for now, this is theend of the beginning of the OGF story.

    21

  • 7 Appendix: OGFs as Rational FunctionOGFs expressed as rational functions are neat and compact. They are easier to enter into computer algebrasystems than large, sometimes infinite, polynomials.

    With a little creativity you can find a rational function for most polynomials. There are many reasons toexpress our OGF as a rational function rather than the product of polynomials. One wonderful applicationof OGFs is finding explicit formulas for counting problems. That is, given a counting problem such as findingthe number of ways N to distribute n identical balls in a specific way, OGFs can often be used to find N(n).That is N as a function of n. With such a formula one can simply plug in the number of balls and get thenumber of ways! This is possible because we can manipulate rational functions in ways that polynomials donot directly allow.

    Much is derived from the following equality and the understanding of the manipulations in it’s shortproof. Many rational functions can be discovered by playing with this equality.

    1 + x+ x2 + x3 + x4 + ... =1

    1� xAlthough this equality is only true for �1 < x < 1, we can use it freely as the value of x is never

    introduced in OGFs.The proof is nice. Remember that x0 = 1.

    1 + x+ x2 + x3... = 1�x1�x (1 + x+ x2 + x3...) = (1+x+x

    2+x3...)�(x+x2+x3...)1�x =

    11�x

    (1) We are now able to model brackets with numbers � 0 by the rational fraction 11�x .

    2

    666666664

    0123.

    .

    .

    3

    777777775

    (1 + x+ x2 + x3...)1

    1� x

    (2) This also means: (1 + x+ x2 + x3...)n = 1(1�x)n .

    2

    666666664

    0123.

    .

    .

    3

    777777775

    1st

    2

    666666664

    0123.

    .

    .

    3

    777777775

    2nd

    2

    666666664

    0123.

    .

    .

    3

    777777775

    3rd

    ...

    2

    666666664

    0123.

    .

    .

    3

    777777775

    n

    th

    (1 + x+ x2 + x3...)n1

    (1� x)n

    This is now our rational function that models n brackets, each of which contain the numbers � 0.

    The next three very useful rational functions we obtain by lopping of the parts of our power series1 + x+ x2 + x3 + ... that we do not want.

    22

  • (3) To model a bracket of all numbers � 5, we must remove the first 5 terms of the power series(1 + x+ x2 + x3 + x4 + ...). This can be done by simply multiplying (1 + x+ x2 + x3 + x4 + ...) by x5.

    x

    5(1 + x+ x2 + x3 + x4 + ...) = (x5 + x6 + x7...) = x51

    1� x =x

    5

    1� x

    2

    6666664

    567.

    .

    .

    3

    7777775(x5 + x6 + x7 + ...)

    x

    5

    1� x

    In general the rational function which models a bracket with entries � n is xn

    1�x

    (4) To model a bracket of entries 5, we have to lop off the end of our power series. We can do this byusing what we know from part (3) above.

    (1 + x+ x2 + x3 + x4 + x5) = (1 + x+ x2 + x3 + x4 + x5 + x6...)� (x6 + x7 + x8 + ...) =

    1

    1� x �x

    6

    1� x =1� x6

    1� x

    2

    6666664

    012345

    3

    7777775(1 + x2 + x3 + x4 + x5)

    1� x6

    1� x

    In general the rational function which models a bracket with entries n is 1�xn+1

    1�x .

    23

  • (5) To model a bracket with entries � 3 and 6, we have to lop off both ends of our power series. Wecan do this by combining what we know from parts (3) and (4) above.

    (x3 + x4 + x5 + x6) = (1 + x+ x2 + x4 + ...)� (1 + x+ x2)� (x7 + x8 + x9 + ...) =

    1

    1� x �1� x3

    1� x �x

    7

    1� x =x

    3 � x7

    1� x

    2

    664

    3456

    3

    775 (x3 + x4 + x5 + x6)

    x

    3 � x7

    1� x

    Remember that any rational function is still just a quotient. We can show x3 + x4 + x5 + x6 = x3�x71�x

    with long division.x

    6 + x5 + x4 + x3

    � x+ 1�� x7 + x3

    x

    7 � x6

    � x6x

    6 � x5

    � x5x

    5 � x4

    � x4 + x3x

    4 � x3

    0

    In general the rational function which models a bracket with entries � n and m is xn�xm+11�x .

    We have been able to produce a rational expression for any continuous piece of our power series bysimply multiplying the power series thru by various powers of x and subtracting off the ends we do notwant. Another useful way to play with our power series is to simply substitute higher powers of x in for x.

    (6) Letting x be x2, we see that (1 + x+ x2 + x3 + ...) = 11�x becomes:

    1 + (x2) + (x2)2 + (x2)3 + ... = 1 + x2 + x4 + x6 + ...1

    1� x2

    Note that this models a bracket with entries that are multiples of two.

    2

    666666664

    0246.

    .

    .

    3

    777777775

    (1 + x2 + x4 + x6 + ...)1

    1� x2

    In general, the rational function which models a bracket with entries that are only multiples of n is 11�xn .

    24

  • (7) We will end with the rational function which models a bracket with only odd entries.

    x+ x3 + x5 + x7 + ... = x(1 + x2 + x4 + x6...) = x1

    1� x2 =x

    1� x2

    Note that this rational function does not include the possibility of distributing no balls to the box.We can allow for this possibility by simply adding 1 to the power series.

    1 + x+ x3 + x5 + x7 + ... = 1 +x

    1� x2 =1 + x� x2

    1� x2

    2

    666666664

    0135.

    .

    .

    3

    777777775

    (1 + x+ x3 + x5 + ...)1 + x� x2

    1� x2

    How many ways can you roll a total of 11 with three rolls of a die?2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775

    2

    666664

    123456

    3

    777775(x + x2 + x3 + x4 + x5 + x6)3 G(x) =

    ⇣x � x7

    1 � x

    ⌘3

    Note: Expressed as a product of polynomials, we expand G(x) to show solutions in the form of coefficients.Expressed as a rational function we perform long division to show the coefficients of G(x). Computer algebrasystems are wonderful in either case.

    The answer is 27, the coefficient of x11.

    x

    18 + 3x17 + 6x16 + 10x15 + 15x14 + 21x13 + 25x12 + 27x11 + 27x10 + 25x9 + 21x8 + 15x7 + 10x6 + 6x5 + 3x4 + x3

    � x3 + 3x2 � 3x + 1�� x21 + 3x15 � 3x9 + x3

    x

    21 � 3x20 + 3x19 � x18

    � 3x20 + 3x19 � x18

    3x20 � 9x19 + 9x18 � 3x17

    � 6x19 + 8x18 � 3x17

    6x19 � 18x18 + 18x17 � 6x16

    � 10x18 + 15x17 � 6x16 + 3x15

    10x18 � 30x17 + 30x16 � 10x15

    � 15x17 + 24x16 � 7x15

    15x17 � 45x16 + 45x15 � 15x14

    � 21x16 + 38x15 � 15x14

    21x16 � 63x15 + 63x14 � 21x13

    � 25x15 + 48x14 � 21x13

    25x15 � 75x14 + 75x13 � 25x12

    � 27x14 + 54x13 � 25x12

    27x14 � 81x13 + 81x12 � 27x11

    � 27x13 + 56x12 � 27x11

    27x13 � 81x12 + 81x11 � 27x10

    � 25x12 + 54x11 � 27x10 � 3x9

    25x12 � 75x11 + 75x10 � 25x9

    � 21x11 + 48x10 � 28x9

    21x11 � 63x10 + 63x9 � 21x8

    � 15x10 + 35x9 � 21x8

    15x10 � 45x9 + 45x8 � 15x7

    � 10x9 + 24x8 � 15x7

    10x9 � 30x8 + 30x7 � 10x6

    � 6x8 + 15x7 � 10x6

    6x8 � 18x7 + 18x6 � 6x5

    � 3x7 + 8x6 � 6x5

    3x7 � 9x6 + 9x5 � 3x4

    � x6 + 3x5 � 3x4 + x3

    x

    6 � 3x5 + 3x4 � x3

    0

    25

  • Exercise 21: Write the OGFs we found in throughout this work as rational functions. They are listedbelow:

    Exercise 8: G(x) = (x2 + x4 + x6)(x1 + x3 + x5 + x7)A: G(x) = x

    3(1�x6)(1�x8)(1�x2)2

    Exercise 9: G(x) = (x+ x2 + x3 + x4 + x5 + x6)3

    A: G(x) = x3(1�x6)3(1�x)3

    Exercise 10: G(x) = (x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8)3

    A: G(x) = (1�x9)3

    (1�x)3

    Exercise 13: G(x) = (1 + x5 + x10 + x15 + x20 + x25)(1 + x10 + x20)A: G(x) = (1�x

    30)2

    (1�x5)(1�x10)

    26