Homework 5 Solutions#
The write-ups below model the amount of explanation expected in a complete handwritten submission.
A constrained sum#
Problem. Let
(A) Let, , and be the generating functions for the allowed choices of , , and , respectively. Write each generating function both as a series and in closed form. (B) Then find the generating function for the required problem in closed form.(C) Use Sage to find the number of solutions for, , and . Include your Sage code and output with your work (screenshot is fine).
Solution.
Approach. Each variable gets its own generating function, in which
the exponent records the value of that variable. Choosing
(A) The allowed values of
(B) A solution of
(C) The answers are the coefficients
var('x')
A = x^11 * (1 - x^11) / ((1 - x) * (1 - x^2)^2)
S = A.series(x, 51)
print(S.coefficient(x, 20), S.coefficient(x, 35), S.coefficient(x, 50))Output:
15 63 90Therefore
Check for
Computing a closed formula for a sum of cubes#
Problem. In this exercise we use generating functions to compute a
closed formula for the sum of the cubes of numbers
(A) Write down the generating function in closed form for the sequence. (B) Find the generating function in closed form for the sequence. (C) Find the generating function in closed form for the sequence. (D) Find the generating function in closed form for the sum of cubes up to. (E) Findand use that to extract the coefficient of from .
Solution.
Approach. Applying the operator
(A) By the geometric series,
(B) Apply
(C) Apply
(D) Let
(E) The coefficient of
Compositions with parts 1, 2, and 3#
Problem. Let
(A) Write the generating functionfor one part, and explain why counts compositions having exactly parts. (B) Sum over all possible numbers of parts to prove that(C) Use Sage to find. Also report the list . Include your Sage code and output with your work.
Solution.
(A) One part has value
(B) Every composition has exactly one number of parts
(C)
var('x')
R = 1 / (1 - x - x^2 - x^3)
T = R.taylor(x, 0, 30)
print(T.coefficient(x, 30))
print([T.coefficient(x, k) for k in range(13)])Output:
53798080
[1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927]Therefore
Ordered compositions versus restricted partitions#
Problem. Let
(A) Modelwith an ordinary generating function . Write and explain one factor for each allowed part size. In particular, explain why this model is a product of factors rather than the sequence construction used in Exercise 3. (B) Use Sage to compute, , and . Include your Sage code and output with your work. Make sure your Taylor expansion includes the coefficient of .
Solution.
(A) Since order is irrelevant, a choice of parts is determined by the
numbers
(B)
var('x')
P = 1 / ((1 - x) * (1 - x^3) * (1 - x^4) * (1 - x^6))
T = P.taylor(x, 0, 100)
print(T.coefficient(x, 25), T.coefficient(x, 50), T.coefficient(x, 100))Output:
75 425 2835Therefore