Final Exam Review I -- Solutions


1a. Product Principle: kn
  b. Product Principle: kn = k(k−1)⋅⋅⋅(k−n+1)
  c. PIE: A = {ordered list, any repeats}, Ai = {no element i} for i = 1,...,n.
       kn − (n | 1) (k−1)n + (n | 2) (k−2)n − ⋅⋅⋅ + (−1)n−1 (n | n−1) 1n .
  d. Product Principle in reverse: (n | k) = nk / k! = n! / k!(n−k)!
  e. Bins-and-beans correspondence (Notes 1/11):
       ((n | k)) = (k+n−1 | n−1) = (k+n−1 | k)
  f. Correspondence: remove 1 element of each kind.
       ((n | k−n)) = (k−1 | k−n) = (k−1 | n−1)

2a. ((3 | 10)) = (10+3-1 | 3-1) = (12 | 2) = 66.
  b. ((3 | 10-3)) = (9 | 2) = 36.
  c. Ans: 19.

3a. Problem: Let ak be the number of triples of whole numbers n1, n2, n3 ≥ 0  satisfying the equation n1 + n2 + n3 = k.  Evaluate the generating function f(x) = ∑k≥0 akxk using the Product Principle, and use this to get an expression for ak.
Solution: The cases counted by the coefficients ak cannot be easily factored into a sequence of choices, but consider all choices of (n1,n2,n3) without specifying the sum k:

choose (n1,n2,n3)   ⇔   (n1 = 0 or n1 = 1 or n1 = 2 or ...) and (n2 = 0 or ....) and (n3 = 0 or ...)

To turn this into a generating function, replace the left side by f(x);   "or" by plus;   "and" by times;    "ni = m" by xm (since this choice contributes m to the sum n1+n2+n3):

f(x) = ∑k≥0 akxk = (x0 + x1 + x2 + ...) (x0 + ...)(x0 + ...)
= (1 + x1 + x2 + ...)3 = ( 1/(1-x) )3 = ∑k≥0 ((3 | k)) xk .

Hence ak = ((3 | k)) = (k+3-1 | 3-1) = (k+2)(k+1)/2 , and in particular a10 = 66. Here (n | k) means (n choose k) and ((n | k)) means ((n multi-choose k)) .

3b. Problem: Now let bk be the number of solutions to n1 + n2 + n3 = k with n1, n2, n3 ≥ 1. Determine bk by evaluating g(x) = ∑k≥0 bkxk.
Solution: By the same reasoning,

g(x) = ∑k≥0 bkxk = (x1 + x2 + ...) (x1 + ...)(x1 + ...)
= ( x (1 + x1 + x2 + ...) )3 = x3( 1/(1-x) )3
= ∑k≥0 ((3 | k)) xk+3 = ((3 | 0)) x3 + ((3 | 1)) x4 + ((3 | 2)) x5 + ...
= ∑k≥3 ((3 | k-3)) xk
Hence bk = ((3 | k-3)) = (k-3+3-1 | 3-1) = (k-1)(k-2)/2.

4. Problem: Solve the recurrence ak = 3ak−1 − 2ak−2 for k ≥ 2, with a0 , a1 arbitrary constants.
Solution: The generating function is:

f(x) =
(a1-3a0)x + a0

1 − 3x + 2x2
.
Since the denominator factors as:   1 − 3x + 2x2 = (1 − x)(1 − 2x) , we may write:

f(x)  =  A/(1−x) + B/(1−2x)  =  ∑k≥0 A xk + ∑k≥0 2B xk ,

where: A = 2a0 − a1  , B = a1 − a0 .Collecting xk terms, we find:

ak  =  2a0 − a1  +  2k (a1 − a0) .

For the special case a0 = a1 = 1, the recurrence clearly works out as ak = 1, which agrees with our general formula.