Solution Notes for Set 1 - Harvard Math Department

Math S305
Summer 2014
Solutions for Problem Set 1
Homework 1 Solutions
3) Using a calculator, multiply 11202361 by 54700343 by multiplying the polynomials 1120t +
2361 and 5470t + 343 and evaluating the product at an appropriate value for t.
(1120t + 2361)(5470t + 343) = 6126400t2 + 384160t + 12914670t + 809823 =
6126400t2 + 13298830t + 809823. Evaluate this at t = 10,000 to get 612,772,989,109,823. Many
of you worked out the full solution, either by hand or with Mathematica, which is excellent. You
only needed to come up with the fact that t needs to be 10,000 to get credit.
4) Next, it's time to dive into some more generating functions(!) First, remember that a
generating function is a "formal" expression - equivalent to an "infinite polynomial" A + B X+ C
X2 + D X3 + E X4 + ... (all the generating functions we saw today started with A = 1) meaning
that it might or might not make sense when viewed as a polynomial function(!)
(a) As a first quick reminder of what we worked on in class, what is 1 / (1 - x) equal to as an
"infinite" polynomial? (using the idea that if A times B = 1, then we can say that 1 / A is
"formally" equivalent to B)
(1 – x)(1 + x + x2 + … + xn) = 1 + x + x2 + … + xn
– x – x2 – … – xn – xn+1
1 – xn+1
This should equal 1 since this would technically never stop at a final term involving
a power of x – all the terms except for the constant term “1” would all be
canceled by the – x term.
We know that since (1 – x)(1 + x + x2 + … ) = 1, then 1/(1-x) = (1 + x + x2 + … ).
(b) Thinking about this result, then what (formally) is the infinite polynomial that "equals" 1
/ (1 + x) ? The reason I keep writing "formally" is that we don't know if these infinite
polynomials "make sense" in the way we're used to regular finite polynomial functions it's not as if we can just substitute any value for x and expect to get a finite result - we're
just working with these infinite polynomials using the same rules we have for
regular/finite polynomials - but we're not treating them as if they're the same as
polynomial functions.
In this case, we need to alternate between positive and negative terms in the infinite
polynomial so that the terms will line up and cancel each other out. So, we know (1 –
x + x2 – … ) = 1/(1 + x). For example,
(1 + x)(1 – x + x2 – … + xn) = 1– x + x2– … + xn
+ x – x2 + … – xn + xn+1
1 + xn+1
Math S305
Summer 2014
Solutions for Problem Set 1
Another helpful way to think of this is to recognize that 1/(1 + x) = 1/(1 – (-x)). Replacing x with
–x in the sequence 1 + x + x2 + … will give us a positive coefficient for all the even powers and
a negative coefficient for all the odd powers.
5)(a) Now, formally applying rules of addition of polynomials, term by term, what is the infinite
polynomial that is "equal" to 1 / (1 - x) + 1 / (1 + x) ?
1/(1 – x) + 1/(1 + x) = (1 + x + x2 + … ) + (1 – x + x2 – … ) = 2 + 2 x2 + 2 x4 + …
(b) Thinking about this in another way, the infinite polynomial 1 + x^2 + x^4 + x^6 + ...
equals 1 / P(x) for what polynomial P(x)?
1/(1 – x) + 1/(1 + x) = 2/(1 – x2). So, 1 + x2 + x4 + … = 1/(1 – x2)
(c) And generalizing this result, the infinite polynomial 1 + x^3 + x^6 + x^9 + ... equals 1 /
R(x) for what polynomial R(x)?
Generalizing this result, we have 1 + x3 + x6 + … = 1/(1 – x3) = 1/(1 – x)(1 + x + x2).
Multiplying this out gives us (1 – x3)(1 + x3 + x6 +…) =
(1 + x3 + x6 +…)(- x3 - x6 – x9…) = 1, confirming our generalization.
(d) and, some last "food for thought" - in our next class we'll look at the infinite
polynomial F(x) = 1 + x + 2 x^2 + 3 x^3 + 5 x^4 + 8 x^5 + 13 x^6 + ...
...why did I label this infinite polynomial "F(x)"?!
Because the coefficients are the Fibonacci sequence!
6) Finally, here's a challenging problem involving more coin counting, using the generating
functions that you just investigated, as an extension of what we did in class last Tuesday... good
luck!
How many ways are there to make 40 cents out of pennies, nickels, dimes, and quarters? You
can almost just work this out by hand, but here's a much more sophisticated way to go about this
type of problem...
First, there is only one way to represent any particular as the sum of pennies (i.e. using pennies
there is only one way to make 6 cents - use 6 pennies!). Now we can use a generating function
to encode this information as follows:
P(x) = 1 + x + x2 + x3 + ... which formally equals 1/(1 - x)
Here the coefficients of P(x) are all equal to 1, representing the 1 way that each amount can be
represented (e.g. the coefficient of x^6 is 1, representing the 1 way 6 cents can be represented
using pennies).
Math S305
Summer 2014
Solutions for Problem Set 1
Next, here's a generating function for the number of ways C cents can be made using just
nickels:
N(x) = 1 + x5 + x10 + x15 + x20 + ... which formally equals 1 / (1 - x5)
Why is this? ...there's only 1 way to make any multiple of 5 cents, and there are 0 ways of
making any other amount, so the coefficients are all either equal to 1 (for the powers of x equal
to multiples of 5), or 0 (for all the other powers of x).
So, here's the cool thing - look at P(x) times N(x) = 1 + x + x2 + x3 + x4 + 2x5 + 2x6 + 2x7 + 2x8 +
2x9 + 3x10 + 3x11 + ...
which formally equals 1/(1-x) times 1/(1-x5) which is just 1 / [(1-x) (1-x5)]
Now, take a look - given that the coefficient of x10 is 3, then this means that there are 3 ways of
representing 10 cents with just pennies and nickels: (i) 10 pennies, or (ii) 1 nickel and 5 pennies,
or (iii) just 2 nickels.
So now write down a way to use this approach to figure out the number of ways N cents
can be represented using pennies, nickels, dimes, and quarters - I'll show you how to use
Mathematica to actually calculate the result for any value of N cents, but for now don't
worry about calculating any actual numerical answers.
Pennies can be represented by the generating function 1/(1 – x); Nickels by 1/(1 – x5);
Dimes by 1/(1 – x10); Quarters by (1 – x25). So the number of ways N cents can be
represented using these four coins can be found from the coefficients of the generating
function given by their product 1/((1 – x)(1 – x5)(1 – x10)(1 – x25)). So to find the number
of ways to make 40 cents, we need to find the coefficient of x40, which happens to be 31.
As a side note, many of you noticed that there are obvious places to truncate the
polynomials in order to computer the coefficient of x40. For pennies, nickels, and dimes,
we need to take the polynomials out to x40 in order to be sure that we will “catch” all the
terms that multiply out to x40. There is no x40 term in the polynomial for quarters, and
there is no reason to include the x50 term, so we can truncate this polynomial at x25. That
makes the Mathematica calculations much faster, but it means we have to be aware that
the coefficients of the terms after x40 will be too low because there are missing terms.
[You didn’t need to make this observation to get credit].